diff options
Diffstat (limited to 'khangman')
86 files changed, 5465 insertions, 0 deletions
diff --git a/khangman/AUTHORS b/khangman/AUTHORS new file mode 100644 index 00000000..2fedcab5 --- /dev/null +++ b/khangman/AUTHORS @@ -0,0 +1,2 @@ +Whitehawk Stormchaser <zerokode@yahoo.com> +Anne-Marie Mahfouf <annma@kde.org> diff --git a/khangman/COPYING b/khangman/COPYING new file mode 100644 index 00000000..37ba36f1 --- /dev/null +++ b/khangman/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) 19yy <name of author> + + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/khangman/ChangeLog b/khangman/ChangeLog new file mode 100644 index 00000000..337a55d6 --- /dev/null +++ b/khangman/ChangeLog @@ -0,0 +1,5 @@ +June 23, 2005 + +- add timers for KPassivePopup (Hint and Already Guessed) to allow young children to read (young children need more time) +- fixed hint position +- tooltip if no Win dialog to say the game is finished (is displayed for 4 seconds) diff --git a/khangman/INSTALL b/khangman/INSTALL new file mode 100644 index 00000000..02a4a074 --- /dev/null +++ b/khangman/INSTALL @@ -0,0 +1,167 @@ +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes a while. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Type `make install' to install the programs and any data files and + documentation. + + 4. You can remove the program binaries and object files from the + source code directory by typing `make clean'. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. + diff --git a/khangman/Makefile.am b/khangman/Makefile.am new file mode 100644 index 00000000..0295084a --- /dev/null +++ b/khangman/Makefile.am @@ -0,0 +1,13 @@ +####### kdevelop will overwrite this part!!! (begin)########## + +SUBDIRS = khangman + +EXTRA_DIST = TODO README AUTHORS khangman.lsm INSTALL ChangeLog COPYING khangman.kdevprj + +####### kdevelop will overwrite this part!!! (end)############ +# not a GNU package. You can remove this line, if +# have all needed files, that a GNU package needs +AUTOMAKE_OPTIONS = foreign + +include ../admin/Doxyfile.am + diff --git a/khangman/README b/khangman/README new file mode 100644 index 00000000..92673820 --- /dev/null +++ b/khangman/README @@ -0,0 +1,14 @@ +24 July 2001 + +To run the game from cvs: +make -f Makefile.dist +./configure --prefix=/usr +make +su -c "make install" + +The game installs in /usr/local/kde if the prefix option is not invoked (run +/usr/local/kde/bin/khangman to start it). +In that case, the pics don't appear, you have to copy them in /usr/share/icons. +This will be fixed soon. + + diff --git a/khangman/README.developer b/khangman/README.developer new file mode 100644 index 00000000..54f28f67 --- /dev/null +++ b/khangman/README.developer @@ -0,0 +1,6 @@ +1) Please don't change unwisely the Makefile.am in each dir as they were reworked by David Faure +on 28th April 2003. +http://lists.kde.org/?l=kde-cvs&m=105151850900957&w=2 +If you use KDevelop, make sure you don't overwrite these Makefile.am with the ones from KDevelop. + + diff --git a/khangman/README.languages b/khangman/README.languages new file mode 100644 index 00000000..d72a7a72 --- /dev/null +++ b/khangman/README.languages @@ -0,0 +1,76 @@ +Dear Translator, + +Here is a an outline of the steps necessary to translate the words of the game to your language. There are 175 words to translate but you can add more if you want. + +The twenty two available languages so far by code: ca cs da de en es fr fi hu it nb nl nn pt pt_BR ru sl sr sr@Ltn sv tg tr + +Most of this data should be completed to include hints, please see below. + +Complete data: fr en it only have hints so the other above languages must be updated as soon as possible. + +The words are stored in 4 separate files, one for each level. The files are in /khangman/data/en. The file easy.txt is for level easy, the file medium.txt is for level medium, the file animals.txt is for level animals and the file hard.txt is for level hard. + + English is the default and thus the only language to be shipped with KHangMan. All other language data are put in the correct kde-i18n. + +1. Be sure you are working with the latest cvs HEAD sources of KHangMan by issuing a + +cvs up -dPA khangman + +in the kdeedu module. +Then +cd kdeedu/khangman + +2. Enter the following commands in a konsole to create the directory + and files for the new language: + + ./add_language <language_code> + + Here you must replace <language_code> with your language code. + +The program will refuse a non-valid language code! + +3. The files now use the kvtml format. The tag <o> is for the word and the tag <t> is for the hint. Try to match the hint with the level of difficulty. The level 'Easy' will require an easy hint but the level 'Hard' will require the definition in the dictionary. Try not to use words of the same family in the hint, that would give the word away too easily! An example of a kvtml file is as follow: + +<?xml version="1.0"?> +<!DOCTYPE kvtml SYSTEM "kvoctrain.dtd"> +<kvtml> +<e> +<o>cane</o> +<t>è il tuo animale domestico preferito</t> +</e> +... +... +</kvtml> + + 4. Edit all indicated text files in the new directory with a text editor, and replace each word inside the <o> tag with a translated word and each hint inside a <t> with a translated hint. It is not really important that the exact meaning is preserved, but try to keep the length and level of difficulty roughly the same. + You can include words with white space or - in them, in that case the white space or the - will be shown instead of the _. + Please contact me if there is anything special related to your language so I can adapt the code to it (especially the special and accented characters). + +You can just translate the words but you can also adapt them following the level and add new words if you want. For example, "table" is in level easy in English but in your language, it can be level medium. Feel free to adapt the files to your language needs. The number of words in a file is not important, you can add some if you want. + + + +Note that you must use UTF-8 encoding when editing the files. If your editor can't do this, try using kwrite or kate. When opening a file in kwrite or kate you can select utf8 encoding with the top right combo box. + + Please keep the actual english tts in your language_code dir. + +5. Enter the following command to install the new data files: + + make + make install + + You may have to become root to run 'make install', depending on your + installation. + +6. Run the game and check that your language has been added: + + khangman + +7. Instead of committing your files, please sent them to me tarred and gzipped. As there are now twenty two languages, a wizard (KNewStuff) is now included in KHangMan to easily download and install new languages that are placed on the website. This is done to reduce the size of the kdeedu module and it will also be done in KLettres, KStars and maybe KTouch. + Please contact me by email (annemarie.mahfouf AT free DOT fr) if you need further information. + When you send me the files, please don't forget to mention any special characters used in your language (put them in a text file, one per line and add this file in the tarball) and please mention any other specificity. + Please never commit files in a BRANCH as it might break the game. + +Good luck and thanks! + +Last update: October 23rd 2004
\ No newline at end of file diff --git a/khangman/README.packagers b/khangman/README.packagers new file mode 100644 index 00000000..14f4a556 --- /dev/null +++ b/khangman/README.packagers @@ -0,0 +1,19 @@ +Fonts in KHangMan +------------------------- + +KHangMan uses 2 special fonts: Domestic Manners and Dustismo Roman. This gives a nicer look to KHangMan! +These 2 fonts are fully GPL, the licence is available for each of them, embedded in the font. +Those 2 fonts are in kdeedu/khangman/khangman/fonts source and then the program looks if the fonts are installed or not for the user. If not, those fonts are installed in the personnal home of the user using the fonts:/ ioslave to copy them +to the user's fonts location. + +This can cause problems, because if the program +is used by 100 users there will be 100 copies of the font, one for each user. + +To solve that we suggest making a package with those fonts for your distribution and make KHangMan depends on it. + +If you do not want/cannot do that, please make depend KHangMan on +having kdebase installed as the fonts:/ ioslave is there. + +Anne-Marie Mahfouf +KHangMan maintainer +annemarie.mahfouf@free.fr diff --git a/khangman/TODO b/khangman/TODO new file mode 100644 index 00000000..5f62bd27 --- /dev/null +++ b/khangman/TODO @@ -0,0 +1,80 @@ +KHANGMAN - NEW IDEAS - NEW DESIGN + +TODO +--------- +- fix hint position DONE +- get a new Languages Settings icon ---- +- get a new KHangMan crystal icon ---- +- bundle the fonts with install ---- +- fix the font size ---- +- tooltip if no Win dialog - DONE ---- +- find a way to better finish game (win or loose) ---- +- allow to change font in Settings (add a Fonts tab) ---- +- add a Quick STart dialog in doc ---- +- finish German ß->SS ---- + + +Code cleaning (ingwa): + +* General + - Make all classes use the m_ convention for members ---- + - Make members private as far as possible + - Make members and methods use more descriptive names. + +* Special for khangman + - Rename the c, d, f, g members in khangmanview! + - Make the themes parameterized. Now the tests and values + for different themes are spread out throughout the whole code. + + +14 June 2005 +------------------- + +- German: in Settings dialog, give the choice of playing all uppercase + or all lower case + lower case: ä,ö,ü,ß + upper case: Ä,Ö,Ü,SS + +- KPassivePopup for tip: good solution? tip appears always at the same place, where ever you click. Is that good? Should the tooltip appear where the user clicked instead? +- usability of the Configure KHangMan dialog DONE +- enable hint: in Settings at the moment, should it be as a button in the toolbar as well? (Danny) +- font size (use QFont::setPixelSize (thanks psn) instead of size) - make sure you use pretty big sizes though else it'll get unreadable fast on a big monitor - 156pt will be enough - QPaintDevice::x11AppDpiX() and QPaintDevice::x11AppDpiY() will give the dpi values + +11 April 2005 +------------------ +- center the word display +- better position the passive popups DONE +- choose font in configuration (2 dialogs: for Misses + Word and for Guess+charWrite) +- Misses and word font the same? (uniformity prefered by Dannya) -> have the _ the same size +- make the gradient disappear in minimum size so that the added parts merge exactly +- change the wording of Misses to Mistakes? (Reuben) + +07 April 2005 +------------------ +- urgent: implement Desert theme DONE 10 April +- urgent: position better KPassivePopup DONE 11 April +- implement fontChecker for Domestic Manners and Dustimo Roman in main.cpp +- find a way to end a game (when you lose or when you win -> special animation?) + +22 March 2005 +-------------------- +Menubar +- Look menu -> switching theme DONE 10 April +- Language menu -> switching language DONE 10 April + +Options - themes + +- DONE sea theme: the "light" to blink when changing animations... +in practice, there would be a bg image with the light on, and one with the light off... +maybe we overlay just the light part on a standard bg +- preview theme is Settings dialog + +we could write the options if needed in some kind of theme file (Dannya) + +NEW: Young kids theme with 120x120 pixels area to put an image -> new kvtml file with pic name as hint + +DONE Misses and Word and Guess: QPainter for each theme + +Toolbar for special chars and normal: transparent image bg for one + + diff --git a/khangman/add_language b/khangman/add_language new file mode 100755 index 00000000..7f9e8da9 --- /dev/null +++ b/khangman/add_language @@ -0,0 +1,49 @@ +#!/bin/sh +# Script to add a new language to khangman + +# Check parameters +if test $# = 0 || test $# -gt 1 || test $1 = "--help" ; then + echo "usage: add_language <language_code>" + exit +fi +echo "Please send your files tarred and zipped to annemarie.mahfouf@free.fr and note anything specific to your language such as special characters. Please add all special characters in a text file. Thanks a lot. + +The script will carry on, please just do not commit the files. Please NEVER commit in a BRANCH." + +# Check for valid language code +all_langs=$KDEDIR/share/locale/all_languages +if test -e $all_langs ; then + grep -q "^\[$1\]$" $all_langs + if test $? != 0 ; then + echo "add_language: error: \"$1\" is not a valid language code" + exit + fi +fi + +# Set up variables +code=$1 +dir=khangman/data +lang=$dir/$code +en=$dir/en + +# Check if directory already exists +if test -e $lang ; then + echo "add_language: error: \"$1\" already exists" + exit +fi + +# Create the directory and copy files to it +mkdir $lang +cp $dir/en/*.txt $lang +sed -e "s/\/en/\/$code/" $en/Makefile.am > $lang/Makefile.am +touch $dir/Makefile.am + +# Tell user what to do +echo "The language $code has been successfully added!" +echo "" +echo "Please edit the following files and translate the english words and english hints:" +ls $lang/*.txt +echo "" +echo "The files now use the kvtml format." +echo "See http://edu.kde.org/khangman/add_language.php for more information." +echo "Thanks a lot for your contribution!"
\ No newline at end of file diff --git a/khangman/khangman.kdevprj b/khangman/khangman.kdevprj new file mode 100644 index 00000000..4377662e --- /dev/null +++ b/khangman/khangman.kdevprj @@ -0,0 +1,335 @@ +[AUTHORS] +dist=true +install=false +install_location= +type=DATA + +[COPYING] +dist=true +install=false +install_location= +type=DATA + +[ChangeLog] +dist=true +install=false +install_location= +type=DATA + +[Config for BinMakefileAm] +addcxxflags= +bin_program=khangman +cflags= +cppflags= +cxxflags=\s-O0 +ldadd=\s$(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT) +ldflags= +libtool_dir= +path_to_bin_program=./khangman + +[General] +AMChanged=false +author=Whitehawk Stormchaser +configure_args=\s--build=i386-linux --host=i386-linux --target=i386-linux\s +dir_where_make_will_be_called=./ +email=zerokode@yahoo.com +kdevprj_version=1.3 +lfv_open_groups=Headers +make_options=\s-j1 +makefiles=Makefile.am,khangman/Makefile.am,khangman/sounds/Makefile.am,khangman/pics/Makefile.am,khangman/data/Makefile.am, +modifyMakefiles=true +project_name=KHangMan +project_type=mini_kde2 +short_info= +showNonProjectFiles=true +sub_dir=khangman/ +version= +version_control=None +workspace=265262646 + +[INSTALL] +dist=true +install=false +install_location= +type=DATA + +[LFV Groups] +Desktop=*.desktop, +GNU=AUTHORS,COPYING,ChangeLog,INSTALL,README,TODO,NEWS, +Headers=*.h,*.hxx,*.hpp,*.H, +Others=*, +Sources=*.cpp,*.c,*.cc,*.C,*.cxx,*.ec,*.ecpp,*.lxx,*.l++,*.ll,*.l, +Translations=*.ts,*.po, +User Interface=*.ui,*.kdevdlg,*.rc, +groups=Headers,Sources,GNU,Translations,User Interface,Desktop,Others + +[Makefile.am] +files=TODO,README,AUTHORS,khangman.lsm,INSTALL,ChangeLog,COPYING,khangman.kdevprj, +sub_dirs=khangman +type=normal + +[README] +dist=true +install=false +install_location= +type=DATA + +[TODO] +dist=true +install=false +install_location= +type=DATA + +[khangman.kdevprj] +dist=true +install=false +install_location= +type=DATA + +[khangman.lsm] +dist=true +install=false +install_location= +type=DATA + +[khangman/Makefile.am] +files=khangman/khsplash.h,khangman/khsplash.cpp,khangman/main.cpp,khangman/lo16-app-khangman.png,khangman/khangman.cpp,khangman/lo32-app-khangman.png,khangman/khangman.h,khangman/khangman.desktop,khangman/cr16-app-khangman.png,khangman/cr32-app-khangman.png,khangman/mainw.ui,khangman/infodlg.ui,khangman/info.cpp,khangman/info.h +sub_dirs=data,pics,sounds, +type=prog_main + +[khangman/data/Makefile.am] +files=khangman/data/easy.txt,khangman/data/animals.txt,khangman/data/hard.txt,khangman/data/medium.txt +sub_dirs= +type=normal + +[khangman/data/animals.txt] +dist=true +install=true +install_location=$$(kde_datadir)/khangman/data/animals.txt +type=DATA + +[khangman/data/easy.txt] +dist=true +install=true +install_location=$$(kde_datadir)/khangman/data/easy.txt +type=DATA + +[khangman/data/hard.txt] +dist=true +install=true +install_location=$$(kde_datadir)/khangman/data/hard.txt +type=DATA + +[khangman/data/medium.txt] +dist=true +install=true +install_location=$$(kde_datadir)/khangman/data/medium.txt +type=DATA + +[khangman/cr16-app-khangman.png] +dist=true +install=true +install_location=$$(kde_icondir)/crystalsvg/16x16/apps/khangman.png +type=DATA + +[khangman/cr32-app-khangman.png] +dist=true +install=true +install_location=$$(kde_icondir)/crystalsvg/32x32/apps/khangman.png +type=DATA + +[khangman/info.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[khangman/info.h] +dist=true +install=false +install_location= +type=HEADER + +[khangman/infodlg.ui] +dist=true +install=false +install_location= +type=SOURCE + +[khangman/khangman.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[khangman/khangman.desktop] +dist=true +install=false +install_location= +type=DATA + +[khangman/khangman.h] +dist=true +install=false +install_location= +type=HEADER + +[khangman/khsplash.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[khangman/khsplash.h] +dist=true +install=false +install_location= +type=HEADER + +[khangman/lo16-app-khangman.png] +dist=true +install=true +install_location=$$(kde_icondir)/locolor/16x16/apps/khangman.png +type=DATA + +[khangman/lo32-app-khangman.png] +dist=true +install=true +install_location=$$(kde_icondir)/locolor/32x32/apps/khangman.png +type=DATA + +[khangman/main.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[khangman/mainw.ui] +dist=true +install=false +install_location= +type=SOURCE + +[khangman/pics/Makefile.am] +files=khangman/pics/khm_splash.png,khangman/pics/hg10.jpg,khangman/pics/hg12.jpg,khangman/pics/hg13.jpg,khangman/pics/hg14.jpg,khangman/pics/hg1.jpg,khangman/pics/hg2.jpg,khangman/pics/hg3.jpg,khangman/pics/hg4.jpg,khangman/pics/hg5.jpg,khangman/pics/hg6.jpg,khangman/pics/hg7.jpg,khangman/pics/hg8.jpg,khangman/pics/hg9.jpg,khangman/pics/c_bg.png +sub_dirs= +type=normal + +[khangman/pics/c_bg.png] +dist=true +install=true +install_location=$$(kde_datadir)/khangman/pics/c_bg.png +type=DATA + +[khangman/pics/hg1.jpg] +dist=true +install=true +install_location=$$(kde_datadir)/khangman/pics/hg1.jpg +type=DATA + +[khangman/pics/hg10.jpg] +dist=true +install=true +install_location=$$(kde_datadir)/khangman/pics/hg10.jpg +type=DATA + +[khangman/pics/hg12.jpg] +dist=true +install=true +install_location=$$(kde_datadir)/khangman/pics/hg12.jpg +type=DATA + +[khangman/pics/hg13.jpg] +dist=true +install=true +install_location=$$(kde_datadir)/khangman/pics/hg13.jpg +type=DATA + +[khangman/pics/hg14.jpg] +dist=true +install=true +install_location=$$(kde_datadir)/khangman/pics/hg14.jpg +type=DATA + +[khangman/pics/hg2.jpg] +dist=true +install=true +install_location=$$(kde_datadir)/khangman/pics/hg2.jpg +type=DATA + +[khangman/pics/hg3.jpg] +dist=true +install=true +install_location=$$(kde_datadir)/khangman/pics/hg3.jpg +type=DATA + +[khangman/pics/hg4.jpg] +dist=true +install=true +install_location=$$(kde_datadir)/khangman/pics/hg4.jpg +type=DATA + +[khangman/pics/hg5.jpg] +dist=true +install=true +install_location=$$(kde_datadir)/khangman/pics/hg5.jpg +type=DATA + +[khangman/pics/hg6.jpg] +dist=true +install=true +install_location=$$(kde_datadir)/khangman/pics/hg6.jpg +type=DATA + +[khangman/pics/hg7.jpg] +dist=true +install=true +install_location=$$(kde_datadir)/khangman/pics/hg7.jpg +type=DATA + +[khangman/pics/hg8.jpg] +dist=true +install=true +install_location=$$(kde_datadir)/khangman/pics/hg8.jpg +type=DATA + +[khangman/pics/hg9.jpg] +dist=true +install=true +install_location=$$(kde_datadir)/khangman/pics/hg9.jpg +type=DATA + +[khangman/pics/khm_splash.png] +dist=true +install=true +install_location=$$(kde_datadir)/khangman/pics/khm_splash.png +type=DATA + +[khangman/sounds/Makefile.am] +files=khangman/sounds/new_game.wav,khangman/sounds/splash.wav,khangman/sounds/new_game.ogg,khangman/sounds/splash.ogg +sub_dirs= +type=normal + +[khangman/sounds/new_game.ogg] +dist=true +install=true +install_location=$$(kde_datadir)/khangman/sounds/new_game.ogg +type=DATA + +[khangman/sounds/new_game.wav] +dist=true +install=true +install_location=$$(kde_datadir)/khangman/sounds/new_game.wav +type=DATA + +[khangman/sounds/splash.ogg] +dist=true +install=true +install_location=$$(kde_datadir)/khangman/sounds/splash.ogg +type=DATA + +[khangman/sounds/splash.wav] +dist=true +install=true +install_location=$$(kde_datadir)/khangman/sounds/splash.wav +type=DATA diff --git a/khangman/khangman.lsm b/khangman/khangman.lsm new file mode 100644 index 00000000..e4587a4e --- /dev/null +++ b/khangman/khangman.lsm @@ -0,0 +1,14 @@ +Begin3 +Title: KHangMan +Version: 0.8 +Entered-date: +Description: +Keywords: +Author: Anne-Marie Mahfouf <a-m.mahfouf@lineone.net> +Maintained-by: Whitehawk Stormchaser <zerokode@gmx.net> +Primary-site: +Home-page: http://edu.kde.org/khangman/ +Original-site: +Platforms: Linux and other Unices +Copying-policy: GNU Public License +End diff --git a/khangman/khangman/Makefile.am b/khangman/khangman/Makefile.am new file mode 100644 index 00000000..74934f4f --- /dev/null +++ b/khangman/khangman/Makefile.am @@ -0,0 +1,31 @@ +####### kdevelop will overwrite this part!!! (begin)########## +bin_PROGRAMS = khangman +khangman_SOURCES = khangman.cpp main.cpp khangmanview.cpp prefs.kcfgc khnewstuff.cpp normal.ui advanced.ui timerdlg.ui timer.cpp fontchecker.cpp +khangman_LDADD = $(LIB_KDEUI) $(LIB_KIO) $(top_builddir)/libkdeedu/kdeeducore/libkdeeducore.la -lknewstuff + +SUBDIRS = data pics sounds icons fonts + +EXTRA_DIST = main.cpp timer.cpp khangman.cpp khangman.h khangman.desktop khangmanview.h version.h khnewstuff.h timer.h + +xdg_apps_DATA = khangman.desktop +kde_kcfg_DATA = khangman.kcfg +kde_conf_DATA = khangmanrc + +# set the include path for X, qt and KDE +INCLUDES= -I$(top_srcdir)/libkdeedu/kdeeducore $(all_includes) + +METASOURCES = AUTO + +# the library search path. +khangman_LDFLAGS = $(all_libraries) $(KDE_RPATH) + +rc_DATA = khangmanui.rc +rcdir = $(kde_datadir)/khangman + +messages: rc.cpp + $(EXTRACTRC) *.ui *.rc > rc.cpp + LIST=`find . -name \*.h -o -name \*.hh -o -name \*.H -o -name \*.hxx -o -name \*.hpp -o -name \*.cpp -o -name \*.cc -o -name \*.cxx -o -name \*.ecpp -o -name \*.C`; \ + if test -n "$$LIST"; then \ + $(XGETTEXT) data.i18n $$LIST -o $(podir)/khangman.pot; \ + fi + diff --git a/khangman/khangman/advanced.ui b/khangman/khangman/advanced.ui new file mode 100644 index 00000000..02845c1a --- /dev/null +++ b/khangman/khangman/advanced.ui @@ -0,0 +1,95 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>advanced</class> +<widget class="QWidget"> + <property name="name"> + <cstring>advanced</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>225</width> + <height>134</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="0" column="0"> + <property name="name"> + <cstring>layout2</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox5</cstring> + </property> + <property name="title"> + <string>When Available</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>kcfg_Hint</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>&Show hints</string> + </property> + <property name="toolTip" stdset="0"> + <string>If you check it, a hint will be displayed by right-clicking on the game window.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Some languages have hints to help you guess the word more easily. If this is <b>disabled</b>, there is no such option for your current language data file. +If this is <b>enabled</b>, then hints are available and you can get them by checking this box. You will then see the hint for the word you are trying to guess by right-clicking somewhere on the KHangMan window, the hint will then be displayed for 4 seconds in a tooltip.</string> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox6</cstring> + </property> + <property name="title"> + <string>Spanish, Portuguese, Catalan</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>kcfg_AccentedLetters</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Type accented &letters</string> + </property> + <property name="toolTip" stdset="0"> + <string>If this is checked, you must type accented letters yourself (i.e. they are differentiated from the corresponding unaccented letter).</string> + </property> + <property name="whatsThis" stdset="0"> + <string>If this is <b>disabled</b>, then the selected language does not support it. If this is <b>enabled</b> and if you check it, then you should type accented letters on their own. If it is not checked, accented letters will be displayed with normal letters.<br> +Default is that accented letters will be shown when the corresponding unaccented letter is guessed.<br> +For example, in Catalan, if this is unchecked and you type "o", the o and ò will be displayed in the word <b>xenofòbia</b>. If this option is checked, when you type "o", only "o" will be displayed and you will then have to type "ò" for this letter to be displayed.</string> + </property> + </widget> + </grid> + </widget> + </vbox> + </widget> + </grid> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/khangman/khangman/data.i18n b/khangman/khangman/data.i18n new file mode 100644 index 00000000..26270d4f --- /dev/null +++ b/khangman/khangman/data.i18n @@ -0,0 +1,7 @@ +i18n("NOTE_TO_THE_TRANSLATORS", + "The translators have the opportunity to translate the\n" + "words in the game.\n" + "See the file README.languages in khangman's source directory\n" + "for more information on how to do that.\n" + "(translate this message as \"DONE\" when you have translated\n" + "the words; otherwise leave it untranslated as a reminder)"); diff --git a/khangman/khangman/data/Makefile.am b/khangman/khangman/data/Makefile.am new file mode 100644 index 00000000..54cb7de5 --- /dev/null +++ b/khangman/khangman/data/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = $(AUTODIRS) diff --git a/khangman/khangman/data/en/Makefile.am b/khangman/khangman/data/en/Makefile.am new file mode 100644 index 00000000..effd0570 --- /dev/null +++ b/khangman/khangman/data/en/Makefile.am @@ -0,0 +1,3 @@ +txt_DATA = easy.kvtml animals.kvtml hard.kvtml medium.kvtml +txtdir = $(kde_datadir)/khangman/data/en +EXTRA_DIST = $(txt_DATA) diff --git a/khangman/khangman/data/en/animals.kvtml b/khangman/khangman/data/en/animals.kvtml new file mode 100644 index 00000000..3ebe600f --- /dev/null +++ b/khangman/khangman/data/en/animals.kvtml @@ -0,0 +1,180 @@ +<?xml version="1.0"?> +<!DOCTYPE kvtml SYSTEM "kvoctrain.dtd"> +<kvtml encoding="UTF-8"> + <e> + <o>kitten</o> + <t>the young of a cat, ferret, etc.</t> + </e> + <e> + <o>bear</o> + <t>large heavy animal with thick fur</t> + </e> + <e> + <o>dolphin</o> + <t>sea mammal</t> + </e> + <e> + <o>zebra</o> + <t>African animal with black and white stripes</t> + </e> + <e> + <o>kangaroo</o> + <t>Australian jumping animal</t> + </e> + <e> + <o>whale</o> + <t>very large sea mammal</t> + </e> + <e> + <o>horse</o> + <t>four-legged animal used for riding</t> + </e> + <e> + <o>monkey</o> + <t>animal of a group closely related to man</t> + </e> + <e> + <o>woodpecker</o> + <t>bird that clings to tree trunks</t> + </e> + <e> + <o>kingfisher</o> + <t>small bird with bright bluish plumage</t> + </e> + <e> + <o>snake</o> + <t>reptile with no legs</t> + </e> + <e> + <o>giraffe</o> + <t>long-necked African animal</t> + </e> + <e> + <o>elephant</o> + <t>largest living land animal with a trunk</t> + </e> + <e> + <o>mouse</o> + <t>small rodent with a long thin tail</t> + </e> + <e> + <o>worm</o> + <t>animal with no bachbone or limbs</t> + </e> + <e> + <o>dragonfly</o> + <t>large insect with transparent wings</t> + </e> + <e> + <o>penguin</o> + <t>sea bird of the Antarctic regions</t> + </e> + <e> + <o>rabbit</o> + <t>burrowing animal with long ears</t> + </e> + <e> + <o>hamster</o> + <t>small mouselike rodent with cheek-pouches</t> + </e> + <e> + <o>piglet</o> + <t>young pig</t> + </e> + <e> + <o>wolf</o> + <t>fierce wild animal of the dog family</t> + </e> + <e> + <o>lion</o> + <t>large powerful animal of the cat family</t> + </e> + <e> + <o>tiger</o> + <t>large Asian animal of the cat family</t> + </e> + <e> + <o>octopus</o> + <t>sea animal with eight long tentacles</t> + </e> + <e> + <o>rhinoceros</o> + <t>large thick-skinned animal of Africa</t> + </e> + <e> + <o>hedgehog</o> + <t>small insect-eating animal with a back covered in stiff spines</t> + </e> + <e> + <o>reindeer</o> + <t>deer with large antlers</t> + </e> + <e> + <o>squirrel</o> + <t>small tree-climbing animal with a bushy tail</t> + </e> + <e> + <o>tortoise</o> + <t>a slow-moving four-footed reptile</t> + </e> + <e> + <o>hippopotamus</o> + <t>large African river animal</t> + </e> + <e> + <o>dinosaur</o> + <t>extinct reptile</t> + </e> + <e> + <o>turkey</o> + <t>large bird reared for its flesh</t> + </e> + <e> + <o>eagle</o> + <t>large bird of prey</t> + </e> + <e> + <o>shark</o> + <t>large sea fish with a triangular fin on its back</t> + </e> + <e> + <o>duck</o> + <t>swimming bird</t> + </e> + <e> + <o>fish</o> + <t>live in water</t> + </e> + <e> + <o>parrot</o> + <t>can repeat your words</t> + </e> + <e> + <o>frog</o> + <t>smal green jumping animal</t> + </e> + <e> + <o>snail</o> + <t>has a spiral shell</t> + </e> + <e> + <o>camel</o> + <t>can survive a long time in the desert</t> + </e> + <e> + <o>alligator</o> + <t>reptile of the crocodile family</t> + </e> + <e> + <o>mosquito</o> + <t>kind of gnat, the female of which bites</t> + </e> + <e> + <o>sheep</o> + <t>grass-eating animal with a thick fleecy coat</t> + </e> + <e> + <o>shellfish</o> + <t>water animal that has a shell</t> + </e> +</kvtml>
\ No newline at end of file diff --git a/khangman/khangman/data/en/easy.kvtml b/khangman/khangman/data/en/easy.kvtml new file mode 100644 index 00000000..8e2521aa --- /dev/null +++ b/khangman/khangman/data/en/easy.kvtml @@ -0,0 +1,180 @@ +<?xml version="1.0"?> +<!DOCTYPE kvtml SYSTEM "kvoctrain.dtd"> +<kvtml encoding="UTF-8"> + <e> + <o>playtime</o> + <t>time assigned for children to play</t> + </e> + <e> + <o>furniture</o> + <t>objects in a room</t> + </e> + <e> + <o>garden</o> + <t>a piece of cultivated ground</t> + </e> + <e> + <o>pupil</o> + <t>a person taught by another</t> + </e> + <e> + <o>vegetables</o> + <t>a plant of which some part is used as food</t> + </e> + <e> + <o>apple</o> + <t>a round firm fruit</t> + </e> + <e> + <o>plate</o> + <t>almost flat usually circular ustensil</t> + </e> + <e> + <o>sweet</o> + <t>tasting as if containing sugar</t> + </e> + <e> + <o>kitchen</o> + <t>room in which meals are prepared</t> + </e> + <e> + <o>chocolate</o> + <t>made from cocoa</t> + </e> + <e> + <o>computer</o> + <t>an electronic machine</t> + </e> + <e> + <o>carrot</o> + <t>rabbits like them</t> + </e> + <e> + <o>indication</o> + <t>show you an information</t> + </e> + <e> + <o>banana</o> + <t>a yellow fruit</t> + </e> + <e> + <o>information</o> + <t>knowledge</t> + </e> + <e> + <o>money</o> + <t>coins and banknotes</t> + </e> + <e> + <o>adventure</o> + <t>an exciting experiment</t> + </e> + <e> + <o>driver</o> + <t>person at the wheel</t> + </e> + <e> + <o>policeman</o> + <t>member of a police force</t> + </e> + <e> + <o>pineapple</o> + <t>tropical fruit with tough segmented skin</t> + </e> + <e> + <o>stamp</o> + <t>affix it to an envelop</t> + </e> + <e> + <o>lunch</o> + <t>midday meal</t> + </e> + <e> + <o>limousine</o> + <t>car for celebrities</t> + </e> + <e> + <o>escalator</o> + <t>moving starircase</t> + </e> + <e> + <o>breakfast</o> + <t>first meal of the day</t> + </e> + <e> + <o>flower</o> + <t>part of the plant from which seeds develop</t> + </e> + <e> + <o>education</o> + <t>systematic training</t> + </e> + <e> + <o>table</o> + <t>has a flat top with one or more legs</t> + </e> + <e> + <o>classroom</o> + <t>where students are taught</t> + </e> + <e> + <o>television</o> + <t>receives and displays images</t> + </e> + <e> + <o>mistake</o> + <t>incorrect idea or opinion</t> + </e> + <e> + <o>yesterday</o> + <t>the day before today</t> + </e> + <e> + <o>people</o> + <t>large group of persons</t> + </e> + <e> + <o>children</o> + <t>young humans</t> + </e> + <e> + <o>surprise</o> + <t>something sudden or unexpected</t> + </e> + <e> + <o>jacket</o> + <t>a short coat</t> + </e> + <e> + <o>cheese</o> + <t>solid food made from milk</t> + </e> + <e> + <o>chicken</o> + <t>a young bird, especially of the domestic fowl</t> + </e> + <e> + <o>dinner</o> + <t>evening meal</t> + </e> + <e> + <o>mountain</o> + <t>mass of land that rises to a great height</t> + </e> + <e> + <o>forest</o> + <t>set of trees</t> + </e> + <e> + <o>potato</o> + <t>plant with starchy edible tubers</t> + </e> + <e> + <o>water</o> + <t>H2O</t> + </e> + <e> + <o>river</o> + <t>a large natural stream of water</t> + </e> + </kvtml> diff --git a/khangman/khangman/data/en/hard.kvtml b/khangman/khangman/data/en/hard.kvtml new file mode 100644 index 00000000..19092b8d --- /dev/null +++ b/khangman/khangman/data/en/hard.kvtml @@ -0,0 +1,225 @@ +<?xml version="1.0"?> +<!DOCTYPE kvtml SYSTEM "kvoctrain.dtd"> +<kvtml encoding="UTF-8"> +<e> + <o>knuckle</o> + <t></t> +</e> + +<e> + <o>catalysis</o> + <t></t> +</e> + +<e> + <o>jewelry</o> + <t></t> +</e> + +<e> + <o>lighthouse</o> + <t></t> +</e> + +<e> + <o>enhancement</o> + <t></t> +</e> + +<e> + <o>federalism</o> + <t></t> +</e> + +<e> + <o>dogmatism</o> + <t></t> +</e> + +<e> + <o>dilettantism</o> + <t></t> +</e> + +<e> + <o>chloroform</o> + <t></t> +</e> + +<e> + <o>ethnography</o> + <t></t> +</e> + +<e> + <o>calligraphy</o> + <t></t> +</e> + +<e> + <o>brainstorm</o> + <t></t> +</e> + +<e> + <o>belladonna</o> + <t></t> +</e> + +<e> + <o>boomerang</o> + <t></t> +</e> + +<e> + <o>accordionist</o> + <t></t> +</e> + +<e> + <o>afterthought</o> + <t></t> +</e> + +<e> + <o>ornithology</o> + <t></t> +</e> + +<e> + <o>osteopathy</o> + <t></t> +</e> + +<e> + <o>rattlesnake</o> + <t></t> +</e> + +<e> + <o>exhibition</o> + <t></t> +</e> + +<e> + <o>radiography</o> + <t></t> +</e> + +<e> + <o>surrealism</o> + <t></t> +</e> + +<e> + <o>syllogism</o> + <t></t> +</e> + +<e> + <o>symposium</o> + <t></t> +</e> + +<e> + <o>theologian</o> + <t></t> +</e> + +<e> + <o>taxidermist</o> + <t></t> +</e> + +<e> + <o>trigonometry</o> + <t></t> +</e> + +<e> + <o>translucence</o> + <t></t> +</e> + +<e> + <o>truthfulness</o> + <t></t> +</e> + +<e> + <o>troposphere</o> + <t></t> +</e> + +<e> + <o>uprightness</o> + <t></t> +</e> + +<e> + <o>upholstery</o> + <t></t> +</e> + +<e> + <o>workaholic</o> + <t></t> +</e> + +<e> + <o>withdrawal</o> + <t></t> +</e> + +<e> + <o>zoology</o> + <t></t> +</e> + +<e> + <o>wheelbarrow</o> + <t></t> +</e> + +<e> + <o>xenophobia</o> + <t></t> +</e> + +<e> + <o>yachtsman</o> + <t></t> +</e> + +<e> + <o>astonishment</o> + <t></t> +</e> + +<e> + <o>xylophone</o> + <t></t> +</e> + +<e> + <o>pseudonym</o> + <t></t> +</e> + +<e> + <o>prosperity</o> + <t></t> +</e> + +<e> + <o>psychiatrist</o> + <t></t> +</e> + +<e> + <o>protagonist</o> + <t></t> +</e> + +</kvtml> + diff --git a/khangman/khangman/data/en/medium.kvtml b/khangman/khangman/data/en/medium.kvtml new file mode 100644 index 00000000..8096e5b3 --- /dev/null +++ b/khangman/khangman/data/en/medium.kvtml @@ -0,0 +1,184 @@ +<?xml version="1.0"?> +<!DOCTYPE kvtml SYSTEM "kvoctrain.dtd"> +<kvtml encoding="UTF-8"> + <e> + <o>machine</o> + <t>apparatus for applying mechanical power</t> + </e> + <e> + <o>bedroom</o> + <t>a room for sleeping in</t> + </e> + <e> + <o>magistrate</o> + <t>an official with authority to administer the law</t> + </e> + <e> + <o>gymnasium</o> + <t>a building equipped for gymnastics</t> + </e> + <e> + <o>appointment</o> + <t>an arrangement to meet at a particular time</t> + </e> + <e> + <o>antibiotic</o> + <t>a substance capable of destroying a bacteria</t> + </e> + <e> + <o>delegation</o> + <t>a body of delegates</t> + </e> + <e> + <o>pharmacist</o> + <t>a person who is skilled in pharmacy</t> + </e> + <e> + <o>cheeseburger</o> + <t>a hamburger with cheese</t> + </e> + <e> + <o>assessment</o> + <t>the amount or value is fixed</t> + </e> + <e> + <o>surroundings</o> + <t>the things or conditions around</t> + </e> + <e> + <o>supermarket</o> + <t>a large self-service shop</t> + </e> + <e> + <o>indication</o> + <t>a sign to show the presence of something</t> + </e> + <e> + <o>radiography</o> + <t>the production of X-ray photographs</t> + </e> + <e> + <o>information</o> + <t>facts told or discovered</t> + </e> + <e> + <o>mincemeat</o> + <t>a mixture used in pies</t> + </e> + <e> + <o>signature</o> + <t>a person's name written by himself</t> + </e> + <e> + <o>enthusiasm</o> + <t>a feeling of eager liking for something</t> + </e> + <e> + <o>asparagus</o> + <t>a plant whose young shoots are cooked and eaten as vegetable</t> + </e> + <e> + <o>vocabulary</o> + <t>a list of words with their meanings</t> + </e> + <e> + <o>government</o> + <t>the organization governing a country</t> + </e> + <e> + <o>conservatory</o> + <t>a greenhouse attached to a house</t> + </e> + <e> + <o>bookshelf</o> + <t>a piece of furniture where you put books</t> + </e> + <e> + <o>photograph</o> + <t>a picture formed by the chemical acvtion of light on a sensitive surface</t> + </e> + <e> + <o>intelligence</o> + <t>mental ability</t> + </e> + <e> + <o>lawnmower</o> + <t>a machine for cutting lawns</t> + </e> + <e> + <o>arithmetic</o> + <t>the science of numbers</t> + </e> + <e> + <o>membership</o> + <t>being a member</t> + </e> + <e> + <o>tranquility</o> + <t>calm and undisturbed</t> + </e> + <e> + <o>contribution</o> + <t>given jointly with others</t> + </e> + <e> + <o>apostrophe</o> + <t>a punctuation mark</t> + </e> + <e> + <o>amusement</o> + <t>for entertainments</t> + </e> + <e> + <o>umbrella</o> + <t>protect you from the rain</t> + </e> + <e> + <o>illumination</o> + <t>a decoration with lights</t> + </e> + <e> + <o>millimetre</o> + <t>0.04 inch</t> + </e> + <e> + <o>milligram</o> + <t>one-thousandth of a gram</t> + </e> + <e> + <o>aquarium</o> + <t>a tank in which fish are kept for display</t> + </e> + <e> + <o>miscount</o> + <t>an incorrect count</t> + </e> + <e> + <o>population</o> + <t>the number of people</t> + </e> + <e> + <o>innovation</o> + <t>introduction of a new process</t> + </e> + <e> + <o>innuendo</o> + <t>an unpleasant insinuation</t> + </e> + <e> + <o>strawberry</o> + <t>a red fruit delicious with cream</t> + </e> + <e> + <o>nephew</o> + <t>the son of your brother or sister</t> + </e> + <e> + <o>countryside</o> + <t>rural areas</t> + </e> + <e> + <o>collection</o> + <t>a set</t> + </e> +</kvtml> diff --git a/khangman/khangman/fontchecker.cpp b/khangman/khangman/fontchecker.cpp new file mode 100644 index 00000000..684afaaa --- /dev/null +++ b/khangman/khangman/fontchecker.cpp @@ -0,0 +1,27 @@ +/*************************************************************************** + * Copyright (C) 2005 by Albert Astals Cid <tsdgeos@terra.es> * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +#include <qfont.h> +#include <qfontinfo.h> + +#include <kio/netaccess.h> + +#include "fontchecker.h" + +bool fontChecker::checkInstalled(const QFont &font, const QString &fontPath) +{ + QFontInfo fi(font); + // Works with Steve may need some tweaking to work with other fonts + if (!fi.exactMatch()) + { + bool success = KIO::NetAccess::copy(fontPath, "fonts:/Personal/", 0); + return !success; + } + return true; +} diff --git a/khangman/khangman/fontchecker.h b/khangman/khangman/fontchecker.h new file mode 100644 index 00000000..b8b60b6f --- /dev/null +++ b/khangman/khangman/fontchecker.h @@ -0,0 +1,21 @@ +/*************************************************************************** + * Copyright (C) 2005 by Albert Astals Cid <tsdgeos@terra.es> * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +#ifndef FONTCHECKER_H +#define FONTCHECKER_H + +class QFont; + +class fontChecker +{ + public: + static bool checkInstalled(const QFont &font, const QString &fontPath); +}; + +#endif diff --git a/khangman/khangman/fonts/Domestic_Manners.ttf b/khangman/khangman/fonts/Domestic_Manners.ttf Binary files differnew file mode 100644 index 00000000..31bac14c --- /dev/null +++ b/khangman/khangman/fonts/Domestic_Manners.ttf diff --git a/khangman/khangman/fonts/Dustismo_Roman.ttf b/khangman/khangman/fonts/Dustismo_Roman.ttf Binary files differnew file mode 100644 index 00000000..3a13d893 --- /dev/null +++ b/khangman/khangman/fonts/Dustismo_Roman.ttf diff --git a/khangman/khangman/fonts/Makefile.am b/khangman/khangman/fonts/Makefile.am new file mode 100644 index 00000000..0dbe1624 --- /dev/null +++ b/khangman/khangman/fonts/Makefile.am @@ -0,0 +1,2 @@ +fontsdir = $(kde_datadir)/khangman/fonts +fonts_DATA = Dustismo_Roman.ttf Domestic_Manners.ttf diff --git a/khangman/khangman/fonts/licenseDomesticManners.txt b/khangman/khangman/fonts/licenseDomesticManners.txt new file mode 100644 index 00000000..362f8e0a --- /dev/null +++ b/khangman/khangman/fonts/licenseDomesticManners.txt @@ -0,0 +1,365 @@ +Domestic Manners is Copyright (C) 2003 Dustin Norlander
+Homepage: http://www.cheapskatefonts.com
+email: dustin@dustismo.com
+
+
+ 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.
+
+
+
+-------------------------------------------------------------------------------
+
+
+
+
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ 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
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
+
+
diff --git a/khangman/khangman/fonts/licenseDustimo.txt b/khangman/khangman/fonts/licenseDustimo.txt new file mode 100644 index 00000000..c8b6def2 --- /dev/null +++ b/khangman/khangman/fonts/licenseDustimo.txt @@ -0,0 +1,365 @@ +flatline is Copyright (C) 2002 Dustin Norlander
+Homepage: http://www.cheapskatefonts.com
+email: nutso@cheapskatefonts.com
+
+
+ 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.
+
+
+
+-------------------------------------------------------------------------------
+
+
+
+
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ 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
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
+
+
diff --git a/khangman/khangman/icons/Makefile.am b/khangman/khangman/icons/Makefile.am new file mode 100644 index 00000000..cf9855c9 --- /dev/null +++ b/khangman/khangman/icons/Makefile.am @@ -0,0 +1,3 @@ +KDE_ICON=AUTO + + diff --git a/khangman/khangman/icons/hi128-app-khangman.png b/khangman/khangman/icons/hi128-app-khangman.png Binary files differnew file mode 100644 index 00000000..72ac493d --- /dev/null +++ b/khangman/khangman/icons/hi128-app-khangman.png diff --git a/khangman/khangman/icons/hi16-app-khangman.png b/khangman/khangman/icons/hi16-app-khangman.png Binary files differnew file mode 100644 index 00000000..6abf0f56 --- /dev/null +++ b/khangman/khangman/icons/hi16-app-khangman.png diff --git a/khangman/khangman/icons/hi22-app-khangman.png b/khangman/khangman/icons/hi22-app-khangman.png Binary files differnew file mode 100644 index 00000000..241d9e18 --- /dev/null +++ b/khangman/khangman/icons/hi22-app-khangman.png diff --git a/khangman/khangman/icons/hi32-app-khangman.png b/khangman/khangman/icons/hi32-app-khangman.png Binary files differnew file mode 100644 index 00000000..59aef718 --- /dev/null +++ b/khangman/khangman/icons/hi32-app-khangman.png diff --git a/khangman/khangman/icons/hi48-app-khangman.png b/khangman/khangman/icons/hi48-app-khangman.png Binary files differnew file mode 100644 index 00000000..d48b0901 --- /dev/null +++ b/khangman/khangman/icons/hi48-app-khangman.png diff --git a/khangman/khangman/icons/hi64-app-khangman.png b/khangman/khangman/icons/hi64-app-khangman.png Binary files differnew file mode 100644 index 00000000..520d8969 --- /dev/null +++ b/khangman/khangman/icons/hi64-app-khangman.png diff --git a/khangman/khangman/icons/hisc-app-khangman.svgz b/khangman/khangman/icons/hisc-app-khangman.svgz Binary files differnew file mode 100644 index 00000000..41934fcb --- /dev/null +++ b/khangman/khangman/icons/hisc-app-khangman.svgz diff --git a/khangman/khangman/khangman.cpp b/khangman/khangman/khangman.cpp new file mode 100644 index 00000000..05396587 --- /dev/null +++ b/khangman/khangman/khangman.cpp @@ -0,0 +1,547 @@ +/*************************************************************************** + * Copyright (C) 2001-2005 Anne-Marie Mahfouf <annma@kde.org> * + * annemarie.mahfouf@free.fr * + * * + * 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., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + + +#include "khangman.h" +#include "prefs.h" +#include "advanced.h" +#include "normal.h" +#include "timer.h" +#include "khnewstuff.h" + +#include <qbitmap.h> +#include <qcheckbox.h> +#include <qpainter.h> +#include <qdir.h> + +#include <kapplication.h> +#include <kactionclasses.h> +#include <kconfigdialog.h> +#include <kdebug.h> +#include <klineedit.h> +#include <klocale.h> +#include <kmainwindow.h> +#include <kmessagebox.h> +#include <kstandarddirs.h> +#include <kstatusbar.h> +#include <ktoolbarbutton.h> + + +KHangMan::KHangMan() + : KMainWindow( 0, "KHangMan" ), + m_view(new KHangManView(this)) +{ + m_newStuff = 0; + + setCentralWidget(m_view); + setLanguages(); + setupStatusbar(); + setupActions(); + + // Toolbar for special characters + secondToolbar = toolBar("secondToolBar"); + secondToolbar->setBarPos(KToolBar::Bottom); + loadSettings(); + setAccent(); + loadLangToolBar(); + loadLevels(); + + // Start a new game. + m_view->slotNewGame(); +} + +KHangMan::~KHangMan() +{ +} + +void KHangMan::setupActions() +{ + // Game->New + KAction *action = new KAction(i18n("&New"), "filenew", CTRL+Key_N , m_view, SLOT(slotNewGame()), actionCollection(), "file_new"); + action->setToolTip(i18n( "Play with a new word" )); + + // Game->Get Words in New Language + new KAction( i18n("&Get Words in New Language..."), "knewstuff", CTRL+Key_G, this, SLOT( slotDownloadNewStuff() ), actionCollection(), "downloadnewstuff" ); + + KStdAction::quit(this, SLOT(slotQuit()), actionCollection()); + + m_levelAction = new KSelectAction(i18n("Le&vel"), 0, actionCollection(), "combo_level"); + m_levelAction->setToolTip(i18n( "Choose the level" )); + m_levelAction->setWhatsThis(i18n( "Choose the level of difficulty" )); + connect(m_levelAction, SIGNAL(activated(int)), this, SLOT(slotChangeLevel(int))); + + // Action for selecting language. + m_languageAction = new KSelectAction(i18n("&Language"), 0, actionCollection(), "languages"); + m_languageAction->setItems(m_languageNames); + m_languageAction->setCurrentItem(m_languages.findIndex(Prefs::selectedLanguage())); + connect(m_languageAction, SIGNAL(activated(int)), this, SLOT(slotChangeLanguage(int))); + + KStdAction::preferences(this, SLOT(optionsPreferences()), actionCollection()); + + // Mode. Currently hard coded into Sea and Desert themes. + QStringList modes; + m_modeAction = new KSelectAction(i18n("L&ook"), 0, this, SLOT(slotChangeMode()), actionCollection(), "combo_mode"); + modes += i18n("&Sea Theme"); + modes += i18n("&Desert Theme"); + m_modeAction->setItems(modes); + m_modeAction->setCurrentItem(Prefs::mode()); + m_modeAction->setToolTip(i18n( "Choose the look and feel" )); + m_modeAction->setWhatsThis(i18n( "Choose the look and feel" )); + + setupGUI(); +} + +// Set up the status bar with 4 different fields. +void KHangMan::setupStatusbar() +{ + // set up the status bar + statusBar( )->insertItem(" ",IDS_LEVEL, 0); + statusBar( )->insertItem(" ",IDS_LANG, 0); + statusBar( )->insertItem(" ",IDS_ACCENTS, 0); + statusBar( )->insertItem(" ",IDS_HINT, 0); +} + + +// FIXME: Make this into a slot? +void KHangMan::changeStatusbar(const QString& text, int id) +{ + statusBar()->changeItem(text, id); +} + + +// ---------------------------------------------------------------- +// Slots + + +void KHangMan::slotQuit() +{ + Prefs::setShowCharToolbar( secondToolbar->isVisible()); + Prefs::writeConfig(); + kapp->quit(); +} + + +void KHangMan::slotChangeLevel(int index) +{ + levelString = levels[index]; + changeStatusbar(levelString, IDS_LEVEL); +#if 0 + if (m_view->levelFile == "world_capitals.kvtml" + || m_view->levelFile == "departements.kvtml") + changeStatusbar(i18n("First letter upper case"), IDS_ACCENTS); + else + changeStatusbar("", IDS_ACCENTS); +#endif + Prefs::setCurrentLevel(index); + levelString.replace(0, 1, levelString.left(1).lower()); + Prefs::setLevelFile(levelString +".kvtml"); + Prefs::writeConfig(); + m_view->slotNewGame(); +} + +void KHangMan::slotChangeLanguage(int index) +{ + //good when no in English + kdDebug() << "Change to " << m_languages[m_languageNames.findIndex(m_languageNames[index])] << endl; + Prefs::setSelectedLanguage(m_languages[m_languageNames.findIndex(m_languageNames[index])]); + Prefs::writeConfig(); + loadLevels(); + loadLangToolBar(); + changeStatusbar(m_languageNames[m_languages.findIndex(Prefs::selectedLanguage())], IDS_LANG); + setAccent(); + setMessages(); + m_view->slotNewGame(); +} + +void KHangMan::slotChangeMode() +{ + if (m_modeAction->currentItem() == 0) + Prefs::setMode(Prefs::EnumMode::sea); + else + Prefs::setMode(Prefs::EnumMode::desert); + + Prefs::writeConfig(); + m_view->setTheme(); +} + + +// ---------------------------------------------------------------- + + +void KHangMan::setLanguages() +{ + m_languages.clear(); + m_languageNames.clear(); + m_sortedNames.clear(); + //the program scans in khangman/data/ to see what languages data is found + QStringList mdirs = KGlobal::dirs()->findDirs("data", "khangman/data/"); + if (mdirs.isEmpty()) return; + for (QStringList::Iterator it =mdirs.begin(); it !=mdirs.end(); ++it ) { + QDir dir(*it); + m_languages += dir.entryList(QDir::Dirs, QDir::Name); + m_languages.remove(m_languages.find(".")); + m_languages.remove(m_languages.find("..")); + } + m_languages.sort(); + + kdDebug() << "languages :" << m_languages << endl; + + if (m_languages.isEmpty()) + return; + //find duplicated entries in KDEDIR and KDEHOME + + QStringList temp_languages; + for (uint i=0; i<m_languages.count(); i++) { + if (m_languages.contains(m_languages[i])>1) { + temp_languages.append(m_languages[i]); + m_languages.remove(m_languages[i]); + } + } + + for (uint i=0; i<temp_languages.count(); i++) { + // Append 1 of the 2 instances found. + if (i%2==0) + m_languages.append(temp_languages[i]); + } + temp_languages.clear(); + + // Write the present languages in config so they cannot be downloaded. + KConfig *config=kapp->config(); + config->setGroup("KNewStuffStatus"); + for (uint i=0; i<m_languages.count(); i++) { + QString tmp = m_languages[i]; + if (!config->readEntry(tmp)) + config->writeEntry(tmp, QDate::currentDate().toString(Qt::ISODate)); + } + + // We look in $KDEDIR/share/locale/all_languages from + // kdelibs/kdecore/all_languages to find the name of the country + // corresponding to the code and the language the user set. + KConfig entry(locate("locale", "all_languages")); + const QStringList::ConstIterator itEnd = m_languages.end(); + for (QStringList::Iterator it = m_languages.begin(); + it != m_languages.end(); ++it) { + entry.setGroup(*it); + if (*it == "sr") + m_languageNames.append(entry.readEntry("Name")+" ("+i18n("Cyrillic")+")"); + else if (*it == "sr@Latn") { + entry.setGroup("sr"); + m_languageNames.append(entry.readEntry("Name") + + " ("+i18n("Latin")+")"); + } + else + m_languageNames.append(entry.readEntry("Name")); + } + + // Never sort m_languageNames as it's m_languages translated + m_sortedNames = m_languageNames; +} + + +void KHangMan::loadSettings() +{ + // Language //TODO is selectedLanguage necessary??? only used here + selectedLanguage = Prefs::selectedLanguage(); + if (m_languages.grep(selectedLanguage).isEmpty()) + selectedLanguage = "en"; + changeStatusbar(m_languageNames[m_languages.findIndex(Prefs::selectedLanguage())], IDS_LANG); + // Show/hide characters toolbar + if (Prefs::showCharToolbar()) + secondToolbar->show(); + else + secondToolbar->hide(); + setMessages(); +} + +void KHangMan::setLevel() +{ + currentLevel = Prefs::currentLevel(); + if (currentLevel > (uint) levels.count()) + currentLevel= 0; + levelString = levels[currentLevel]; + levelString.replace(0, 1, levelString.left(1).lower()); + levelString = levels[currentLevel].replace(0, 1, levels[currentLevel].left(1).lower()) ; +} + +void KHangMan::loadLevels() +{ + //build the Level combobox menu dynamically depending of the data for each language + levels.clear();//initialize QStringList levels + KStandardDirs *dirs = KGlobal::dirs(); + QStringList mfiles = dirs->findAllResources("data","khangman/data/" + Prefs::selectedLanguage() + "/*.kvtml"); + bool levelBool = false; + if (!mfiles.isEmpty()) + { + for (QStringList::Iterator it = mfiles.begin(); it != mfiles.end(); ++it ) { + QFile f( *it); + //find the last / in the file name + int location = f.name().findRev("/"); + //strip the string to keep only the filename and not the path + QString mString = f.name().right(f.name().length()-location-1); + if (mString == Prefs::levelFile()) + levelBool = true; + mString = mString.left(mString.length()-6); + //Put the first letter in Upper case + mString = mString.replace(0, 1, mString.left(1).upper()); + levels+=mString; + } + //TODO else tell no files had been found + } + + // Sort easy, medium, hard at bottom, with the other categories at the top + levels.sort(); + QString replace[3] = { "Easy", "Medium", "Hard" }; + for ( int i = 0; i < 3; ++i ) + { + if ( levels.findIndex( replace[i] ) > -1 ) + { + levels.remove( replace[i] ); + levels.append( replace[i] ); + } + } + + //find duplicated entries in KDEDIR and KDEHOME + QString last; + for ( QStringList::Iterator it = levels.begin(); it != levels.end(); ) + { + QStringList::Iterator it2 = it++; + if (*it2 == last) + { + // remove duplicate + levels.remove(it2); + } + else + { + last = *it2; + } + } + + if (currentLevel>levels.count()) + currentLevel = levels.count(); + + if (levelBool == false) + { + Prefs::setLevelFile(levels[0].replace(0, 1, levels[0].left(1).lower())+".kvtml"); + Prefs::setCurrentLevel(0); + currentLevel =0; + Prefs::writeConfig(); + } + QStringList translatedLevels; + for (QStringList::Iterator it = levels.begin(); it != levels.end(); ++it ) + translatedLevels+=i18n((*it).utf8()); + m_levelAction->setItems(translatedLevels); + m_levelAction->setCurrentItem(Prefs::currentLevel()); + + setLevel(); + QString m_lstring = translatedLevels[currentLevel].utf8(); + m_lstring.replace(0, 1, m_lstring.left(1).upper()); + changeStatusbar(m_lstring, IDS_LEVEL); +} + + +void KHangMan::optionsPreferences() +{ + if ( KConfigDialog::showDialog( "settings" ) ) { + mAdvanced->kcfg_Hint->setEnabled(m_view->hintExists()); + mAdvanced->kcfg_AccentedLetters->setEnabled(m_view->accentedLetters()); + return; + } + + //KConfigDialog didn't find an instance of this dialog, so lets create it : + KConfigDialog* dialog = new KConfigDialog( this, "settings", Prefs::self() ); + // Add the Normal Settings page + normal *mNormal = new normal( 0, "Normal Settings" ); + dialog->addPage(mNormal, i18n("General"), "colorize"); + + // Add the Advanced Settings page + mAdvanced = new advanced( 0, "Advanced" ); + mAdvanced->kcfg_Hint->setEnabled( m_view->hintExists() ); + mAdvanced->kcfg_AccentedLetters->setEnabled(m_view->accentedLetters()); + + dialog->addPage(mAdvanced, i18n("Languages"), "kvoctrain"); + + Timer *m_timer = new Timer(); + dialog->addPage(m_timer, i18n("Timers"), "clock"); + + connect(dialog, SIGNAL(settingsChanged()), this, SLOT(updateSettings())); + + dialog->show(); +} + +void KHangMan::updateSettings() +{ + //after upperCase() changed, reload new game + setAccent(); + setMessages(); + m_view->slotNewGame(); +} + +void KHangMan::slotDownloadNewStuff() +{ + if ( !m_newStuff ) + m_newStuff = new KHNewStuff( m_view ); + m_newStuff->download(); +} + +void KHangMan::loadLangToolBar() +{ + if (Prefs::selectedLanguage() == "en" + || Prefs::selectedLanguage() == "it" + || Prefs::selectedLanguage() == "nl" + || Prefs::selectedLanguage() == "ru" + || Prefs::selectedLanguage() == "bg") + m_noSpecialChars = true; + else + m_noSpecialChars = false; + + if (secondToolbar->isVisible() && !m_noSpecialChars) { + Prefs::setShowCharToolbar(true); + Prefs::writeConfig(); + } + + secondToolbar->clear(); + + m_allData.clear(); + if (!m_noSpecialChars) { + QString myString=QString("khangman/%1.txt").arg(Prefs::selectedLanguage()); + QFile myFile; + myFile.setName(locate("data", myString)); + + // Let's look in local KDEHOME dir then + if (!myFile.exists()) { + QString myString=QString("khangman/data/%1/%1.txt") + .arg(Prefs::selectedLanguage()) + .arg(Prefs::selectedLanguage()); + myFile.setName(locate("data",myString)); + kdDebug() << myString << endl; + } + + if (!myFile.exists()) { + QString mString=i18n("File $KDEDIR/share/apps/khangman/%1.txt not found;\n" + "check your installation.").arg(Prefs::selectedLanguage()); + KMessageBox::sorry( this, mString, + i18n("Error") ); + kapp->quit(); + } + update(); + + // We open the file and store info into the stream... + QFile openFileStream(myFile.name()); + openFileStream.open(IO_ReadOnly); + QTextStream readFileStr(&openFileStream); + readFileStr.setEncoding(QTextStream::UnicodeUTF8); + + // m_allData contains all the words from the file + // FIXME: Better name + m_allData = QStringList::split("\n", readFileStr.read(), true); + openFileStream.close(); + + for (int i=0; i<(int) m_allData.count(); i++) + secondToolbar->insertButton (charIcon(m_allData[i].at(0)), i, + SIGNAL( clicked() ), this, + SLOT( slotPasteChar()), true, + i18n("Inserts the character %1").arg(m_allData[i]), i+1 ); + } + + if (Prefs::showCharToolbar()) + secondToolbar->show(); + else + secondToolbar->hide(); + + // Hide toolbar for special characters if the language doesn't have them. + if (m_noSpecialChars) + secondToolbar->hide(); +} + + +void KHangMan::slotPasteChar() +{ + KToolBarButton *charBut = (KToolBarButton* ) sender(); + m_view->enterLetter(m_allData[charBut->id()]); +} + +QString KHangMan::charIcon(const QChar & c) +{ + ///Create a name and path for the icon + QString s = locateLocal("icon", "char" + QString::number(c.unicode()) + ".png"); + + QRect r(4, 4, 120, 120); + + ///A font to draw the character with + QFont font; + font.setFamily( "Sans Serif" ); + font.setPointSize(96); + font.setWeight(QFont::Normal); + + ///Create the pixmap + QPixmap pm(128, 128); + pm.fill(Qt::white); + QPainter p(&pm); + p.setFont(font); + p.setPen(Qt::black); + p.drawText(r, Qt::AlignCenter, (QString) c); + + ///Create transparency mask + QBitmap bm(128, 128); + bm.fill(Qt::color0); + QPainter b(&bm); + b.setFont(font); + b.setPen(Qt::color1); + b.drawText(r, Qt::AlignCenter, (QString) c); + + ///Mask the pixmap + pm.setMask(bm); + + ///Save the icon to disk + pm.save(s, "PNG"); + + return s; +} + +void KHangMan::setAccent() +{ + if (Prefs::selectedLanguage()=="es" + || Prefs::selectedLanguage() == "ca" + || Prefs::selectedLanguage() == "pt" + || Prefs::selectedLanguage() == "pt_BR") + m_view->setAccentedLetters( true ); + else + m_view->setAccentedLetters( false ); +} + + +void KHangMan::setMessages() +{ + // Tell the user about if there is a hint. + if (Prefs::hint() && m_view->hintExists()) + changeStatusbar(i18n("Hint on right-click"), IDS_HINT); + else if (m_view->hintExists() && !Prefs::hint() ) + changeStatusbar(i18n("Hint available"), IDS_HINT); + else + changeStatusbar("", IDS_HINT); + + // Tell the user about accented characters + if (m_view->accentedLetters() && Prefs::accentedLetters()) + changeStatusbar(i18n("Type accented letters"), IDS_ACCENTS); + else + changeStatusbar("", IDS_ACCENTS); +} + +#include "khangman.moc" diff --git a/khangman/khangman/khangman.desktop b/khangman/khangman/khangman.desktop new file mode 100644 index 00000000..42da2354 --- /dev/null +++ b/khangman/khangman/khangman.desktop @@ -0,0 +1,133 @@ +[Desktop Entry] +Type=Application +Exec=khangman -caption "%c" %i %m +Icon=khangman +DocPath=khangman/index.html +GenericName=Hangman Game +GenericName[af]=Hangman Speletjie +GenericName[ar]=لعبة الشنق +GenericName[be]=Гульня "Віселіца" +GenericName[bg]=Игра на бесеница +GenericName[bn]=হ্যাংম্যান খেলা +GenericName[br]=C'hoari an hini krouket +GenericName[bs]=Igra vješala +GenericName[ca]=Joc del penjat +GenericName[cs]=Hra Hangman +GenericName[csb]=Wisélc +GenericName[cy]=Gêm Crogwr +GenericName[da]=Hangman-spil +GenericName[de]=Buchstabierspiel +GenericName[el]=Παιχνίδι κρεμάλας +GenericName[eo]=Pendigula ludo +GenericName[es]=Juego del ahorcado +GenericName[et]=Poomismäng +GenericName[eu]=Urkatuaren jokoa +GenericName[fa]=بازی جلاد +GenericName[fi]=Hirsipuupeli +GenericName[fr]=Jeu du pendu +GenericName[ga]=Crochadóir +GenericName[gl]=O Xogo do Aforcado +GenericName[he]=משחק Hangman +GenericName[hi]=हैंगमेन खेल +GenericName[hr]=Igra vješala +GenericName[hu]=Akasztófás játék +GenericName[is]=Hengimann leikur +GenericName[it]=Gioco dell'impiccato +GenericName[ja]=ハングマンゲーム +GenericName[ka]=თამაში "ჩამოხრჩობანა" +GenericName[km]=ល្បែងព្យួរក +GenericName[lt]=Budelio žaidimas +GenericName[lv]=Karātavu Spēle +GenericName[mk]=Бесилка +GenericName[mn]=HangMan-ий Тоглоом +GenericName[ms]=Permainan Gantung suka-suka +GenericName[nb]=Hengtmann-spillet +GenericName[nds]=Galgenmanntje-Speel +GenericName[ne]=ह्याङम्यान खेल +GenericName[nl]=Galgje +GenericName[nn]=Hengtmann-spel +GenericName[nso]=Papadi ya Hangman +GenericName[pl]=Gra Hangman +GenericName[pt]=Jogo da Forca +GenericName[pt_BR]=Jogo da forca +GenericName[ru]=Игра «Виселица» +GenericName[se]=Hangman speallu +GenericName[sk]=Hra Hangman +GenericName[sl]=Igra vislic +GenericName[sr]=Игра вешала +GenericName[sr@Latn]=Igra vešala +GenericName[sv]=Hänga gubben-spel +GenericName[ta]= ஹாங்க்மேன் விளையாட்டு +GenericName[tg]=Бозии Чӯбаи Дор +GenericName[tr]=Adam Asmaca Oyunu +GenericName[uk]=Гра Hangman +GenericName[ven]=Mutambo wau nembeledza +GenericName[vi]=Trò chơi Hangman +GenericName[xh]=Umdlalo Wendoda ejingayo +GenericName[zh_CN]=吊颈人游戏 +GenericName[zh_TW]=劊子手(hangman)遊戲 +GenericName[zu]=Umdlalo WeHangman +Comment=KDE Hangman Game +Comment[be]=Гульня "Віселіца" для KDE +Comment[bg]=Игра на бесеница +Comment[bn]=কে.ডি.ই. উপস্থাপিত হ্যাংম্যান খেলা +Comment[br]=C'hoari an hini krouket evit KDE +Comment[bs]=KDE igra vješala +Comment[ca]=Joc del penjat per a KDE +Comment[cs]=Hra 'šibenice' pro KDE +Comment[csb]=Gra w wisélca +Comment[da]=Hangman-spil for KDE +Comment[de]=Ein Buchstabierspiel für KDE +Comment[el]=Παιχνίδι κρεμάλας του KDE +Comment[eo]=KDE pendigula ludo +Comment[es]=Juego del ahorcado de KDE +Comment[et]=KDE poomismäng +Comment[eu]=Urkatuaren jokoa +Comment[fa]=بازی جلاد KDE +Comment[fi]=Hirsipuupeli +Comment[fr]=Jeu du pendu de KDE +Comment[ga]=Crochadóir KDE +Comment[gl]=Xogo do Aforcado para KDE +Comment[he]=משחק איש תלוי של KDE +Comment[hr]=KDE igra vješala +Comment[hu]=KDE-s akasztófás játék +Comment[is]=KDE Hengimann +Comment[it]=Gioco dell'impiccato per KDE +Comment[ja]=ハングマンゲーム +Comment[ka]=KDE თამაში "ჩამოხრჩობანა" +Comment[km]=ល្បែងព្យួរករបស់ KDE +Comment[lt]=KDE pakaruoklio žaidimas +Comment[ms]=Permainan Hangman KDE +Comment[nb]=Hengtmann-spillet i KDE-utgave +Comment[nds]=Galgenmanntje-Speel för KDE +Comment[ne]=KDE ह्याङम्यान खेल +Comment[nl]=Het spel Galgje voor KDE +Comment[nn]=Eit hengtmann-spel for KDE +Comment[pl]=Gra w wisielca dla KDE +Comment[pt]=Jogo da Forca do KDE +Comment[pt_BR]=Jogo da forca do KDE +Comment[ru]=Игра «Виселица» +Comment[sk]=KDE hra Hangman +Comment[sl]=Igra vislic +Comment[sr]=KDE-ова игра вешала +Comment[sr@Latn]=KDE-ova igra vešala +Comment[sv]=Hänga gubben-spel för KDE +Comment[tr]=Adam Asmaca Oyunu +Comment[uk]=Гра Hangman +Comment[vi]=Trò chơi Hangman KDE +Comment[zh_CN]=KDE 吊颈人游戏 +Comment[zh_TW]=KDE 劊子手(hangman)遊戲 +Terminal=false +Name=KHangMan +Name[af]=K-hangman +Name[ar]=الشنق ك +Name[bn]=কে-হ্যাংম্যান +Name[cy]=Krogwr +Name[hi]=के-हैंगमेन +Name[hr]=KVješala +Name[ne]=केडीई ह्याङम्यान +Name[sv]=Khangman +Name[ta]=கேஹாங்க்மேன் +Name[tr]=Adam Asmaca +Name[ven]=Munembeledzi wa K +Categories=Qt;KDE;Education;Languages; diff --git a/khangman/khangman/khangman.h b/khangman/khangman/khangman.h new file mode 100644 index 00000000..b7832db5 --- /dev/null +++ b/khangman/khangman/khangman.h @@ -0,0 +1,166 @@ +/*************************************************************************** + * Copyright (C) 2001-2005 Anne-Marie Mahfouf <annma@kde.org> * + * annemarie.mahfouf@free.fr * + * * + * 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., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + + +#ifndef _KHANGMAN_H_ +#define _KHANGMAN_H_ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <kmainwindow.h> + +#include "khangmanview.h" + +class KSelectAction; +class KToggleAction; +class KHNewStuff; +class advanced; + + +// Id tags for the status bar. +const int IDS_LEVEL = 100; +const int IDS_LANG = 101; +const int IDS_ACCENTS = 102; +const int IDS_HINT = 103; + + +/** + * @short Application Main Window + * @author Anne-Marie Mahfouf <annemarie.mahfouf@free.fr> + * @version 0.1 + */ +class KHangMan : public KMainWindow +{ + Q_OBJECT +public: + /** + * Default Constructor + */ + KHangMan(); + + /** + * Default Destructor + */ + virtual ~KHangMan(); + + /** + Update the text in the Statusbar + @param text the text that will be written in the statusbar + @param id the label in which the text will be written + */ + void changeStatusbar(const QString& text, int id); + + ///Action that sets up the Language menu + KSelectAction *m_languageAction; + + ///Method to set the current language into the Statusbar and to pass it to KHangManView + void setLanguages(); + + ///Translated names of languages + QStringList m_languageNames; + ///Language codes of available languages + QStringList m_languages; + + ///Display the correct messages in the statusbar + void setMessages(); + + private: + ///Create the actions + void setupActions(); + ///Create the Statusbar + void setupStatusbar(); + + ///Selected language + QString selectedLanguage; + ///Translated and sorted names of languages + QStringList m_sortedNames; + ///the different data files in each language dir + QStringList levels; + + ///Current level ID + uint currentLevel; + ///hold the current level + QString levelString; + + ///At start, restore settings from config file and apply them + void loadSettings(); + ///Set the level and make sure it exists + void setLevel(); + ///Scan the files in the selected language dir to set the levels + void loadLevels(); + ///Set a bool variable to true if the language allowa accented letters to be displayed with corresponding letter + void setAccent(); + + // Populate the second toolbar with the correct buttons if the + // current language has special characters. + void loadLangToolBar(); + + ///Create a png image with the argument (special character) and return the path to this png image + QString charIcon(const QChar &); + +public slots: + ///When the langugae is changed in the Language menu + void slotChangeLanguage(int); + +private slots: + // Slots for when the user changes level, setting, etc. + void slotChangeLevel(int); + void slotChangeMode(); + + ///In Settings menu, Configure KHangMan... menu item + void optionsPreferences(); + ///access the KNewStuff class to install new data + void slotDownloadNewStuff(); + ///update settings after Settings->Configure KHangMan dialog is closed + void updateSettings(); + ///When a button is clicked on the toolbar, the corresponding character is written in the lineedit + void slotPasteChar(); + + ///Quit the application and save special toolbar settings + void slotQuit(); + +private: + + // Some important members: the view and newStuff. + KHangManView *m_view; + KHNewStuff *m_newStuff; + + // Actions in the Game menu + KSelectAction *m_levelAction; + KSelectAction *m_modeAction; + + ///Create the Special Characters Toolbar + KToolBar *secondToolbar; + + // True if the language has no special chars, such as en, it and nl. + // FIXME: Reverse the bool. Negated bools are difficult to read. + bool m_noSpecialChars; + + // Contains all the words that are read from the data file. + QStringList m_allData; + + ///Instance of an advanced page of the config dialog + advanced *mAdvanced; + +}; + +#endif // _KHANGMAN_H_ diff --git a/khangman/khangman/khangman.kcfg b/khangman/khangman/khangman.kcfg new file mode 100644 index 00000000..029b0913 --- /dev/null +++ b/khangman/khangman/khangman.kcfg @@ -0,0 +1,102 @@ +<?xml version="1.0" encoding="UTF-8"?> +<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 + http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" > + <kcfgfile name="khangmanrc"/> + + <group name="Language"> + <entry name="CurrentLevel" type="Int"> + <label>Level</label> + <default code="true">0</default> + </entry> + <entry name="LevelFile" type="String"> + <default code="true">"animals.kvtml"</default> + </entry> + <entry name="ShowCharToolbar" type="Bool"> + <label>Show the characters toolbar</label> + <default code="true">false</default> + </entry> + <entry name="SelectedLanguage" type="String"> + <label>The language selected by the user</label> + <code> + KConfigBase *globalConf = KGlobal::config(); + globalConf->setGroup("Locale"); + QString userLanguage = globalConf->readEntry("Language", "en"); + if (userLanguage.isEmpty()) + userLanguage = "en"; + else + //keep only the first 2 characters + userLanguage = userLanguage.left(2); + </code> + <default code="true">userLanguage</default> + </entry> + </group> + + <group name="Look"> + <entry name="Mode" type="Enum"> + <label>Background theme</label> + <choices> + <choice name="sea"/> + <choice name="desert"/> + </choices> + <default>sea</default> + </entry> + </group> + + <group name="General"> + <entry name="OneLetter" type="Bool"> + <label>Allow Only One Instance of Each Letter to be replaced in the word</label> + <default code="true">false</default> + </entry> + <entry name="WonDialog" type="Bool"> + <label>Do not display the 'Congratulations You won!' dialog</label> + <default code="true">false</default> + </entry> + <entry name="Sound" type="Bool"> + <label>Enable Sounds on New Game and Win Game</label> + <default code="true">false</default> + </entry> + <entry name="HintTimer" type="Int"> + <label>the time to display the Hint KPassiveTooltip, in seconds</label> + <default code="true">4</default> + </entry> + <entry name="MissedTimer" type="Int"> + <label>the time to display the Missed KPassivePopup, in seconds</label> + <default code="true">1</default> + </entry> + </group> + + <group name="Advanced"> + <entry name="Hint" type="Bool"> + <label>Enable Hint mode if available i.e. only if hintBool == true</label> + <default code="true">false</default> + </entry> + <entry name="AccentedLetters" type="Bool"> + <label>Type accented letters separately from normal letters</label> + <default code="true">false</default> + </entry> + <entry name="UpperCase" type="Bool"> + <label>Write the word in upper case letters if checked</label> + <default code="true">false</default> + </entry> + </group> + + <group name="Fonts"> + <entry name="GuessFontFamily" type="String"> + <label>Default font family for the Guess button</label> + <default code="true">"Dustismo Roman"</default> + </entry> + <entry name="MissesFontFamily" type="String"> + <label>Default font family for the MIsses button</label> + <default code="true">"Domestic Manners"</default> + </entry> + </group> + + <group name="KNewStuff"> + <entry name="ProvidersUrl" type="Path"> + <label>The Providers path for KHangMan</label> + <default code="true">"http://edu.kde.org/khangman/downloads/providers.xml"</default> + </entry> + </group> +</kcfg> diff --git a/khangman/khangman/khangmanrc b/khangman/khangman/khangmanrc new file mode 100644 index 00000000..54e188d1 --- /dev/null +++ b/khangman/khangman/khangmanrc @@ -0,0 +1,2 @@ +[KNewStuff] +ProvidersUrl=http://edu.kde.org/khangman/downloads/providers.xml diff --git a/khangman/khangman/khangmanui.rc b/khangman/khangman/khangmanui.rc new file mode 100644 index 00000000..da1c15e6 --- /dev/null +++ b/khangman/khangman/khangmanui.rc @@ -0,0 +1,41 @@ +<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> +<kpartgui name="khangman" version="3"> + +<MenuBar> + <Menu name="file" noMerge="1"><text>&Game</text> + <Action name="file_new"/> + <Action name="downloadnewstuff"/> + <Action name="file_quit"/> + </Menu> + + <Action name="combo_level"/> + + <Action name="languages"/> + + <Action name="combo_mode"/> + + <Menu name="settings" noMerge="1"><text>&Settings</text> + <Merge name="StandardToolBarMenuHandler" /> + <Merge name="second_act" /> + <Action name="options_show_statusbar"/> + <Action name="options_configure_keybinding"/> + <Action name="options_configure_toolbars"/> + <Action name="options_configure"/> + </Menu> +</MenuBar> + +<ToolBar name="mainToolBar" noMerge="1"><text>Main</text> + <Action name="fullscreen"/> + <Separator/> + <Action name="combo_level"/> + <Separator/> + <Action name="combo_mode"/> + <Separator/> + <Action name="file_new"/> + <Action name="file_quit"/> +</ToolBar> + +<ToolBar name="secondToolBar" noMerge="1"><text>Special Characters</text> +</ToolBar> + +</kpartgui> diff --git a/khangman/khangman/khangmanview.cpp b/khangman/khangman/khangmanview.cpp new file mode 100644 index 00000000..f53a7f99 --- /dev/null +++ b/khangman/khangman/khangmanview.cpp @@ -0,0 +1,736 @@ +/* + * Copyright (C) 2001-2005 Anne-Marie Mahfouf <annma@kde.org> + + This program is free software; you can redistribute it and/or + modify it under the terms of version 2 of the GNU General Public + License as published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include <kapplication.h> +#include <kaudioplayer.h> +#include <kdebug.h> +#include <klineedit.h> +#include <klocale.h> +#include <kmessagebox.h> +#include <kpassivepopup.h> +#include <kpushbutton.h> +#include <kstandarddirs.h> + +#include <qimage.h> +#include <qlabel.h> +#include <qpainter.h> +#include <qpoint.h> +#include <qregexp.h> +#include <qtimer.h> +#include <qtooltip.h> +#include <qvbox.h> +#include <qwidget.h> + +//project headers +#include "prefs.h" +#include "khangman.h" +#include "khangmanview.h" + + +KHangManView::KHangManView(KHangMan*parent, const char *name) + : QWidget(parent, name, WStaticContents | WNoAutoErase) +{ + khangman = parent; + + // The widget for entering letters. + m_letterInput = new KLineEdit( this, "charWrite" ); + m_letterInput->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType) 1, + (QSizePolicy::SizeType) 0, + 0, 0, + m_letterInput->sizePolicy().hasHeightForWidth() ) ); + m_letterInput->setMaxLength( 1 ); + m_letterInput->setAlignment( int( QLineEdit::AlignHCenter ) ); + + // Press this button to enter a letter (or press enter) + m_guessButton = new KPushButton( this, "guessButton" ); + m_guessButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType) 1, + (QSizePolicy::SizeType) 0, + 0, 0, + m_guessButton->sizePolicy().hasHeightForWidth() ) ); + m_guessButton->setAutoMask( true ); + m_guessButton->setFlat( true ); + m_guessButton->setText( i18n( "G&uess" ) ); + + // Get background from config file - default is sea + loadAnimation(); + + setMinimumSize( QSize( 660, 370 ) ); + setBackground( m_originalBackground ); + + // Some misc initializations. + m_numMissedLetters = 0; + m_lastWordNumber = -1; + m_accentedLetters = true; + m_hintExists = true; // Assume hint exists + + connect( m_letterInput, SIGNAL( returnPressed() ), + this, SLOT( slotTry() ) ); + connect( m_guessButton, SIGNAL( clicked() ), + this, SLOT( slotTry() )); +} + + +KHangManView::~KHangManView() +{ +} + + +// Handle a guess of the letter in sChar. +// + +void KHangManView::replaceLetters(const QString& sChar) +{ + int index = 0; + bool b_end = false; + + kdDebug() << "word " << m_word << endl; + + // Replace letter in the word + if (Prefs::oneLetter()) { + // We just replace the next instance. + for (int count=0; count < m_word.contains(sChar, false); count++) { + + index = m_word.find(sChar, index, false); + if (m_goodWord.at(2*index)=='_') { + m_goodWord.replace((2*index), 1, m_word.at(index)); + + kdDebug() << "m_goodword " << m_goodWord << endl; + if (count == m_word.contains(sChar, false)-1) + b_end = true; + break; + } + else + index++; + + if (count == m_word.contains(sChar, false)-1) + b_end = true; + } + } + else { + for (int count=0; count < m_word.contains(sChar, false); count++) { + //searching for letter location + index = m_word.find(sChar, index, false); + //we replace it... + m_goodWord.replace((2*index), 1,m_word.at(index)); + index++; + } + } + + if (m_accentedLetters && !Prefs::accentedLetters()) { + if (sChar=="i") replaceLetters(QString::fromUtf8("í")); + if (sChar=="a") replaceLetters(QString::fromUtf8("à")); + if (sChar=="a") replaceLetters(QString::fromUtf8("á")); + if (sChar=="a") replaceLetters(QString::fromUtf8("ã")); + if (sChar=="u") replaceLetters(QString::fromUtf8("ü")); + if (sChar=="o") replaceLetters(QString::fromUtf8("ò")); + if (sChar=="o") replaceLetters(QString::fromUtf8("ó")); + if (sChar=="o") replaceLetters(QString::fromUtf8("õ")); + if (sChar=="e") replaceLetters(QString::fromUtf8("è")); + if (sChar=="e") replaceLetters(QString::fromUtf8("é")); + if (sChar=="u") replaceLetters(QString::fromUtf8("ù")); + } + if (!Prefs::oneLetter()) + m_guessedLetters << sChar; //appends the list only if not in One Letter only mode... + + if (m_word.contains(sChar, false) == 1) + m_guessedLetters << sChar; //append if only one instance + + if (Prefs::oneLetter() && b_end) + m_guessedLetters << sChar; +} + + +bool KHangManView::containsChar(const QString &sChar) +{ + bool b = false; + if (m_accentedLetters && !Prefs::accentedLetters()) { + if (sChar=="i") + b = m_word.contains(QString::fromUtf8("í"), false); + + if (sChar=="a") + b = m_word.contains(QString::fromUtf8("à"), false) + || m_word.contains(QString::fromUtf8("á"), false) + || m_word.contains(QString::fromUtf8("ã"), false); + + if (sChar=="u") + b = m_word.contains(QString::fromUtf8("ü"), false) + || m_word.contains(QString::fromUtf8("ù"), false); + + if (sChar=="o") + b = m_word.contains(QString::fromUtf8("ò"), false) + || m_word.contains(QString::fromUtf8("ó"), false) + || m_word.contains(QString::fromUtf8("õ"), false); + + if (sChar=="e") + b = m_word.contains(QString::fromUtf8("è"), false) + || m_word.contains(QString::fromUtf8("é"), false); + } + + return (b || m_word.contains(sChar, false)); +} + + +// ---------------------------------------------------------------- +// Event handlers + + +void KHangManView::mousePressEvent(QMouseEvent *mouse) +{ + if (mouse->button() == RightButton && m_hintExists && Prefs::hint()) { + + KPassivePopup *myPopup = new KPassivePopup( m_letterInput); + myPopup->setView(i18n("Hint"), m_hint ); + myPopup->setPalette(QToolTip::palette()); + myPopup->setTimeout(Prefs::hintTimer()*1000); //show for 4 seconds as default + int x=0, y=0; + + QPoint abspos = mapToGlobal( QPoint( 0, 0 ) ); + x = abspos.x() + width()*70/700; + y = abspos.y() + height()*150/535; + + QPoint point = QPoint(x, y); + myPopup->show(mapToGlobal(point)); + + // Maybe it's better to popup where the mouse clicks, in that + // case kill the popup before new click + //myPopup->move(mouse->pos()); + } + + //update(); +} + + +// ---------------------------------------------------------------- + +// FIXME: Move this function somewhere logical + + +void KHangManView::setTheme() +{ + loadAnimation(); + setBackground(m_originalBackground); + update(); +} + + +// ---------------------------------------------------------------- +// Painting + + +void KHangManView::paintEvent( QPaintEvent * ) +{ + // This pixmap implements double buffering to remove all forms of + // flicker in the repainting. + QPixmap buf(width(), height()); + + // Repaint the contents of the khangman view into the pixmap. + QPainter p(&buf); + p.drawPixmap(0, 0, m_resizedBackground); + paintHangman(p); + paintWord(p); + paintMisses(p); + + // ...and finally, put the pixmap into the widget. + bitBlt(this, 0, 0, &buf); +} + + +void KHangManView::paintHangman(QPainter &p) +{ + // Draw the animated hanged K + if (Prefs::mode() == 0) // sea + p.drawPixmap(QRect(0, 0, + width()*630/700, height()*285/535), + m_animationPics[m_numMissedLetters]); + else + p.drawPixmap(QRect(width()*68/700, height()*170/535, + width()*259/700, height()*228/535), + m_animationPics[m_numMissedLetters]); +} + + +void KHangManView::paintWord(QPainter &p) +{ + QRect myRect; + if (Prefs::mode() == 0) //sea + myRect = QRect(0, height()-height()*126/535, + width()*417/700, height()*126/535); + else + myRect = QRect(0, height()-height()*126/535, + width()*327/700, height()*126/535); + + QFont tFont; + if (Prefs::mode() == 0) //sea + p.setPen( QColor(148, 156, 167)); + else + p.setPen( QColor(87, 0, 0)); + + if (Prefs::selectedLanguage() =="tg") + tFont.setFamily( "URW Bookman" ); + else + tFont.setFamily( "Sans Serif" ); + + // FIXME: This has to be scaled depending of the dpi + tFont.setPixelSize( 28 ); + + p.setFont(tFont); + p.drawText(myRect, AlignCenter|AlignCenter, m_goodWord); +} + + +void KHangManView::paintMisses(QPainter &p) +{ + // Get the color for the letters. + QColor letterColor; + if (Prefs::mode() == 0) //sea + letterColor = QColor(148, 156, 167); + else + letterColor = QColor(87, 0, 0); + + // Draw the missed letters + QFont tFont; + if (Prefs::selectedLanguage() =="tg") + tFont.setFamily( "URW Bookman" ); + else + tFont.setFamily( "Arial" ); + tFont.setPixelSize( 28 ); + p.setPen( letterColor ); + p.setFont(tFont); + + QFontMetrics fm(tFont); + QRect fmRect(fm.boundingRect(m_missedLetters)); + QRect myRect = QRect(width() - fmRect.width(), 15, + fmRect.width(), fm.height()); + p.drawText(myRect, AlignLeft, m_missedLetters); + + // Draw the "Misses" word + QString misses = i18n("Misses"); + QFont mFont = QFont(Prefs::missesFontFamily()); + mFont.setPointSize(30); + p.setFont(mFont); + + QFontMetrics fm2(mFont); + QRect fmRect2(fm2.boundingRect(misses)); + QRect myRect2(width()- fmRect.width() - fmRect2.width() - 15, + 15 - fm2.height() + fm.height(), + fmRect2.width(), fm2.height()); + p.setPen( letterColor ); + p.drawText(myRect2, AlignLeft|AlignCenter, misses); +} + + +void KHangManView::resizeEvent(QResizeEvent *) +{ + if(!m_originalBackground.isNull()) + setBackground(m_originalBackground); + + m_letterInput->setMinimumSize( QSize( height()/18, 0 ) ); + + QFont charWrite_font( m_letterInput->font() ); + charWrite_font.setPointSize( height()/18 ); + charWrite_font.setFamily( "Sans Serif" ); + + m_letterInput->setFont( charWrite_font ); + m_letterInput->setGeometry(width()-2*height()/12, height()-2*height()/16, + height()/10, height()/10); + m_guessButton->setFont(QFont(Prefs::guessFontFamily(), height()/22)); + m_guessButton->setGeometry(width() - 2*height()/12 + - m_guessButton->width()-5, + height() - 2*height()/16, + m_guessButton->width(), height()/10); +} + + +// ---------------------------------------------------------------- +// Slots + + +void KHangManView::setBackground(QPixmap& bgPix) +{ + QImage img = bgPix.convertToImage(); + m_resizedBackground.resize(size()); + m_resizedBackground.convertFromImage(img.smoothScale( width(), height())); +} + + +void KHangManView::slotTry() +{ + QString guess = m_letterInput->text(); + kdDebug() << "guess as entered: " << guess << endl; + + // If the char is not a letter, empty the input and return. + if (!guess.at(0).isLetter()) { + m_letterInput->setText(""); + return; + } + + // Handle the guess. + if (!m_guessedLetters.contains(guess.lower())) { + // The letter is not already guessed. + + if (containsChar(guess)) { + replaceLetters(guess); + + // This is needed because of the white spaces. + QString stripWord = m_goodWord; + QString sword = m_word; + if (dd > 0) { + stripWord.replace(2*c, 1, ""); + stripWord.replace(2*c-1, 1, ""); + + stripWord.replace(2*(dd-1), 1, ""); + stripWord.replace(2*(dd-1)-1, 1, ""); + } + + QStringList rightChars = QStringList::split(" ", stripWord, true); + QString rightWord = rightChars.join(""); + update(); + sword.remove(QRegExp(" ")); + + // If the user made it... + if (rightWord.stripWhiteSpace().lower() + == sword.stripWhiteSpace().lower()) { + + // We reset everything... + // pixImage->setPixmap(m_animationPics[10]); + //TODO find a better way to finish + // + if (Prefs::sound()) { + QString soundFile = locate("data", "khangman/sounds/EW_Dialogue_Appear.ogg"); + if (soundFile != 0) + KAudioPlayer::play(soundFile); + } + + if (Prefs::wonDialog()) { + // TODO: hide Hint KPassivePopup if any + QPoint point; + KPassivePopup *popup = new KPassivePopup( this, "popup" ); + popup->setAutoDelete( true ); + popup->setTimeout( 4*1000 ); + popup->setView(i18n("Congratulations,\nyou won!") ); + + int x =0, y = 0; + QPoint abspos = popup->pos(); + x = abspos.x() + width()*50/700; + y = abspos.y() + height()*20/535; + point = QPoint(x, y); + popup->show(mapToGlobal(point)); + QTimer::singleShot( 4*1000, this, SLOT(slotNewGame()) ); + } + else if (KMessageBox::questionYesNo(this, i18n("Congratulations! You won! Do you want to play again?"),QString::null,i18n("Play Again"), i18n("Do Not Play")) == 3) + slotNewGame(); + else + kapp->quit(); + } + } + else { + // The char is missed. + + m_guessedLetters << guess.lower(); + m_guessedLetters << guess.upper(); + m_missedLetters = m_missedLetters.replace((2 * m_numMissedLetters), + 1, guess.lower()); + m_numMissedLetters++; + update(); + + // Check if we have reached the limit of wrong guesses. + if (m_numMissedLetters >= MAXWRONGGUESSES) { + + //TODO sequence to finish when hanged + QStringList charList=QStringList::split("", m_word); + QString theWord=charList.join(" "); + m_goodWord = theWord; + //usability: find another way to start a new game + QString newGameString = i18n("You lost. Do you want to play again?"); + if (Prefs::wonDialog()) { + // TODO: hide Hint KPassivePopup if any + QPoint point; + KPassivePopup *popup = new KPassivePopup(KPassivePopup::Boxed, this, "popup" ); + popup->setAutoDelete( true ); + popup->setTimeout( 4*1000 ); + + QVBox *vb = new QVBox( popup ); + + QLabel *popLabel = new QLabel( vb); + popLabel->setFont(QFont("Sans Serif", 14, QFont::Normal)); + popLabel->setText(i18n("<qt>You lost!\nThe word was\n<b>%1</b></qt>").arg(m_word)); + popup->setView( vb ); + + QPoint abspos = popup->pos(); + int x = abspos.x() + width() * 50 / 700; + int y = abspos.y() + height() * 20 / 535; + popup->show(mapToGlobal(QPoint(x, y))); + + QTimer::singleShot( 4 * 1000, this, SLOT(slotNewGame()) ); + } + else if (KMessageBox::questionYesNo(this, newGameString, QString::null, i18n("Play Again"), i18n("Do Not Play")) == 3) + slotNewGame(); + else + kapp->quit(); + } + } + } + else { + // The letter is already guessed. + + // Show a popup that says as much. + QPoint point; + KPassivePopup *popup = new KPassivePopup(KPassivePopup::Balloon, this, "popup" ); + popup->setAutoDelete( true ); + popup->setTimeout( 1000 ); + popup->setView(i18n("This letter has already been guessed.") ); + + int x = 0; + int y = 0; + if (m_missedLetters.contains(guess, false) > 0) { + // FIXME: popup should be better placed. + + QPoint abspos = popup->pos(); + x = abspos.x() + width()*400/700; + y = abspos.y() + height()*50/535; + point = QPoint(x, y); + + // Create a 1 second single-shot timer, and reenable user + // input after this time. + QTimer::singleShot( Prefs::missedTimer() * 1000, + this, SLOT(enableUserInput()) ); + + // Disable any possible entry + m_letterInput->setEnabled(false); + } + + if (m_goodWord.contains(guess, false) > 0) { + QPoint abspos = popup->pos(); + + if (Prefs::mode() == 0) { + // sea + x = abspos.x() + width()*250/700; + y = abspos.y() + height()*485/535; + } + else { + x = abspos.x() + width()*200/700; + y = abspos.y() + height()*485/535; + } + point = QPoint(x, y); + + QTimer::singleShot( Prefs::missedTimer() * 1000, + this, SLOT(enableUserInput()) ); + + // Disable any possible entry + m_letterInput->setEnabled(false); + } + + popup->show(mapToGlobal(point)); + } + + // Reset the entry field after guess. + m_letterInput->setText(""); +} + + +void KHangManView::enableUserInput() +{ + m_letterInput->setEnabled(true); + m_letterInput->setFocus(); +} + + +void KHangManView::slotNewGame() +{ + if (Prefs::sound()) { + QString soundFile = locate("data", "khangman/sounds/new_game.ogg"); + if (soundFile != 0) + KAudioPlayer::play(soundFile); + } + + reset(); + game(); + m_letterInput->setFocus(); +} + + +void KHangManView::reset() +{ + m_goodWord = ""; + m_word = ""; + + m_guessedLetters.clear(); + m_numMissedLetters = 0; + m_missedLetters = "_ _ _ _ _ _ _ _ _ _ "; + + // Clear the input field. + m_letterInput->setText(""); + + update(); +} + + +void KHangManView::game() +{ + kdDebug() << "language " << Prefs::selectedLanguage() << endl; + kdDebug() << "level " << Prefs::levelFile() << endl; + + // Check if the data files are installed in the correct dir. + QString myString = QString("khangman/data/%1/%2") + .arg(Prefs::selectedLanguage()) + .arg(Prefs::levelFile()); + QFile myFile; + myFile.setName(locate("data", myString)); + if (!myFile.exists()) { + QString mString = i18n("File $KDEDIR/share/apps/khangman/data/%1/%2 not found!\n" + "Check your installation, please!") + .arg(Prefs::selectedLanguage()) + .arg(Prefs::levelFile()); + KMessageBox::sorry( this, mString, i18n("Error") ); + kapp->quit(); + } + + // We open the file and store info into the stream... + QFile openFileStream(myFile.name()); + openFileStream.open(IO_ReadOnly); + QTextStream readFileStr(&openFileStream); + readFileStr.setEncoding(QTextStream::UnicodeUTF8); + + // Alldata contains all the words from the file + QStringList allData = QStringList::split("\n", readFileStr.read(), true); + openFileStream.close(); + + // Detects if file is a kvtml file so that it's a hint enable file + if (allData.first() == "<?xml version=\"1.0\"?>") { + readFile(); + } + else { + //TODO abort if not a kvtml file maybe + kdDebug() << "Not a kvtml file!" << endl; + } + kdDebug() << m_word << endl; + + // Display the number of letters to guess with _ + for (unsigned int i = 0; i < m_word.length(); i++) + m_goodWord.append("_ "); + + // Remove the last trailing space. + m_goodWord.remove(m_goodWord.length()-1); + + kdDebug() << m_goodWord << endl; + + // If needed, display white space or - if in word or semi dot. + + // 1. Find dashes. + int f = m_word.find( "-" ); + if (f>0) { + m_goodWord.replace(2*f, 1, "-"); + + int g = m_word.find( "-", f+1); + if (g>0) + m_goodWord.replace(2*g, 3, "-"); + if (g>1) + m_goodWord.append("_"); + } + + // 2. Find white space. + c = m_word.find( " " ); + if (c > 0) { + m_goodWord.replace(2*c, 1, " "); + dd = m_word.find( " ", c+1); + if (dd > 0) + m_goodWord.replace(2*dd, c+1, " "); + } + + // 3. Find · + int e = m_word.find( QString::fromUtf8("·") ); + if (e>0) + m_goodWord.replace(2*e, 1, QString::fromUtf8("·") ); + + // 4. Find ' + int h = m_word.find( "'" ); + if (h>0) + m_goodWord.replace(2*h, 1, "'"); +} + + +void KHangManView::readFile() +{ + kdDebug() << "in read kvtml file " << endl; + QString myString=QString("khangman/data/%1/%2").arg(Prefs::selectedLanguage()).arg(Prefs::levelFile()); + myString= locate("data", myString); + KEduVocDataItemList verbs = KEduVocData::parse(myString); + + //how many words in the file + int NumberOfWords = verbs.count(); + + //pick a number in random + + // Make sure the same word is not chosen twice in a row. + int wordNumber = m_random.getLong(NumberOfWords); + if (m_lastWordNumber != -1) { + while (wordNumber == m_lastWordNumber) + wordNumber = m_random.getLong(NumberOfWords); + } + m_lastWordNumber = wordNumber; + + m_word = verbs[wordNumber].originalText(); + m_hint = verbs[wordNumber].translatedText(); + + if (m_word.isEmpty()) + readFile(); + + if (m_hint.isEmpty()) { + m_hintExists = false; // Hint does not exist. + + // FIXME: Make this a signal instead. + khangman->changeStatusbar("", 103); + } + else { + m_hintExists = true; + khangman->setMessages(); + } +} + + +void KHangManView::loadAnimation() +{ + switch (Prefs::mode()) { + case Prefs::EnumMode::sea: + m_originalBackground = QPixmap(locate("data", "khangman/pics/sea/sea_theme.png") ); + m_themeName = "sea"; + m_letterInput->setPaletteForegroundColor( QColor( 83, 40, 14) ); + m_guessButton->setPaletteBackgroundColor( QColor( 115, 64, 49) ); + m_guessButton->setPaletteForegroundColor( QColor( 148, 156, 167) ); + m_guessButton->setBackgroundOrigin( KPushButton::ParentOrigin ); + break; + + case Prefs::EnumMode::desert: + m_originalBackground = QPixmap(locate("data","khangman/pics/desert/desert_theme.png") ); + m_themeName = "desert"; + m_letterInput->setPaletteForegroundColor( QColor( 87, 0, 0) ); + m_guessButton->setPaletteBackgroundColor( QColor( 205, 214, 90) ); + m_guessButton->setPaletteForegroundColor( QColor( 87, 0, 0) ); + m_guessButton->setBackgroundOrigin( KPushButton::ParentOrigin ); + break; + } + + // Now we load the pixmaps... + for (uint i = 0; i < 11; i++) { + m_animationPics[i].load(locate( "data", + QString("khangman/pics/%1/animation%2.png") + .arg(m_themeName).arg(i) )); + } +} + +#include "khangmanview.moc" + diff --git a/khangman/khangman/khangmanview.h b/khangman/khangman/khangmanview.h new file mode 100644 index 00000000..593c94a0 --- /dev/null +++ b/khangman/khangman/khangmanview.h @@ -0,0 +1,202 @@ +/* + * Copyright (C) 2001-2005 Anne-Marie Mahfouf <annma@kde.org> + + This program is free software; you can redistribute it and/or + modify it under the terms of version 2 of the GNU General Public + License as published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + + +#ifndef KHANGMANVIEW_H +#define KHANGMANVIEW_H + + +class KPushButton; +class KHangMan; + +#include <klineedit.h> + +#include <krandomsequence.h> +#include <keduvocdata.h> + + +#define MAXWRONGGUESSES 10 + + +/** + * This is the main view class for KHangMan. Most of the non-menu, + * non-toolbar, and non-statusbar (e.g., non frame) GUI code should go + * here. + */ + +class KHangManView : public QWidget +{ + Q_OBJECT +public: + + KHangManView(KHangMan *parent=0, const char *name=0); + + virtual ~KHangManView(); + + ///parent instance + KHangMan *khangman; + + void setTheme(); + + bool hintExists() const { return m_hintExists; } + + bool accentedLetters() const { return m_accentedLetters; } + void setAccentedLetters( bool _accentedLetters ) + { m_accentedLetters = _accentedLetters; } + + /// Enter a letter into the input widget. + void enterLetter(QString letter) { m_letterInput->setText(letter); } + + +signals: + + /// Use this signal to change the content of the statusbar + void signalChangeLanguage(int); + + /// Emit this signal to say if this is a kvtml file or not (hints + /// enabled or not). + void signalKvtml(bool); + +private: + + // FIXME: Move all these below the next "private:" and when doing + // that, rename them (if necessary), and regroup them into + // logical groups. + + // FIXME: Rename these into something sensible! + // (or better yet: remove them altogether) + int c; // These two are the positions of the first and + int dd; // second spaces in the word. + + + protected: + + // Events + void paintEvent( QPaintEvent * ); + void resizeEvent( QResizeEvent * ); + + /// Enable hints on mouse right click if Hints exist. + virtual void mousePressEvent( QMouseEvent *mouse ); + + + private: + + // Painting + + /// Paint the animated hanged K sequence. + void paintHangman(QPainter &p); + void paintWord(QPainter &p); + void paintMisses(QPainter &p); + + /// Reset everything to start a new game, missed letters is empty. + void reset(); + /// Load kvtml file and get a word and its tip in random. + void readFile(); + /// Play a game: look for a word to be guessed and load its tip. + void game(); + + /// Load the K animated sequence depending of the theme. + void loadAnimation(); + + /// Set the background pixmap to the QPixmap argument. + void setBackground(QPixmap& ); + + /// Return true if the word contains the char in the QString. + bool containsChar(const QString &); + + void replaceLetters(const QString &); + +public slots: + /// If you want to play with a new word + void slotNewGame(); + +private slots: + + /// After you click on Guess button or hit Enter when guessing a + /// new letter, see if the letter is in the word or not + void slotTry(); + + /// Reenable user input. This is used as a target for timers when + /// the user has made a guess that was already made earlier, and a + /// popup informing about this is closed. + void enableUserInput(); + +private: + + // The basic data ---------------- + + // FIXME: Rewrite the whole handling of this so that goodWord, + // guessedLetters, and missedLetters all lack spaces. + // These spaces will then be added at draw time. + + /// The word to be guessed. + QString m_word; + /// goodWord is the hidden word that is filled in during the game. + /// Initialized to "_ " * (number of letters in the word). + QString m_goodWord; + + /// Contains all letters already guessed. + QStringList m_guessedLetters; + + // Stores the missed letters that are shown on the screen. + // Initialiazed to "_ " * MAXWRONGGUESSES. + QString m_missedLetters; + /// How many times you missed. + /// When this reaches MAXWRONGGUESSES, you are hanged. + int m_numMissedLetters; + + + // Misc data ---------------- + + // Stores the number of the last word. This is to make sure that + // the same word is not given twice in a row. + int m_lastWordNumber; + + QString m_themeName; + KRandomSequence m_random; + + /// true if a hint exists + bool m_hintExists; + QString m_hint; + + /// true if the language contains accented letters. + /// This is true for, among others, es, ca, pt or pt_BR + bool m_accentedLetters; + + + // Graphics ---------------- + + // Background picture (sea or desert) + QPixmap m_originalBackground; // Original image + QPixmap m_resizedBackground; // Resized to fit the window. + + /// The hanged K animation sequence. + QPixmap m_animationPics[MAXWRONGGUESSES + 1]; + + // Widgets ---------------- + + /// The widget where the user enters the letter. Upper case is + /// transformed into lower case, except for german(!). + KLineEdit *m_letterInput; + + /// After you entered a letter in the line edit click this button + /// to see if the letter is in the word or not. + KPushButton *m_guessButton; +}; + +#endif // KHANGMANVIEW_H + diff --git a/khangman/khangman/khnewstuff.cpp b/khangman/khangman/khnewstuff.cpp new file mode 100644 index 00000000..829a5f24 --- /dev/null +++ b/khangman/khangman/khnewstuff.cpp @@ -0,0 +1,67 @@ +/* + This file is from KOrganizer. + Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> + Copyright (c) 2004-2005 Anne-Marie Mahfouf <annma@kde.org> + + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + As a special exception, permission is given to link this program + with any edition of Qt, and distribute the resulting executable, + without including the source code for Qt in the source distribution. +*/ + +#include <kapplication.h> +#include <kdebug.h> +#include <kstandarddirs.h> +#include <ktar.h> +#include <qdir.h> +#include <kaction.h> + +#include "prefs.h" +#include "khnewstuff.h" + +KHNewStuff::KHNewStuff( KHangManView *view ) : + KNewStuff( "khangman", view ), + m_view( view ) +{ +} + +bool KHNewStuff::install( const QString &fileName ) +{ + kdDebug(5850) << "KHNewStuff::install(): " << fileName << endl; + + KTar archive( fileName ); + if ( !archive.open( IO_ReadOnly ) ) + return false; + const KArchiveDirectory *archiveDir = archive.directory(); + KStandardDirs myStdDir; + const QString destDir =myStdDir.saveLocation("data", kapp->instanceName() + "/data/", true); + KStandardDirs::makeDir( destDir ); + archiveDir->copyTo(destDir); + archive.close(); + //look for languages dirs installed + m_view->khangman->setLanguages(); + //refresh Languages menu + m_view->khangman->m_languageAction->setItems(m_view->khangman->m_languageNames); + m_view->khangman->slotChangeLanguage(m_view->khangman->m_languages.findIndex(Prefs::selectedLanguage())); + m_view->khangman->m_languageAction->setCurrentItem(m_view->khangman->m_languages.findIndex(Prefs::selectedLanguage())); + return true; +} + +bool KHNewStuff::createUploadFile( const QString &/*fileName*/ ) +{ + //return mView->saveCalendar( fileName ); + return true; +} diff --git a/khangman/khangman/khnewstuff.h b/khangman/khangman/khnewstuff.h new file mode 100644 index 00000000..75fa7c12 --- /dev/null +++ b/khangman/khangman/khnewstuff.h @@ -0,0 +1,44 @@ +/* + This file is fromKOrganizer. + Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> + Copyright (c) 2004-2005 Anne-Marie Mahfouf <annma@kde.org> + + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + As a special exception, permission is given to link this program + with any edition of Qt, and distribute the resulting executable, + without including the source code for Qt in the source distribution. +*/ +#ifndef KHNEWSTUFF_H +#define KHNEWSTUFF_H + +#include "knewstuff/knewstuff.h" +#include "khangman.h" + +class KHangMan; + +class KHNewStuff : public KNewStuff +{ + public: + KHNewStuff( KHangManView * ); + + bool install( const QString &fileName ); + bool createUploadFile( const QString &fileName ); + + private: + KHangManView *m_view; +}; + +#endif diff --git a/khangman/khangman/main.cpp b/khangman/khangman/main.cpp new file mode 100644 index 00000000..9cbf84e7 --- /dev/null +++ b/khangman/khangman/main.cpp @@ -0,0 +1,155 @@ +/* + * Copyright (C) 2001-2005 Anne-Marie Mahfouf <annma@kde.org> + + This program is free software; you can redistribute it and/or + modify it under the terms of version 2 of the GNU General Public + License as published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + + +#include "khangman.h" +#include "version.h" + +#include <kapplication.h> +#include <kaboutdata.h> +#include <kcmdlineargs.h> +#include <klocale.h> +#include <kprocess.h> +#include <kstandarddirs.h> + +#include "fontchecker.h" + +static const char description[] = + I18N_NOOP("Classical hangman game for KDE"); + +static const char version[] = "0.1"; + +static KCmdLineOptions options[] = +{ +// { "+[URL]", I18N_NOOP( "Document to open" ), 0 }, + KCmdLineLastOption +}; + +int main(int argc, char **argv) +{ + KAboutData aboutData( "khangman", I18N_NOOP("KHangMan"), + KHM_VERSION, description, KAboutData::License_GPL, + "(c) 2001-2006, Anne-Marie Mahfouf", 0, +"http://edu.kde.org/khangman"); + aboutData.addAuthor("Primoz Anzur", I18N_NOOP("Previous maintainer"), "zerokode@gmx.net"); + //write the names with accents and all and this file save with utf8 encoding + aboutData.addAuthor("Anne-Marie Mahfouf", I18N_NOOP("Actual maintainer, author"), "annma@kde.org"); + aboutData.addCredit("Renaud Blanchard", + I18N_NOOP("Graphics"), "kisukuma@chez.com"); + aboutData.addCredit("Stefan Asserhäll", + I18N_NOOP("Swedish data files, coding help, transparent pictures and i18n fixes"), "stefan.asserhall@telia.com"); + aboutData.addCredit("Joe Bolin", + I18N_NOOP("Nature theme background"), "jbolin@zoominternet.net"); + aboutData.addCredit("Primoz Anzur", + I18N_NOOP("Blue theme background, icons"), "zerokode@gmx.net"); + aboutData.addCredit("eXParTaKus", + I18N_NOOP("Spanish data files"), "expartakus@expartakus.com"); + aboutData.addCredit("Erik Kjær Pedersenn", + I18N_NOOP("Danish data files"), "erik@mpim-bonn.mpg.de" ); + aboutData.addCredit("Niko Lewman", + I18N_NOOP("Finnish data files"), "niko.lewman@edu.hel.fi" ); + aboutData.addCredit("João Sebastião de Oliveira Bueno", + I18N_NOOP("Brazilian Portuguese data files"), "gwidion@mpc.com.br" ); + aboutData.addCredit("Antoni Bella", + I18N_NOOP("Catalan data files"), "bella5@teleline.es"); + aboutData.addCredit("Giovanni Venturi", + I18N_NOOP("Italian data files"), "jumpyj@tiscali.it"); + aboutData.addCredit("Rinse", + I18N_NOOP("Dutch data files"), "rinse@kde.nl"); + aboutData.addCredit("Lukáš Tinkl", + I18N_NOOP("Czech data files"), "lukas@kde.org"); + aboutData.addCredit("Tamas Szanto", + I18N_NOOP("Hungarian data files"), "tszanto@mol.hu"); + aboutData.addCredit("Torger Åge Sinnes", + I18N_NOOP("Norwegian (Bokmål) data files"), "org-a-s@online.no"); + aboutData.addCredit("Roger Kovacs", + I18N_NOOP("Tajik data files"), "rkovacs@khujand.org"); + aboutData.addCredit("Chusslove Illich", + I18N_NOOP("Serbian (Cyrillic and Latin) data files"), "chaslav@sezampro.yu"); + aboutData.addCredit("Jure Repinc", + I18N_NOOP("Slovenian data files"), "jlp@holodeck1.com"); + aboutData.addCredit("Pedro Morais", + I18N_NOOP("Portuguese data files"), "Morais@kde.org"); + aboutData.addCredit("Gaute Hvoslef Kvalnes", + I18N_NOOP("Norwegian (Nynorsk) data files"), "gaute@verdsveven.com"); + aboutData.addCredit("Mehmet Özel", + I18N_NOOP("Turkish data files"), "mehmet_ozel2003@hotmail.com"); + aboutData.addCredit("Черепанов Андрей", + I18N_NOOP("Russian data files"), "sibskull@mail.ru"); + aboutData.addCredit("Radostin Radnev", + I18N_NOOP("Bulgarian data files"), "radnev@yahoo.com"); + aboutData.addCredit("Kevin Patrick Scannell", + I18N_NOOP("Irish (Gaelic) data files"), "scannell@slu.edu"); + aboutData.addCredit("Matt Howe", + I18N_NOOP("Softer Hangman Pictures"), "mdhowe@bigfoot.com"); + aboutData.addCredit("Benjamin Meyer", + I18N_NOOP("Coding help"), "ben@meyerhome.net"); + aboutData.addCredit("Robert Gogolok", + I18N_NOOP("Coding help"), "robertgogolok@gmx.de"); + aboutData.addCredit("Lubos Lunàk", + I18N_NOOP("Coding help"), "l.lunak@kde.org"); + aboutData.addCredit("Albert Astals Cid", + I18N_NOOP("Coding help, fixed a lot of things"), "tsdgeos@terra.es"); + aboutData.addCredit("Danny Allen", + I18N_NOOP("SVG icon"), "danny@dannyallen.co.uk"); + aboutData.addCredit("Peter Hedlund", + I18N_NOOP("Code for generating icons for the characters toolbar"), "peter.hedlund@kdemail.net"); + aboutData.addCredit("Inge Wallin", + I18N_NOOP("Code cleaning"), "inge@lysator.liu.se"); + KCmdLineArgs::init( argc, argv, &aboutData ); + KCmdLineArgs::addCmdLineOptions( options ); + KApplication app; + KHangMan *mainWin = 0; + + QFont f("Domestic Manners", 12, QFont::Normal, true); + QFont fd("Dustismo Roman", 12, QFont::Normal, true); + if (!fontChecker::checkInstalled(f, locate("appdata", "fonts/Domestic_Manners.ttf"))) + { + KProcess *proc = new KProcess; + for (int i = 0; i < argc; i++) *proc << argv[i]; + proc->start(); + } + else if (!fontChecker::checkInstalled(fd, locate("appdata", "fonts/Dustismo_Roman.ttf"))) + { + KProcess *proc = new KProcess; + for (int i = 0; i < argc; i++) *proc << argv[i]; + proc->start(); + } + else + { + if (app.isRestored()) + { + RESTORE(KHangMan); + } + else + { + // no session.. just start up normally + KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); + + /// @todo do something with the command line args here + + mainWin = new KHangMan(); + app.setMainWidget( mainWin ); + mainWin->show(); + + args->clear(); + // mainWin has WDestructiveClose flag by default, so it will delete itself. + return app.exec(); + } + } +} + diff --git a/khangman/khangman/normal.ui b/khangman/khangman/normal.ui new file mode 100644 index 00000000..f9673223 --- /dev/null +++ b/khangman/khangman/normal.ui @@ -0,0 +1,94 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>normal</class> +<widget class="QWidget"> + <property name="name"> + <cstring>normal</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>334</width> + <height>128</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="0" column="0"> + <property name="name"> + <cstring>layout4</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>kcfg_OneLetter</cstring> + </property> + <property name="text"> + <string>Require more &guesses for duplicate letters</string> + </property> + <property name="toolTip" stdset="0"> + <string>Check this if you do not want to display each instance of the same letter</string> + </property> + <property name="whatsThis" stdset="0"> + <string>If you check this box, only the first letter will be written if the letter is found in several places in the word. Then when you rechoose this letter, it will replace the second instance in the word until there are no more instances of this letter. +For example, the word to guess is "potato". If this option is unchecked, when you try "o", the 2 "o" in the word will be discovered at the same time. If this is checked, you will need to try "o" twice. + +Default is that for one letter typed, all instances of that letter in the word are displayed.</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>kcfg_WonDialog</cstring> + </property> + <property name="text"> + <string>Do not display the 'Congratulations! You &won!' dialog</string> + </property> + <property name="toolTip" stdset="0"> + <string>If checked, the dialog 'Congratulations! You won!' is not displayed. After 3 seconds, a new game will start automatically.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>If this option is not checked, when a game is won a dialog will appear saying 'Congratulations! You won!'. It also asks you if you want to play again and you have to say Yes or No. +This is the default state. + +If this option is checked, this dialog will not appear and a new game will automatically start after four seconds. A passive popup tells you you have won the game. When this opton is checked you don't have an intrusive dialog each time you won a game.</string> + </property> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox3_2</cstring> + </property> + <property name="title"> + <string>Sounds</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>kcfg_Sound</cstring> + </property> + <property name="text"> + <string>Enable &sounds</string> + </property> + <property name="toolTip" stdset="0"> + <string>If checked, sounds will be played for New Game and Win Game</string> + </property> + <property name="whatsThis" stdset="0"> + <string>If this box is checked, you will have some sounds played for each new game and when you win a game. If this is not checked, there will be no sound in KHangMan. +Default is no sound.</string> + </property> + </widget> + </vbox> + </widget> + </vbox> + </widget> + </grid> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/khangman/khangman/pics/Makefile.am b/khangman/khangman/pics/Makefile.am new file mode 100644 index 00000000..462f19fb --- /dev/null +++ b/khangman/khangman/pics/Makefile.am @@ -0,0 +1,2 @@ +SUBDIRS = $(AUTODIRS) + diff --git a/khangman/khangman/pics/desert/Makefile.am b/khangman/khangman/pics/desert/Makefile.am new file mode 100644 index 00000000..1e5f7426 --- /dev/null +++ b/khangman/khangman/pics/desert/Makefile.am @@ -0,0 +1,4 @@ +picsdir = $(kde_datadir)/khangman/pics/desert +pics_DATA = desert_theme.png animation0.png animation1.png animation2.png animation3.png animation4.png animation5.png animation6.png animation7.png animation8.png animation9.png animation10.png +EXTRA_DIST = $(pics_DATA) + diff --git a/khangman/khangman/pics/desert/animation0.png b/khangman/khangman/pics/desert/animation0.png Binary files differnew file mode 100644 index 00000000..b9f74d8e --- /dev/null +++ b/khangman/khangman/pics/desert/animation0.png diff --git a/khangman/khangman/pics/desert/animation1.png b/khangman/khangman/pics/desert/animation1.png Binary files differnew file mode 100644 index 00000000..89203130 --- /dev/null +++ b/khangman/khangman/pics/desert/animation1.png diff --git a/khangman/khangman/pics/desert/animation10.png b/khangman/khangman/pics/desert/animation10.png Binary files differnew file mode 100644 index 00000000..2d5c1fd7 --- /dev/null +++ b/khangman/khangman/pics/desert/animation10.png diff --git a/khangman/khangman/pics/desert/animation2.png b/khangman/khangman/pics/desert/animation2.png Binary files differnew file mode 100644 index 00000000..9f7361b9 --- /dev/null +++ b/khangman/khangman/pics/desert/animation2.png diff --git a/khangman/khangman/pics/desert/animation3.png b/khangman/khangman/pics/desert/animation3.png Binary files differnew file mode 100644 index 00000000..a82f013c --- /dev/null +++ b/khangman/khangman/pics/desert/animation3.png diff --git a/khangman/khangman/pics/desert/animation4.png b/khangman/khangman/pics/desert/animation4.png Binary files differnew file mode 100644 index 00000000..7379c8d3 --- /dev/null +++ b/khangman/khangman/pics/desert/animation4.png diff --git a/khangman/khangman/pics/desert/animation5.png b/khangman/khangman/pics/desert/animation5.png Binary files differnew file mode 100644 index 00000000..73dd7693 --- /dev/null +++ b/khangman/khangman/pics/desert/animation5.png diff --git a/khangman/khangman/pics/desert/animation6.png b/khangman/khangman/pics/desert/animation6.png Binary files differnew file mode 100644 index 00000000..2ef70452 --- /dev/null +++ b/khangman/khangman/pics/desert/animation6.png diff --git a/khangman/khangman/pics/desert/animation7.png b/khangman/khangman/pics/desert/animation7.png Binary files differnew file mode 100644 index 00000000..949d8dea --- /dev/null +++ b/khangman/khangman/pics/desert/animation7.png diff --git a/khangman/khangman/pics/desert/animation8.png b/khangman/khangman/pics/desert/animation8.png Binary files differnew file mode 100644 index 00000000..ac0433fe --- /dev/null +++ b/khangman/khangman/pics/desert/animation8.png diff --git a/khangman/khangman/pics/desert/animation9.png b/khangman/khangman/pics/desert/animation9.png Binary files differnew file mode 100644 index 00000000..217c65f8 --- /dev/null +++ b/khangman/khangman/pics/desert/animation9.png diff --git a/khangman/khangman/pics/desert/desert_theme.png b/khangman/khangman/pics/desert/desert_theme.png Binary files differnew file mode 100644 index 00000000..bfe4676d --- /dev/null +++ b/khangman/khangman/pics/desert/desert_theme.png diff --git a/khangman/khangman/pics/sea/Makefile.am b/khangman/khangman/pics/sea/Makefile.am new file mode 100644 index 00000000..760ca3b4 --- /dev/null +++ b/khangman/khangman/pics/sea/Makefile.am @@ -0,0 +1,4 @@ +picsdir = $(kde_datadir)/khangman/pics/sea +pics_DATA = sea_theme.png animation0.png animation1.png animation2.png animation3.png animation4.png animation5.png animation6.png animation7.png animation8.png animation9.png animation10.png +EXTRA_DIST = $(pics_DATA) + diff --git a/khangman/khangman/pics/sea/animation0.png b/khangman/khangman/pics/sea/animation0.png Binary files differnew file mode 100644 index 00000000..bb1b0b6a --- /dev/null +++ b/khangman/khangman/pics/sea/animation0.png diff --git a/khangman/khangman/pics/sea/animation1.png b/khangman/khangman/pics/sea/animation1.png Binary files differnew file mode 100644 index 00000000..6b9a739b --- /dev/null +++ b/khangman/khangman/pics/sea/animation1.png diff --git a/khangman/khangman/pics/sea/animation10.png b/khangman/khangman/pics/sea/animation10.png Binary files differnew file mode 100644 index 00000000..f5e806e2 --- /dev/null +++ b/khangman/khangman/pics/sea/animation10.png diff --git a/khangman/khangman/pics/sea/animation11.png b/khangman/khangman/pics/sea/animation11.png Binary files differnew file mode 100644 index 00000000..43bdf0e1 --- /dev/null +++ b/khangman/khangman/pics/sea/animation11.png diff --git a/khangman/khangman/pics/sea/animation2.png b/khangman/khangman/pics/sea/animation2.png Binary files differnew file mode 100644 index 00000000..853250a4 --- /dev/null +++ b/khangman/khangman/pics/sea/animation2.png diff --git a/khangman/khangman/pics/sea/animation3.png b/khangman/khangman/pics/sea/animation3.png Binary files differnew file mode 100644 index 00000000..b3b3f1b5 --- /dev/null +++ b/khangman/khangman/pics/sea/animation3.png diff --git a/khangman/khangman/pics/sea/animation4.png b/khangman/khangman/pics/sea/animation4.png Binary files differnew file mode 100644 index 00000000..8dbda87b --- /dev/null +++ b/khangman/khangman/pics/sea/animation4.png diff --git a/khangman/khangman/pics/sea/animation5.png b/khangman/khangman/pics/sea/animation5.png Binary files differnew file mode 100644 index 00000000..0fd6e9d1 --- /dev/null +++ b/khangman/khangman/pics/sea/animation5.png diff --git a/khangman/khangman/pics/sea/animation6.png b/khangman/khangman/pics/sea/animation6.png Binary files differnew file mode 100644 index 00000000..3d349940 --- /dev/null +++ b/khangman/khangman/pics/sea/animation6.png diff --git a/khangman/khangman/pics/sea/animation7.png b/khangman/khangman/pics/sea/animation7.png Binary files differnew file mode 100644 index 00000000..b4492216 --- /dev/null +++ b/khangman/khangman/pics/sea/animation7.png diff --git a/khangman/khangman/pics/sea/animation8.png b/khangman/khangman/pics/sea/animation8.png Binary files differnew file mode 100644 index 00000000..028e3765 --- /dev/null +++ b/khangman/khangman/pics/sea/animation8.png diff --git a/khangman/khangman/pics/sea/animation9.png b/khangman/khangman/pics/sea/animation9.png Binary files differnew file mode 100644 index 00000000..01373557 --- /dev/null +++ b/khangman/khangman/pics/sea/animation9.png diff --git a/khangman/khangman/pics/sea/sea_theme.png b/khangman/khangman/pics/sea/sea_theme.png Binary files differnew file mode 100644 index 00000000..5c296739 --- /dev/null +++ b/khangman/khangman/pics/sea/sea_theme.png diff --git a/khangman/khangman/prefs.kcfgc b/khangman/khangman/prefs.kcfgc new file mode 100644 index 00000000..b7e804e6 --- /dev/null +++ b/khangman/khangman/prefs.kcfgc @@ -0,0 +1,6 @@ +# Code generation options for kconfig_compiler +File=khangman.kcfg +IncludeFiles=kstandarddirs.h,qdir.h +ClassName=Prefs +Singleton=true +Mutators=true diff --git a/khangman/khangman/sounds/EW_Dialogue_Appear.ogg b/khangman/khangman/sounds/EW_Dialogue_Appear.ogg Binary files differnew file mode 100644 index 00000000..037d247a --- /dev/null +++ b/khangman/khangman/sounds/EW_Dialogue_Appear.ogg diff --git a/khangman/khangman/sounds/Makefile.am b/khangman/khangman/sounds/Makefile.am new file mode 100644 index 00000000..404aa91a --- /dev/null +++ b/khangman/khangman/sounds/Makefile.am @@ -0,0 +1,3 @@ +soundsdir = $(kde_datadir)/khangman/sounds +sounds_DATA = new_game.ogg EW_Dialogue_Appear.ogg +EXTRA_DIST = $(sounds_DATA) diff --git a/khangman/khangman/sounds/new_game.ogg b/khangman/khangman/sounds/new_game.ogg Binary files differnew file mode 100644 index 00000000..d8d549cd --- /dev/null +++ b/khangman/khangman/sounds/new_game.ogg diff --git a/khangman/khangman/sounds/splash.ogg b/khangman/khangman/sounds/splash.ogg Binary files differnew file mode 100644 index 00000000..8dde880c --- /dev/null +++ b/khangman/khangman/sounds/splash.ogg diff --git a/khangman/khangman/timer.cpp b/khangman/khangman/timer.cpp new file mode 100644 index 00000000..7d1f7304 --- /dev/null +++ b/khangman/khangman/timer.cpp @@ -0,0 +1,47 @@ +/*************************************************************************** + * Copyright (C) 2005 by Michael Goettsche * + * michael.goettsche@kdemail.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., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#include <klocale.h> + +#include <qlabel.h> +#include <qslider.h> + +#include "timer.h" +#include "prefs.h" + + +Timer::Timer() + :timerdlg() +{ + timeHintLabel->setText(QString::number(Prefs::hintTimer()) + " " + i18n("seconds")); + timeMissedLabel->setText(QString::number(Prefs::missedTimer()) + " " + i18n("seconds")); + connect(kcfg_HintTimer, SIGNAL(valueChanged(int)), this, SLOT(sliderValueChanged())); + connect(kcfg_MissedTimer, SIGNAL(valueChanged(int)), this, SLOT(sliderValueChanged())); +} + + +void Timer::sliderValueChanged() +{ + timeMissedLabel->setText(QString::number(kcfg_MissedTimer->value()) + " " + i18n("seconds")); + timeHintLabel->setText(QString::number(kcfg_HintTimer->value()) + " " + i18n("seconds")); +} + + +#include "timer.moc" diff --git a/khangman/khangman/timer.h b/khangman/khangman/timer.h new file mode 100644 index 00000000..cb3373c1 --- /dev/null +++ b/khangman/khangman/timer.h @@ -0,0 +1,47 @@ +/*************************************************************************** + * Copyright (C) 2005 by Michael Goettsche * + * michael.goettsche@kdemail.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., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#ifndef TIMER_H_ +#define TIMER_H_ + + +#include "timerdlg.h" + +/** + * @short Timer widget in Settings dialog + * @author Michael Goettsche <michael.goettsche@kdemail.net > + * @version 0.1 + */ + +class Timer : public timerdlg +{ +Q_OBJECT + +public: + ///Constructor + Timer(); + +protected slots: + ///When the QSlider value changes + void sliderValueChanged(); +}; + + +#endif //TIMER_H_ diff --git a/khangman/khangman/timerdlg.ui b/khangman/khangman/timerdlg.ui new file mode 100644 index 00000000..facfaaa1 --- /dev/null +++ b/khangman/khangman/timerdlg.ui @@ -0,0 +1,229 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>timerdlg</class> +<widget class="QWidget"> + <property name="name"> + <cstring>timerdlg</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>439</width> + <height>270</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox" row="0" column="0"> + <property name="name"> + <cstring>groupBox5</cstring> + </property> + <property name="title"> + <string>Timers</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout5</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QSlider" row="1" column="0"> + <property name="name"> + <cstring>kcfg_HintTimer</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="maxValue"> + <number>10</number> + </property> + <property name="pageStep"> + <number>1</number> + </property> + <property name="value"> + <number>4</number> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="tickmarks"> + <enum>Below</enum> + </property> + <property name="tickInterval"> + <number>1</number> + </property> + <property name="toolTip" stdset="0"> + <string>Time during which the Hint is displayed</string> + </property> + <property name="whatsThis" stdset="0"> + <string>You can set the time for displaying the Hint tooltip. Default is 3 seconds but younger children might need longer time to be able to read the Hint.</string> + </property> + </widget> + <spacer row="2" column="0"> + <property name="name"> + <cstring>spacer24_2_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>295</width> + <height>20</height> + </size> + </property> + </spacer> + <spacer row="3" column="1"> + <property name="name"> + <cstring>spacer26_2_2_2_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>25</width> + <height>16</height> + </size> + </property> + </spacer> + <widget class="QLabel" row="2" column="1"> + <property name="name"> + <cstring>timeHintLabel</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="buddy" stdset="0"> + <cstring>kcfg_HintTimer</cstring> + </property> + </widget> + <widget class="KActiveLabel" row="0" column="0"> + <property name="name"> + <cstring>kActiveLabel1</cstring> + </property> + <property name="text"> + <string>Set the time for displaying the hint:</string> + </property> + </widget> + </grid> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout6</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KActiveLabel" row="0" column="0"> + <property name="name"> + <cstring>kActiveLabel1_2</cstring> + </property> + <property name="text"> + <string>Set the time for displaying the Already Guessed Letter:</string> + </property> + </widget> + <widget class="QLabel" row="2" column="1"> + <property name="name"> + <cstring>timeMissedLabel</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="buddy" stdset="0"> + <cstring>kcfg_MissedTimer</cstring> + </property> + </widget> + <widget class="QSlider" row="1" column="0"> + <property name="name"> + <cstring>kcfg_MissedTimer</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="maxValue"> + <number>10</number> + </property> + <property name="pageStep"> + <number>1</number> + </property> + <property name="value"> + <number>1</number> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="tickmarks"> + <enum>Below</enum> + </property> + <property name="tickInterval"> + <number>1</number> + </property> + <property name="toolTip" stdset="0"> + <string>Time during which the Already Guessed tooltip is displayed</string> + </property> + <property name="whatsThis" stdset="0"> + <string>You can set the time for displaying the Already Guessed tooltip after you try a letter that was already guessed. Default is 3 seconds but younger children might need longer time to be able to understand they are trying a letter that was already guessed.</string> + </property> + </widget> + <spacer row="3" column="1"> + <property name="name"> + <cstring>spacer26_2_2_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>25</width> + <height>16</height> + </size> + </property> + </spacer> + <spacer row="2" column="0"> + <property name="name"> + <cstring>spacer24_2_2_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>295</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> + </widget> + </vbox> + </widget> + </grid> +</widget> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kactivelabel.h</includehint> + <includehint>kactivelabel.h</includehint> +</includehints> +</UI> diff --git a/khangman/khangman/version.h b/khangman/khangman/version.h new file mode 100644 index 00000000..aa21b41c --- /dev/null +++ b/khangman/khangman/version.h @@ -0,0 +1,25 @@ +/*************************************************************************** + * Copyright (C) 2001-2005 Anne-Marie Mahfouf <annma@kde.org> * + * annemarie.mahfouf@free.fr * + * * + * 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., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#ifndef VERSION_H + +#define KHM_VERSION "1.6" + +#endif |