ColorCode-0.8.7/ 0000755 0001750 0001750 00000000000 14527705423 012054 5 ustar dirk dirk ColorCode-0.8.7/build_qmake/ 0000755 0001750 0001750 00000000000 14527705434 014333 5 ustar dirk dirk ColorCode-0.8.7/COPYING 0000644 0001750 0001750 00000104513 12610736534 013111 0 ustar dirk dirk GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. 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
them 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 prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. 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.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey 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;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If 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 convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU 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 that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
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.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
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.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
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
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
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 3 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, see .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Copyright (C)
This program 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, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU 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 Lesser General
Public License instead of this License. But first, please read
.
ColorCode-0.8.7/build_cmake/ 0000755 0001750 0001750 00000000000 14527705430 014311 5 ustar dirk dirk ColorCode-0.8.7/src/ 0000755 0001750 0001750 00000000000 14527705442 012644 5 ustar dirk dirk ColorCode-0.8.7/src/buttonscell.h 0000644 0001750 0001750 00000001421 12610736534 015346 0 ustar dirk dirk #ifndef BUTTONSCELL_H
#define BUTTONSCELL_H
#include
#include
#include "cellbtn.h"
class ButtonsCell : public QWidget
{
Q_OBJECT
public:
static const int ACTIONID_NONE;
static const int ACTIONID_PLAY;
static const int ACTIONID_SAVE;
static const int ACTIONID_COPY;
static const int ACTIONID_DELETE;
ButtonsCell(QWidget* parent = 0, int hideBtn = 0);
int GetActionId();
signals:
void CellButtonClickedSignal();
protected slots:
void ButtonClickedSlot();
private:
CellBtn *mDeleteBtn;
CellBtn *mPlayBtn;
CellBtn *mSaveBtn;
CellBtn *mCopyBtn;
QList mButtonsList;
int mActionId;
};
#endif // BUTTONSCELL_H
ColorCode-0.8.7/src/changelog 0000644 0001750 0001750 00000016677 14526106236 014532 0 ustar dirk dirk * 0.8.6 released, October 18, 2015
* Summary
- small refactoring to build with mingw for windows
* 0.8.5 released, October 18, 2015
* Summary
- first feature complete QT 5 version of ColorCode
- adjustments to compile and run with QT 5
* 0.7.2 released, March 18, 2011
* Summary
- pause/resume a game
- copy game numbers to clipboard
- redesigned preferences dialog
- some new settings options like cutomized table row highlight colors and the possibility
to hide hundredth and tenth of seconds
- some minor bug fixes
- this is the latest QT 4 version of ColorCode
* 0.7.1 released, February 17, 2011
* Summary
- bookmark a game after the game has been finished (bug fix)
* 0.7.0 released, February 16, 2011
* Summary
- threads, game timer, game numbers, highscores, game lists
- some refactoring and minor bug fixes
* Threads
- solver and timer got separate threads to keep the user interface
responsive even under heavy load
* Game Timer
- takes and displays elapsed game time
* Highscores
- time and game setting will be taken into account
* Game Numbers
- this enables you to play the very same game at different computers at any time
* Game Lists
- dialog for highscores, favorites and previous games,
you may select any of the games listed and play those again
or you may start a game by arbitrary number input
* Settings options
- games lists and highscore related settings
- if you're afraid to remember a game by number, you may hide the game number
displayed at the bottom
- you may hide the timer to keep calm ;-)
* Translation
- czech tarnslation updated - thanks to Pavel Fric
- french tarnslation updated - thanks to Filippo Rusconi
- added hungarian translation (unfinished yet) - thanks to Németh Gábor
- added spanish translation (unfinished yet) - thanks to Marcos del Puerto García
* 0.6.1 released, February 16, 2010
* Translation
- Added french translation - thanks to Filippo Rusconi.
* 0.6.0 released, February 14, 2010
* Summary
- Second game mode (Computer vs. Human)
- Preferences dialog for persistent settings
- Additional settings options
* Preferences dialog
- To examine all available settings options, a preferences dialog has been introduced.
- The chosen preferences/settings are now persistent, so when starting the application,
the last used settings are applied.
* Settings options
- Game modes (Human vs Computer or Computer versus Human)
- To get a fair chance you may select a weaker solver strength level for your computer
opponent ;-)
- Let an impartial part :-) of your computer determine the corresponding hints for the
computer's guess. This option affects only Computer vs. Human games. If checked, you
only have to place your secret combination. Then the rest of the game runs automatically
until the end.
- To better watch your computer trying hard to break your code, you may
define a timeout between the guesses
- Select letters or numbers as text indicators and - if convenient - do
not use colors as indicators at all - but it's still ColorCode ;-)
* Layout/Design
- Some minor changes and new buttons for the second game mode.
* 0.5.5 released, October 31, 2009
* Summary
- Accessibility and usability improvements
* Settings options
- For the color sensitive of us ;-) the posibility to change the color order by drag and drop
has been added.
- Press CTRL while dragging to flip two colors or CTRL+SHIFT to cyclic shift the color order.
You can do this even while a game is running - the whole existing display will change.
- New 'Reset Color Order' option in the settings menu to revert your changes.
- Also - and more important - for the more text aimed a settings option has been added,
to toggle the display of letter indicators for the different peg colors.
- Make the documentations page accessible from the game's help menu.
* Layout/Design
- Some minor changes.
* 0.5 released, October 21, 2009
* Summary
- The number of columns in the game is now customizable. The column count can be any number
from 2 untill 5.
- Updated translation files
* Solver
- Changed how the solver determines the first guess. Also - for the following really calculated
guesses - if the number of possibilities is very high (mostly at the early phase of a 10 colors/
5 columns game) the solver will automatically fallback to a weaker algorithm until the number
of possibilities has been narrowed, to reduce calculating time
* Layout/Design
- Some minor changes to handle the variable number of columns. Added toolbar controls to enable
the change of all level related settings here. The statusbar now permanently shows the current
game's settings.
* 0.4 released, October 7, 2009
* Summary
- The GUI has been changed completely and the Usability was improved by adding some keyboard
shortcuts for often needed interactions.
- Added czech translation. Thanks to Pavel Fric.
* Fixes
- To avoid those 'QGraphicsItem::ungrabMouse: not a mouse grabber' warnings emit the mouse event
only if the hint button hasn't been disabled just before ...
* License
- The License had been changed from the GPL v2 to GPL v3.
* Layout/Design
- Complete Change, so all paint methods had to be changed and optimized. The background is now
drawn by its own class, no more brushed metall background image anymore.
* 0.3 released, September 26, 2009
* Summary
- Introduced a rather perfect MasterMind solver. It will watch any move you take and any hints
you have gotten, so you can at any time in a running game let your computer guess for you.
Of course you can change or discard it's suggestion :-) .
* Solver
- The solver has 3 built in levels of stregth. For the suggestions, currently only the most
powerfull is used. For the first guess it will use a reasonable random guess based on pre-
calculated combinations to reduce computation time.
* Layout/Design
- Make the solver's guess action accessible at the toolbar.
* 0.2 released, September 10, 2009
* Summary
- Added 3 levels of difficulty (Easy, Medium, Hard) based on the possibility to change the
available number of colors for a game. You can play games with 6, 8 or 10 colors.
* Layout/Design
- Added a combo-box (select) control to the toolbar, to easily access the level (color count)
settings.
- Enable hiding the menubar, toolbar and statusbar.
- Changed to a centered layout (message display and game board).
* 0.1 released, September 6, 2009
* Summary
- This is the initial release of ColorCode, a free MasterMind clone. Try to guess a combination
of 8 colors within at most 10 guesses.
- You may allow or not pegs of the same color. You can fill the rows by random or duplicate
a previous one.
* GUI
- English and German translations are available.
ColorCode-0.8.7/src/gamenodisplay.h 0000644 0001750 0001750 00000002212 12610736534 015643 0 ustar dirk dirk /* ColorCode, a free MasterMind clone with built in solver
* Copyright (C) 2009 Dirk Laebisch
* http://www.laebisch.com/
*
* ColorCode 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 3 of the License, or
* (at your option) any later version.
*
* ColorCode 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 ColorCode. If not, see .
*/
#ifndef GAMENODISPLAY_H
#define GAMENODISPLAY_H
#include
#include
#include
#include
class GameNoDisplay : public QGraphicsTextItem
{
Q_OBJECT
public:
GameNoDisplay(QGraphicsItem* parent = 0);
void ShowStr(QString str);
private:
QFont mFont;
QRectF mUpdateRect;
};
#endif // GAMENODISPLAY_H
ColorCode-0.8.7/src/gametablesdialog.cpp 0000644 0001750 0001750 00000043564 14526106236 016643 0 ustar dirk dirk /* ColorCode, a free MasterMind clone with built in solver
* Copyright (C) 2009 Dirk Laebisch
* http://www.laebisch.com/
*
* ColorCode 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 3 of the License, or
* (at your option) any later version.
*
* ColorCode 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 ColorCode. If not, see .
*/
#include "gametablesdialog.h"
#include "ui_gametablesdialog.h"
#include "gametableview.h"
#include "highscoresmodel.h"
#include "prevgamesmodel.h"
#include "savedgamesmodel.h"
#include "buttondelegate.h"
#include "ccsolver.h"
#include "ccgame.h"
#include "settings.h"
const int GameTablesDialog::TABIX_INPUT = 0;
const int GameTablesDialog::TABIX_PREVIOUS = 1;
const int GameTablesDialog::TABIX_BOOKMARKS = 2;
const int GameTablesDialog::TABIX_HIGHSCORES = 3;
GameTablesDialog::GameTablesDialog(QWidget* parent, Qt::WindowFlags f) : QDialog(parent, f), ui(new Ui::GameTablesDialog)
{
ui->setupUi(this);
Init();
}
GameTablesDialog::~GameTablesDialog()
{
delete ui;
}
void GameTablesDialog::Init()
{
setModal(true);
setMouseTracking(true);
setAttribute(Qt::WA_Hover, true);
setAttribute(Qt::WA_AlwaysShowToolTips, true);
mLastGameProperties = NULL;
ui->mDescriptionTe->setFocusPolicy(Qt::NoFocus);
ui->mDescriptionTe->setAttribute(Qt::WA_TransparentForMouseEvents);
ui->mDescriptionTe->setText(tr("Insert an arbitrary game number greater than 0 in the input field above.
"
"The game properties like color count, slot count etc. will be displayed in the corresponding area above.
"
"Click the Play button or press key Enter, to play the game. If a game is currently running, it will be aborted."));
ui->mGameNoLe->setValidator(new QIntValidator(1, INT_MAX, this));
connect(ui->mGameNoLe, SIGNAL(textChanged(const QString)), this, SLOT(GameNoInpChangedSlot(const QString)));
mPrevTableView = new GameTableView();
mPrevTableView->SetGamesListModel(GetPrevGamesModel());
mPrevTableView->setColumnWidth(GetPrevGamesModel()->GetColIx(GamesListModel::COL_RANKING), 20);
mPrevTableView->setColumnWidth(GetPrevGamesModel()->GetColIx(GamesListModel::COL_DATE), 90);
mPrevTableView->setColumnWidth(GetPrevGamesModel()->GetColIx(GamesListModel::COL_TIME), 90);
mPrevTableView->setColumnWidth(GetPrevGamesModel()->GetColIx(GamesListModel::COL_DELETE), 40);
mPrevTableView->setItemDelegateForColumn(GetPrevGamesModel()->GetColIx(GamesListModel::COL_RANKING), new ButtonDelegate());
mPrevTableView->setItemDelegateForColumn(GetPrevGamesModel()->GetColIx(GamesListModel::COL_DATE), new ButtonDelegate());
mPrevTableView->setItemDelegateForColumn(GetPrevGamesModel()->GetColIx(GamesListModel::COL_TIME), new ButtonDelegate());
mPrevTableView->setItemDelegateForColumn(GetPrevGamesModel()->GetColIx(GamesListModel::COL_DELETE), new ButtonDelegate());
GetPrevGamesModel()->SetView(mPrevTableView);
ui->mPrevTab->layout()->addWidget(mPrevTableView);
connect(mPrevTableView, SIGNAL(HoverRowSignal(int)), this, SLOT(HoverRowSlot(int)));
connect(GetPrevGamesModel(), SIGNAL(CloseEditorSignal(QModelIndex)), mPrevTableView, SLOT(CloseEditorSlot(QModelIndex)));
connect(GetPrevGamesModel(), SIGNAL(NewGameInputSignal(CCGame*)), this, SLOT(NewGameInputSlot(CCGame*)));
mSavedTableView = new GameTableView();
mSavedTableView->SetGamesListModel(GetSavedGamesModel());
mSavedTableView->setColumnWidth(GetSavedGamesModel()->GetColIx(GamesListModel::COL_GAMENO), 70);
mSavedTableView->setColumnWidth(GetSavedGamesModel()->GetColIx(GamesListModel::COL_CCNT), 50);
mSavedTableView->setColumnWidth(GetSavedGamesModel()->GetColIx(GamesListModel::COL_PCNT), 50);
mSavedTableView->setColumnWidth(GetSavedGamesModel()->GetColIx(GamesListModel::COL_DOUBLES), 30);
mSavedTableView->setColumnWidth(GetSavedGamesModel()->GetColIx(GamesListModel::COL_DELETE), 40);
mSavedTableView->setItemDelegateForColumn(GetSavedGamesModel()->GetColIx(GamesListModel::COL_GAMENO), new ButtonDelegate());
mSavedTableView->setItemDelegateForColumn(GetSavedGamesModel()->GetColIx(GamesListModel::COL_CCNT), new ButtonDelegate());
mSavedTableView->setItemDelegateForColumn(GetSavedGamesModel()->GetColIx(GamesListModel::COL_PCNT), new ButtonDelegate());
mSavedTableView->setItemDelegateForColumn(GetSavedGamesModel()->GetColIx(GamesListModel::COL_DOUBLES), new ButtonDelegate());
mSavedTableView->setItemDelegateForColumn(GetSavedGamesModel()->GetColIx(GamesListModel::COL_DELETE), new ButtonDelegate());
GetSavedGamesModel()->SetView(mSavedTableView);
ui->mSavedTab->layout()->addWidget(mSavedTableView);
connect(mSavedTableView, SIGNAL(HoverRowSignal(int)), this, SLOT(HoverRowSlot(int)));
connect(GetSavedGamesModel(), SIGNAL(CloseEditorSignal(QModelIndex)), mSavedTableView, SLOT(CloseEditorSlot(QModelIndex)));
connect(GetSavedGamesModel(), SIGNAL(NewGameInputSignal(CCGame*)), this, SLOT(NewGameInputSlot(CCGame*)));
mHighTableView = new GameTableView();
mHighTableView->SetGamesListModel(GetHighScoresModel());
mHighTableView->setColumnWidth(GetHighScoresModel()->GetColIx(GamesListModel::COL_RANKING), 20);
mHighTableView->setColumnWidth(GetHighScoresModel()->GetColIx(GamesListModel::COL_SCORE), 60);
mHighTableView->setColumnWidth(GetHighScoresModel()->GetColIx(GamesListModel::COL_USERNAME), 120);
mHighTableView->setColumnWidth(GetHighScoresModel()->GetColIx(GamesListModel::COL_DELETE), 40);
mHighTableView->setItemDelegateForColumn(GetHighScoresModel()->GetColIx(GamesListModel::COL_RANKING), new ButtonDelegate());
mHighTableView->setItemDelegateForColumn(GetHighScoresModel()->GetColIx(GamesListModel::COL_SCORE), new ButtonDelegate());
mHighTableView->setItemDelegateForColumn(GetHighScoresModel()->GetColIx(GamesListModel::COL_USERNAME), new ButtonDelegate());
mHighTableView->setItemDelegateForColumn(GetHighScoresModel()->GetColIx(GamesListModel::COL_DELETE), new ButtonDelegate());
GetHighScoresModel()->SetView(mHighTableView);
ui->mHighTab->layout()->addWidget(mHighTableView);
connect(mHighTableView, SIGNAL(HoverRowSignal(int)), this, SLOT(HoverRowSlot(int)));
connect(GetHighScoresModel(), SIGNAL(CloseEditorSignal(QModelIndex)), mHighTableView, SLOT(CloseEditorSlot(QModelIndex)));
connect(GetHighScoresModel(), SIGNAL(NewGameInputSignal(CCGame*)), this, SLOT(NewGameInputSlot(CCGame*)));
connect(GetHighScoresModel(), SIGNAL(ValidNameCommitSignal()), this, SLOT(ValidNameCommitSlot()));
connect(GetPrevGamesModel(), SIGNAL(SaveListGameSignal(CCGame*)), this, SLOT(InsertSavedGameSlot(CCGame*)));
connect(GetHighScoresModel(), SIGNAL(SaveListGameSignal(CCGame*)), this, SLOT(InsertSavedGameSlot(CCGame*)));
connect(ui->mTabsWidget, SIGNAL(currentChanged(int)), this, SLOT(CurrentTabChanged(int)));
connect(ui->mCloseBtn, SIGNAL(clicked()), this, SLOT(OkBtnSlot()));
connect(ui->mClearBtn, SIGNAL(clicked()), this, SLOT(ClearListSlot()));
connect(ui->mPlayBtn, SIGNAL(clicked()), this, SLOT(PlayInputSlot()));
}
void GameTablesDialog::ShowTab(int tabix)
{
if (ui->mTabsWidget->currentIndex() != tabix)
{
ui->mTabsWidget->setCurrentIndex(tabix);
}
else
{
CurrentTabChanged(tabix);
}
show();
}
void GameTablesDialog::ShowInputSlot()
{
ShowTab(TABIX_INPUT);
}
void GameTablesDialog::ShowPrevSlot()
{
ShowTab(TABIX_PREVIOUS);
}
void GameTablesDialog::ShowSavedSlot()
{
ShowTab(TABIX_BOOKMARKS);
}
void GameTablesDialog::ShowHighSlot()
{
ShowTab(TABIX_HIGHSCORES);
}
void GameTablesDialog::HoverRowSlot(const int row)
{
if (row > -1)
{
GamesListModel* glm = GetCurModel();
if (glm != NULL)
{
SetGameProperties(glm->GetGameAt(row));
}
else
{
SetGameProperties(NULL);
}
}
else
{
SetGameProperties(NULL);
}
}
GamesListModel* GameTablesDialog::GetCurModel() const
{
GamesListModel* glm;
int ix = ui->mTabsWidget->currentIndex();
if (ix == TABIX_PREVIOUS)
{
glm = qobject_cast(GetPrevGamesModel());
}
else if (ix == TABIX_BOOKMARKS)
{
glm = qobject_cast(GetSavedGamesModel());
}
else if (ix == TABIX_HIGHSCORES)
{
glm = qobject_cast(GetHighScoresModel());
}
else
{
glm = NULL;
}
return glm;
}
GameTableView* GameTablesDialog::GetCurView() const
{
GameTableView* gtv;
int ix = ui->mTabsWidget->currentIndex();
if (ix == TABIX_PREVIOUS)
{
gtv = qobject_cast(mPrevTableView);
}
else if (ix == TABIX_BOOKMARKS)
{
gtv = qobject_cast(mSavedTableView);
}
else if (ix == TABIX_HIGHSCORES)
{
gtv = qobject_cast(mHighTableView);
}
else
{
gtv = NULL;
}
return gtv;
}
void GameTablesDialog::SetGameProperties(const CCGame* g)
{
if (g != NULL && g->IsValidGame())
{
if (mLastGameProperties == NULL || mLastGameProperties != g)
{
mLastGameProperties = const_cast(g);
int ix = ui->mTabsWidget->currentIndex();
switch (ix)
{
case TABIX_PREVIOUS:
case TABIX_BOOKMARKS:
ui->mUserValLbl->setText("");
ui->mDurationValLbl->setText("");
ui->mDateValLbl->setText(g->GetDateTimeStr());
break;
case TABIX_HIGHSCORES:
ui->mUserValLbl->setText(g->GetCCUserName());
ui->mDurationValLbl->setText(FormatDuration(g->mDuration));
ui->mDateValLbl->setText(g->GetDateTimeStr());
break;
case TABIX_INPUT:
ui->mDateValLbl->setText("");
break;
}
ui->mColorCntValLbl->setText(QString::number(g->mColorCnt));
ui->mPegCntValLbl->setText(QString::number(g->mPegCnt));
QString str = (g->mDoubles == 1) ? tr("Yes") : tr("No");
ui->mDoublesValLbl->setText(str);
ui->mGameNoValLbl->setText(QString::number(g->mGameNo));
}
}
else
{
mLastGameProperties = NULL;
ui->mUserValLbl->setText("");
ui->mColorCntValLbl->setText("");
ui->mPegCntValLbl->setText("");
ui->mDoublesValLbl->setText("");
ui->mGameNoValLbl->setText("");
ui->mDateValLbl->setText("");
ui->mDurationValLbl->setText("");
}
}
QString GameTablesDialog::FormatDuration(const uint dur) const
{
QTime t(0, 0, 0, 0);
t = t.addMSecs(int(dur));
QString tstr = QString("%1 : %2 : %3 : %4").arg( t.toString("hh"), t.toString("mm"), t.toString("ss"), t.toString("zzz"));
return tstr;
}
void GameTablesDialog::ReadSettingsGamesSlot()
{
SetSettingsSlot();
GetPrevGamesModel()->ReadList(GetSettings()->mPrevGamesStr);
GetSavedGamesModel()->ReadList(GetSettings()->mSavedGamesStr);
GetHighScoresModel()->ReadList(GetSettings()->mHighGamesStr);
clearFocus();
}
void GameTablesDialog::SetSettingsSlot()
{
GetPrevGamesModel()->SetMaxSize(GetSettings()->mGamesListMaxCnt);
GetSavedGamesModel()->SetMaxSize(GetSettings()->mGamesListMaxCnt);
GetHighScoresModel()->SetMaxSize(GetSettings()->mGamesListMaxCnt);
GetPrevGamesModel()->SetRowHColors(GetSettings()->GetActiveRowHFg(), GetSettings()->GetActiveRowHBg());
GetSavedGamesModel()->SetRowHColors(GetSettings()->GetActiveRowHFg(), GetSettings()->GetActiveRowHBg());
GetHighScoresModel()->SetRowHColors(GetSettings()->GetActiveRowHFg(), GetSettings()->GetActiveRowHBg());
}
void GameTablesDialog::InsertHighScoreSlot(CCGame* g)
{
if (GetSettings()->mHighScoreHandling == Settings::HIGHSCORE_NO)
{
return;
}
if (GetHighScoresModel()->IsValidHighScore(g->mScore))
{
CCGame game = *g;
game.SetUserName(GetSettings()->mHighScoreUserName);
if (GetSettings()->mHighScoreHandling != Settings::HIGHSCORE_AUTO || GetSettings()->mHighScoreUserName == "")
{
ShowTab(GameTablesDialog::TABIX_HIGHSCORES);
}
GetHighScoresModel()->InsertRow(game);
}
}
void GameTablesDialog::InsertPrevGameSlot(CCGame* g)
{
CCGame game = *g;
game.Anonymize();
GetPrevGamesModel()->InsertRow(game);
}
void GameTablesDialog::InsertSavedGameSlot(CCGame* g)
{
CCGame game = *g;
game.Anonymize();
game.mTime = QDateTime::currentDateTime().toTime_t();
GetSavedGamesModel()->InsertRow(game);
}
void GameTablesDialog::OkBtnSlot()
{
close();
}
void GameTablesDialog::ClearListSlot()
{
GamesListModel* glm = GetCurModel();
if (glm == NULL)
{
return;
}
int rcnt = glm->rowCount();
if (rcnt <= 0)
{
return;
}
int r = QMessageBox::warning( this,
tr("Message"),
tr("This will permanently remove all entries from the List.\nDo You want to proceed?"),
QMessageBox::Yes | QMessageBox::No,
QMessageBox::Yes);
if (r == QMessageBox::Yes)
{
rcnt = glm->rowCount();
if (rcnt > 0)
{
glm->removeRows(0, rcnt);
}
}
}
void GameTablesDialog::PlayInputSlot()
{
if (ui->mTabsWidget->currentIndex() == TABIX_INPUT
&& ui->mGameNoLe->text() != "")
{
uint gameno = ui->mGameNoLe->text().toUInt();
if (gameno > 0)
{
const int* props = ColorCode::INSTANCE->GetCCSolver()->GetGameByNo(gameno);
CCGame* g = new CCGame("", 0, 0, gameno, 0, 0, 0, ColorCode::MODE_HVM, props[1], props[2], props[3]);
NewGameInputSlot(g);
}
}
}
void GameTablesDialog::GameNoInpChangedSlot(const QString &txt)
{
if (txt != "" && txt.toUInt() > 0)
{
const int* props = ColorCode::INSTANCE->GetCCSolver()->GetGameByNo(txt.toUInt());
CCGame* g = new CCGame("", 0, 0, txt.toUInt(), 0, 0, 0, ColorCode::MODE_HVM, props[1], props[2], props[3]);
SetGameProperties(g);
}
else
{
SetGameProperties(NULL);
}
}
void GameTablesDialog::NewGameInputSlot(CCGame* g)
{
emit NewGameInputSignal(g);
close();
}
void GameTablesDialog::ValidNameCommitSlot()
{
if (ui->mTabsWidget->currentIndex() == TABIX_HIGHSCORES)
{
ui->mCloseBtn->setFocus();
}
}
void GameTablesDialog::SetRowHeight()
{
for (int i = 0; i < GetHighScoresModel()->rowCount(); ++i)
{
mHighTableView->setRowHeight(i, 18);
}
}
void GameTablesDialog::CurrentTabChanged(int ix)
{
mLastGameProperties = NULL;
SetGameProperties(NULL);
QString str = "";
QIcon ico;
switch (ix)
{
case TABIX_INPUT:
ui->mPlayBtn->setVisible(true);
ui->mClearBtn->setVisible(false);
ui->mGameNoLe->setFocus();
ui->mUserLbl->setEnabled(false);
ui->mDurationLbl->setEnabled(false);
ui->mDateLbl->setEnabled(false);
GameNoInpChangedSlot(ui->mGameNoLe->text());
str = tr("Game Number Input");
ico = QIcon(":/img/document-new.png");
break;
case TABIX_PREVIOUS:
ui->mPlayBtn->setVisible(false);
ui->mClearBtn->setVisible(true);
ui->mUserLbl->setEnabled(false);
ui->mDurationLbl->setEnabled(false);
ui->mDateLbl->setEnabled(true);
str = tr("Recent Games");
ico = QIcon(":/img/history.png");
break;
case TABIX_BOOKMARKS:
ui->mPlayBtn->setVisible(false);
ui->mClearBtn->setVisible(true);
ui->mUserLbl->setEnabled(false);
ui->mDurationLbl->setEnabled(false);
ui->mDateLbl->setEnabled(true);
str = tr("Bookmarked Games");
ico = QIcon(":/img/bookmark.png");
break;
case TABIX_HIGHSCORES:
ui->mPlayBtn->setVisible(false);
ui->mClearBtn->setVisible(true);
ui->mUserLbl->setEnabled(true);
ui->mDurationLbl->setEnabled(true);
ui->mDateLbl->setEnabled(true);
str = tr("High Score List");
ico = QIcon(":/img/games-highscores.png");
break;
default:
str = tr("Game Lists");
break;
}
setWindowTitle(str);
setWindowIcon(ico);
}
void GameTablesDialog::closeEvent(QCloseEvent* e)
{
GetHighScoresModel()->EditField();
if (GetHighScoresModel()->GetEditIndex().isValid() && GetHighScoresModel()->GetEditValue() == "")
{
e->ignore();
int r = QMessageBox::warning( this,
tr("Message"),
tr("Please provide a name!\nOtherwise your score won't be saved."),
QMessageBox::Ok | QMessageBox::Discard,
QMessageBox::Ok);
if (r == QMessageBox::Discard)
{
GetHighScoresModel()->removeRows(GetHighScoresModel()->GetEditIndex().row(), 1);
e->accept();
}
else
{
GetHighScoresModel()->EditField();
}
}
else
{
GetHighScoresModel()->SetEditIndex(QModelIndex());
e->accept();
}
}
void GameTablesDialog::reject()
{
close();
}
void GameTablesDialog::changeEvent(QEvent *e)
{
QDialog::changeEvent(e);
switch (e->type())
{
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
ColorCode-0.8.7/src/settings.h 0000644 0001750 0001750 00000005531 12610736534 014656 0 ustar dirk dirk /* ColorCode, a free MasterMind clone with built in solver
* Copyright (C) 2009 Dirk Laebisch
* http://www.laebisch.com/
*
* ColorCode 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 3 of the License, or
* (at your option) any later version.
*
* ColorCode 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 ColorCode. If not, see .
*/
#ifndef SETTINGS_H
#define SETTINGS_H
#include
#include
#include "ccgame.h"
class Settings : public QObject
{
Q_OBJECT
public:
Settings();
~Settings();
static const int INDICATOR_LETTER;
static const int INDICATOR_NUMBER;
static const int DEF_COLOR_CNT;
static const int DEF_PEG_CNT;
static const int DEF_DOUBLES;
static const int DEF_LIST_MAX_CNT;
static const int HIGHSCORE_NO;
static const int HIGHSCORE_PROMPT;
static const int HIGHSCORE_AUTO;
static const int MAX_LENGTH_USERNAME;
void Init();
void InitSettings();
void ReadSettings();
void Validate();
void SaveLastSettings();
void RestoreLastSettings();
void RestoreDefSettings();
void WriteSettings();
QMap GetDefaultsMap() const;
CCGame* GetCurSettingsGame() const;
QString GetActiveRowHFg() const;
QString GetActiveRowHBg() const;
QSettings mSettings;
bool mShowToolBar;
bool mShowMenuBar;
bool mShowStatusBar;
bool mShowTimer;
bool mShowTenth;
bool mShowGameNo;
bool mShowIndicators;
int mIndicatorType;
bool mHideColors;
bool mCustomRowHColor;
QString mRowHColorFg;
QString mRowHColorBg;
int mPegCnt;
int mColorCnt;
bool mDoubles;
int mGameMode;
bool mAutoClose;
bool mAutoHints;
int mSolverStrength;
int mHintsDelay;
QString mPrevGamesStr;
QString mSavedGamesStr;
QString mHighGamesStr;
int mGamesListMaxCnt;
int mHighScoreHandling;
QString mHighScoreUserName;
public slots:
signals:
void ReadSettingsGamesDone();
private:
void RestoreSettingsMap(QMap &map);
void SaveSettingsMap(QMap &map);
QMap mDefMap;
QMap mLastMap;
};
Settings* GetSettings();
#endif // SETTINGS_H
ColorCode-0.8.7/src/timedisplay.cpp 0000644 0001750 0001750 00000010003 14525377062 015667 0 ustar dirk dirk /* ColorCode, a free MasterMind clone with built in solver
* Copyright (C) 2009 Dirk Laebisch
* http://www.laebisch.com/
*
* ColorCode 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 3 of the License, or
* (at your option) any later version.
*
* ColorCode 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 ColorCode. If not, see .
*/
#include
#include "timedisplay.h"
#include "gametimer.h"
TimeDisplay::TimeDisplay(QGraphicsItem* parent) : QGraphicsTextItem(parent)
{
setAcceptedMouseButtons(Qt::NoButton);
setAcceptHoverEvents(false);
mFont = QFont("Arial", 18, QFont::Normal, false);
mFont.setStyleHint(QFont::SansSerif);
mFont.setPixelSize(24);
setFont(mFont);
setDefaultTextColor(QColor("#d7d8da"));
mShowTenth = true;
mSs = mLastSs = "";
mHs = "";
mInterval = 50;
mPaused = false;
mStopped = true;
mGameTime = 0;
mTime = 0;
mTimer = new GameTimer(this);
connect(mTimer, SIGNAL(TimeOutSignal(int)), this, SLOT(DisplayTime(int)));
mTimer->Start();
setTextWidth(440);
setScale(0.5);
}
TimeDisplay::~TimeDisplay()
{
}
int TimeDisplay::GetGameTime() const
{
return mGameTime;
}
bool TimeDisplay::IsActive() const
{
return (!mPaused && !mStopped);
}
bool TimeDisplay::IsPaused() const
{
return mPaused;
}
bool TimeDisplay::IsStopped() const
{
return mPaused;
}
void TimeDisplay::SetTenth(bool b)
{
mShowTenth = b;
}
void TimeDisplay::StartT()
{
mTime = 0;
mT0.start();
DisplayTime();
mPaused = false;
mStopped = false;
}
void TimeDisplay::PauseT()
{
if (!mStopped && !mPaused)
{
mTime += mT0.restart();
DisplayTime();
mPaused = true;
}
}
void TimeDisplay::ResumeT()
{
if (mPaused && !mStopped)
{
mT0.restart();
mPaused = false;
}
}
void TimeDisplay::StopT()
{
if (!mStopped && !mPaused)
{
mTime += mT0.restart();
DisplayTime();
mStopped = true;
mPaused = false;
mTime = 0;
}
}
void TimeDisplay::DisplayTime(int tick)
{
if (mPaused || mStopped || !mT0.isValid())
{
return;
}
mGameTime = mT0.elapsed() + mTime;
mT1 = QTime(0, 0, 0, 0);
mT1 = mT1.addMSecs(mGameTime);
if (mShowTenth)
{
if (tick == 0)
{
mHs = QString::number((int)(mT1.msec()/10));
}
else
{
mHs = QString::number(((int)(mT1.msec()/50))*5);
}
if (mHs.length() < 2)
{
mHs.prepend("0");
}
}
if (isVisible())
{
QString tstr;
if (!mShowTenth)
{
mSs = mT1.toString("ss");
if (mSs == mLastSs)
{
return;
}
tstr = QString("
").arg( mT1.toString("hh"), mT1.toString("mm"), mT1.toString("ss"), mHs);
}
setHtml(tstr);
}
}
ColorCode-0.8.7/src/solutionrow.cpp 0000644 0001750 0001750 00000005436 12610736534 015761 0 ustar dirk dirk /* ColorCode, a free MasterMind clone with built in solver
* Copyright (C) 2009 Dirk Laebisch
* http://www.laebisch.com/
*
* ColorCode 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 3 of the License, or
* (at your option) any later version.
*
* ColorCode 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 ColorCode. If not, see .
*/
#include
#include "solutionrow.h"
using namespace std;
SolutionRow::SolutionRow(QObject*)
{
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
InitGraphics();
}
SolutionRow::~SolutionRow()
{
}
void SolutionRow::InitGraphics()
{
mRect = QRectF(0.5, 0.5, 219, 39);
mRectC = QRectF(2, 2, 216, 36);
QLinearGradient solgrad(0, 0, 0, 40);
solgrad.setColorAt(0.0, QColor("#9fa0a2"));
solgrad.setColorAt(1.0, QColor("#8c8d8f"));
mBgBrush = QBrush(solgrad);
QLinearGradient framegrad(0, 0, 0, 40);
framegrad.setColorAt(0.0, QColor("#4e4f51"));
framegrad.setColorAt(1.0, QColor("#ebecee"));
mFramePen = QPen(QBrush(framegrad), 1);
mFont = QFont("Arial", 22, QFont::Bold, false);
mFont.setStyleHint(QFont::SansSerif);
mFont.setPixelSize(29);
}
void SolutionRow::SetXOffs()
{
mXOffs = 110 - mPegCnt * 20;
}
QRectF SolutionRow::boundingRect() const
{
const double margin = 0.5;
return mRect.adjusted(-margin, -margin, 2 * margin, 2 * margin);
}
void SolutionRow::paint(QPainter *painter, const QStyleOptionGraphicsItem* , QWidget* )
{
if (mPegCnt == 0)
{
return;
}
int i;
painter->setBrush(mBgBrush);
painter->setPen(mFramePen);
painter->drawRoundedRect(mRect, 20, 20);
QPainterPath cpath;
cpath.addRoundedRect(mRectC, 19, 19);
painter->setClipPath(cpath);
painter->setRenderHint(QPainter::TextAntialiasing, true);
int x0 = (220 - mPegCnt * 40) / 2;
int xpos;
for (i = 0; i <= mPegCnt; ++i)
{
xpos = x0 + i * 40;
painter->setPen(Qt::NoPen);
painter->setBrush(QBrush(QColor(0x7d, 0x7e, 0x80, 0x80)));
painter->drawRect(xpos - 1, 1, 1, 38);
painter->setBrush(QBrush(QColor(0xc3, 0xc4, 0xc6, 0x80)));
painter->drawRect(xpos, 1, 1, 38);
if (i < mPegCnt)
{
painter->setPen(QPen(QColor("#ff9933")));
painter->setFont(mFont);
painter->drawText(QRectF(xpos + 3.0, 3.0, 34.0, 34.0), Qt::AlignCenter, QString('?'));
}
}
}
ColorCode-0.8.7/src/trans_cs.ts 0000644 0001750 0001750 00000113376 14527465645 015053 0 ustar dirk dirk
About&Author&Autoriconikona&License&PovoleníA needful game to train your brain ;-)Hra potřebná pro udržení bdělosti <br>vašeho mozku :-)ColorCodeColorCodeAbout ColorCodeO ColorCode<br><br>Free MasterMind clone including a built in,<br>rather intelligent solver.<br><br>Klon Free MasterMind s vestavěným<br>dost schopným řešitelem - počítačem.VersionVerzeAuthorAutorThis 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 3 of the License, or (at your option) any later version.Tento program je svobodným. Můžete jej šířit a/nebo upravovat za podmínek GNU General Public License, jak jsou zveřejněny Free Software Foundation, buď podle verze 3 licence nebo (podle své volby) podle jakékoli pozdější verze.ButtonsCellPlay this Game againPřehrát tuto hru znovuSave this Game as BookmarkUložit tuto hru jako záložkuRemove from ListOdstranit ze seznamuCopy Game Number to ClipboardKopírovat číslo hry do schránkyColorCodeNew GameNová hraDo you want to give in
and start a new Game?Chcete vzdát hru
a začít novou?About QtO Qt&New Game&Nová hraCtrl+NCtrl+N&Restart Game&Začít hru znovuCtrl+RCtrl+RE&xit&UkončitCtrl+QCtrl+QCtrl+TCtrl+TCtrl+CCtrl+CCtrl+ACtrl+AAbout &QtO &Qt&Game&Hra&Settings&Nastavení&Help&NápovědaGameHraMessageHlášeníThe changed settings will only apply to new games!
Do you want to give in the current and start a new Game?Změny v nastavení se projeví teprve po novém spuštění hry!
Chcete vzdát nynější hru a začít novou?Place Your pegs ...Umístěte své kameny...Congratulation! You have won!Blahopřejeme! Vyhrál jste!Sorry! You lost!Promiňte, ale nezvládl jste to!Ctrl+ICtrl+IGive InVzdát seDo you really want to give in?Skutečně chcete hru vzdát?&Throw In The Towel&Vhodit ručníkCtrl+GCtrl+GSure, You're too weak for me!Je jasné, že jste pro mě příliš slabý!Ctrl+Shift+RCtrl+Shift+RCtrl+Shift+CCtrl+Shift+CFill Row by RandomNaplnit řádek náhodněDuplicate Previous RowZdvojit předchozí řádekCtrl+DCtrl+DClear RowVyprázdnit řádek&Row&ŘádekColorCodeColorCodeAbout &ColorCodeO &ColorCodeCtrl+MCtrl+MShow ToolbarUkázat nástrojový pruhShow MenubarUkázat pruh s hlavní nabídkouShow StatusbarUkázat stavový pruhAllow Pegs of the Same ColorPovolit kameny se stejnou barvouLevelStupeň obtížnostiComputer's GuessNechat počítač hádatCtrl+HCtrl+HPress the Hint Field or Key Enter if You're done.Pokud jste hotov, klepněte na pole s radou.Disallow Pegs of the Same ColorZákázat kameny stejné barvyClose Rows when the last Peg is placedZavřít řádky po umístění posledního kameneCtrl+LCtrl+LBeginner (2 Colors, 2 Slots, Doubles)Začátečník (2 barvy, 2 pole, zdvojení)Easy (4 Colors, 3 Slots, No Doubles)Lehká hra (4 barvy, 3 pole, bez zdvojení)Classic (6 Colors, 4 Slots, Doubles)Klasická hra (6 barev, 4 pole, zdvojení)Challenging (8 Colors, 4 Slots, Doubles)Náročná hra (8 barev, 4 pole, zdvojení)Hard (10 Colors, 5 Slots, Doubles)Těžká hra (10 barev, 5 polí, zdvojení)Level PresetsPřednastavení stupně obtížnostiColorsbarevPegs of Same ColorKameny téže barvySlotspoleYesAnoNoNeReset Color OrderZnovu nastavit pořadí barevCtrl+Shift+LCtrl+Shift+LOnline &Help&Nápověda po internetuF1F1DoneHotovoCtrl+Shift+NCtrl+Shift+NRate it for meOhodnoť to pro měHuman vs ComputerČlověk proti počítačiComputer vs HumanPočítač proti člověkuGame ModeHerní režimPress the button below or Key Enter if You're done.Pokud jste hotov, použijte tlačítko dole nebo klávesu Enter.Place Your secret ColorCode ...Umístěte svůj tajný ColorCode...Please rate the guess. Press OK or Key Enter if You're done.Ohodnoťte, prosím, můj návrh. Pokud jste hotov, použijte tlačítko OK nebo klávesu Enter.The impossible happened, sorry.Bohužel se stalo nemožné.Yeah! I guessed it, man!Jo! Já to tušil!Embarrassing! I lost a game!Trapné! Já tu hru ztratil!Nope! Thats impossible! Did you gave me false hints?Ne! To není možné! Dal jste mi špatné rady?Don't you like to see me winning? ;-)Nelíbí se vám, když vyhrávám? :-)Set Hints automaticallyNastavit rady automatickyCtrl+Shift+HCtrl+Shift+HPreferencesNastaveníCtrl+PCtrl+PShow IndicatorsUkázat ukazateleThe chosen settings do not allow pegs of the same color!Zvolená nastavení nedovolují kameny stejné barvy.&Start particular Game&Spustit zvláštní hru&Bookmark current GamePřidat nynější hru do &záložekCtrl+BCtrl+BCtrl+Alt+HCtrl+Shift+H&Recent Games&Nedávné hryCtrl+Alt+RCtrl+Alt+R&Bookmarks&ZáložkyCtrl+Alt+BCtrl+Alt+BCtrl+Shift+SCtrl+Shift+SGame &Lists&Seznamyguessed and rated ...Uhádnuté a hodnocené...Let me think ...Nech mě přemýšlet...Computer vs. HumanČlověk proti počítači&Highscores&Nejlepší výsledkyCtrl+Shift+BCtrl+Shift+BCtrl+Alt+NCtrl+Alt+N&Have a Break&Přestávka na přemýšlení&Bookmark Current GamePřidat nynější hru do &záložekCtrl+Shift+TCtrl+Shift+TShow TimerUkázat časomíruDisplay Game NumberZobrazit číslo hryAllow Pegs of Same ColorPovolit kameny téže barvyDisallow Pegs of Same ColorZákázat kameny stejné barvyCtrl+Alt+CCtrl+Alt+CCtrl+Shift+PCtrl+Shift+P&Resume Game&Pokračovat ve hřeHuman vs. ComputerČlověk proti počítačiGame NumberČíslo hryPausedPozastaveno&Copy Game Number&Kopírovat číslo hryGameNoDisplayHuman vs. ComputerČlověk proti počítačiGame NumberČíslo hryGameTablesDialogColorCode GamesHry ColorCodeGame PropertiesVlastnosti hryUserUživatelColor CountPočet barevSlot CountPočet políPegs of Same ColorKameny téže barvyYesAnoGame NumberČíslo hryDate and TimeDatum a časDurationDoba trváníInsert Game NumberVložit číslo hryPlayPřehrátRecent GamesNedávné hryBookmarksZáložkyHighscoresNejlepší výsledkyClear ListSmazat seznamCloseZavřítNoNeMessageHlášeníThis will permanently remove all entries from the List.
Do You want to proceed?Tímto budou všechny záznamy trvale odstraněny ze seznamu.
Chcete pokračovat?Game Number InputZadání čísla hryBookmarked GamesHry přidané do záložekHigh Score ListSeznam nejlepších výsledkůPlease provide a name!
Otherwise your score won't be saved.Poskytněte, prosím, název!
V opačném případě váš výsledek nebude uložen.Insert an arbitrary game number greater than 0 in the input field above. <br><br>The game properties like color count, slot count etc. will be displayed in the corresponding area above.<br><br>Click the Play button or press key Enter, to play the game. If a game is currently running, it will be aborted.Vložte do zadávacího pole výše libovolné číslo hry větší než 0. <br><br>Vlastnosti hry, jako jsou počet barev, počet polí atd., budou zobrazeny v odpovídající oblasti výše. <br><br>Klepněte na tlačítko Přehrát nebo stiskněte klávesu Enter, aby se hra začala přehrávat. Pokud hra již běží, bude zrušena.Game ListsSeznamyGamesListModelYesAnoNoNePegs of Same ColorKameny téže barvyActionsČinnostiRankHodnostUserUživatelScoreVýsledekDateDatumTimeČasColorsBarvySlotsPoleGame No.Číslo hryPrefDialog... Select from predefined level settings... Vybrat stupeň obtížnostiBeginner (2 Colors, 2 Slots, Doubles)Začátečník (2 barvy, 2 pole, zdvojení)Easy (4 Colors, 3 Slots, No Doubles)Lehká hra (4 barvy, 3 pole, bez zdvojení)Classic (6 Colors, 4 Slots, Doubles)Klasická hra (6 barev, 4 pole, zdvojení)Challenging (8 Colors, 4 Slots, Doubles)Náročná hra (8 barev, 4 pole, zdvojení)Hard (10 Colors, 5 Slots, Doubles)Těžká hra (10 barev, 5 polí, zdvojení)SlotspoleColorsbarevHuman vs. ComputerČlověk proti počítačiComputer vs. HumanČlověk proti počítačiLowNízkáMediumStředníHighVysokáPreferencesNastaveníAppearanceVzhledControlsOvládací prvkyShow or hide the Menubar.Ukázat nebo skrýt pruh s hlavní nabídkou.Show MenubarUkázat pruh s hlavní nabídkouShow or hide the Toolbar.Ukázat nebo skrýt nástrojový pruh.Show ToolbarUkázat nástrojový pruhShow or hide the Statusbar.Ukázat nebo skrýt stavový pruh.Show StatusbarUkázat stavový pruhIndicatorsUkazateléIf this option is checked, an indicator
inside each peg is displayed.Když je zapnuta tato volba, je u každého
kamene zobrazen dodatečný ukazatel.Show Indicators inside pegsUkázat dodatečné ukazatele pro kamenyUse unique letters as indicators.Použít písmena jako ukazatele.Letter IndicatorsPísmenní ukazateléUse unique numbers as indicators.Použít čísla jako ukazatele.Number IndicatorsČíselní ukazateléUse the same neutral background color for each peg,
when indicators are shown.Pro všechny kameny použít, v případě že jsou zobrazováni ukazatelé,
stejnou nenápadnou barvu pozadí.Hide ColorsSkrýt barvyClick here if you have changed the color order
and now you want to revert it to it's initial state. Klepněte sem, pokud jste změnil pořadí barev,
a nyní to chcete vrátit do počátečního stavu.Reset Color OrderZnovu nastavit pořadí barevGame SettingsHerní nastaveníLevel PresetsPřednastavení stupně obtížnostiSelect from predefined combinations
of the three different level related settings,
the number of colors, the number of slots (columns)
and the possibility of pegs of the same color in one row. Vyberte z přednastavených spojení tří různých
nastavení souvisejících se stupni obtížnosti:
počet barev, počet polí (sloupců) a možnost
kamenů stejné barvy v jednom řádku.Number of SlotsPočet políNumber of ColorsPočet barevNumber of pegs in a single row.
Higher values are harder to guess.Počet kamenů v jednom řádku.
Vyšší hodnoty je těžší uhodnout.Number of all possible colors.
Higher values are harder to guess.Celkový počet všech možných barev.
Vyšší hodnoty je těžší uhodnout.If this option is checked, the hidden combination
may contain one or more (even all would be possible)
pegs of the same color.
If checked, the combination is generally harder to guess.Když je zapnuta tato volba, skryté spojení může
obsahovat jeden nebo více kamenů stejné barvy
(dokonce je možné, že všechny).
Je-li zaškrtnuto, je spojení obecně obtížněji uhodnutelné.Allow Pegs of Same ColorPovolit kameny téže barvyGame ModeHerní režimSelect from the different game modes.
In the 1. mode you have to to guess the hidden,
computer generated combination,
In the 2. mode your computer will try to guess your
own secret combination.Vyberte z různých herních režimů.
V prvním režimu musíte uhodnout skryté,
počítačem vytvořené spojení.
Ve druhém režimu se počítač pokusí uhodnout
vaše vlastní tajné spojení.If checked, a row is closed as soon as you place the last peg
and your guess is submitted immediatly.
This option only affects the Human vs. Computer game mode.Když je zapnuta tato volba, je řádek uzavřen, jakmile umístíte poslední kámen
a váš herní tah je okamžitě vyhodnocen.
Tato volba účinkuje pouze v herním režimu, kdy hraje člověk proti počítači.Close Rows when the last Peg is placedZavřít řádky po umístění posledního kameneIf checked, the computer will determine the corresponding hints for the solver's guess.
This option affects only Computer vs. Human games.
If checked, you only have to place your secret combination.
Then the rest of the game runs automatically until the end.
But you can set a delay between the guesses.Je-li zapnuta tato volba, budou automaticky vyplněna pole s odpovídajícími radami pro odhad řešitele - počítače.
Tato volba účinkuje pouze při hře počítače proti člověku.
Je-li zaškrtnuta, musíte pouze umístit své tajné spojení.
Pak běží zbytek hry automaticky až do konce.
Ovšem mezi herními tahy můžete nastavit zpoždění.Set Hints automaticallyNastavit rady automatickyAdjust the delay (in ms) between two guesses.Upravit zpoždění v milisekundách mezi dvěma herními tahy.Delay in msZpoždění v msSolver StrengthSíla počítačeSelect from 3 different strength levels for your computer opponent.
This option only affects the Computer vs. Human game mode.
For the computer's guess in the Human vs. Computer mode
always the highest level will be used.Vyberte jednu ze tří různých herních sil pro vašeho počítačového protivníka.
Tato volba účinkuje pouze v herním režimu, kdy hraje počítač proti člověku.
Pro počítačův herní tah v režimu, kdy hraje člověk proti počítači se vždy použije
nejvyšší úroveň herní síly.Show Game TimerUkázat herní časomíruDisplay Game NumberZobrazit číslo hryGame ListsSeznamyMaximum Row Count: Největší počet řádků: Use HighscoresPoužít nejlepší výsledkyRaise the dialog after a game has been won and prompt for the nameVyvolat dialog poté, co hra byla vyhrána, a pobídnout k napsání jménaAutomatically insert Highscores using the name belowAutomaticky vložit nejlepší výsledky a přitom použít jméno nížeName (mandatory for the second option)Jméno (povinné pro druhou volbu)User InterfaceUživatelské rozhraníDisplay the current game number in the footer.
To avoid remembering, you can hide it here.Zobrazit číslo současné hry v zápatí.
Můžete je nechat zde, abyste si je nemusel pamatovat.TimerČasomíraYou may hide the timer to keep calm ;-)
But note! Even hidden, time's running in the background.Můžete skrýt časomíru, abyste byl víc v klidu. :-)
Ale uvědomte si, že i když bude skrytá, čas pořád poběží na pozadí.Game PropertiesVlastnosti hrySelect One of the Level Presets:Vybrat jedno z přednastavení hry:Or Set the Particular Properties:Nebo nastavit zvláštní vlastnosti:Game FlowTok hrySolverPočítačLimit the number of rows in game tables like highscores etc.
Valid values range from 5 to 50.Omezit počet řádků v tabulkách ke hře, jako jsou nejlepší výsledky atd.
Rozsah použitelných hodnot je od 5 do 50 řádků.Use Customized Table Row Highlight ColorsPoužít uživatelsky stanovené barvy pro zvýraznění řádků v tabulkáchForegroundPopředíBackgroundPozadíHighscoresNejlepší výsledkyProvide a name with maximum 20 characters here
to be used for highscore entries.
If you checked the automatic option above, this name
is mandatory, otherwise it will be used as proposal
which you may change later in the dialog.Zde napište název, který bude mít nejvíc 20 znaků,
který se použije pro záznamy v nejlepších výsledcích.
Pokud jste zaškrtli automatickou volbu výše, je tento název
povinný, v opačném případě se použije jako návrh, jejž můžete
později změnit.Uncheck this if you are confused about the time as fast running ;-)Pokud by vás ukazatel času měl zneklidňovat, zrušte zaškrtnutí této volbyShow Tenth and HundredthUkázat desetiny a setiny sekundRowHintCommit Your solutionVyzkoušet své řešeníClick the circles to rate my guess.
Hit Ctrl+H or the corresponding toolbar button to let an impartial part of me do this for you ;-)Klepněte na kruhy pro vyhodnocení mého herního tahu.
Stiskněte Ctrl+H nebo odpovídající tlačítko v nástrojovém pruhu, abyste přenesl onu záležitost s vyhodnocením na tu moji část, která je v tomto případě zcela nestranná. :-)
ColorCode-0.8.7/src/graphicsbtn.h 0000644 0001750 0001750 00000004262 12610736534 015322 0 ustar dirk dirk /* ColorCode, a free MasterMind clone with built in solver
* Copyright (C) 2009 Dirk Laebisch
* http://www.laebisch.com/
*
* ColorCode 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 3 of the License, or
* (at your option) any later version.
*
* ColorCode 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 ColorCode. If not, see .
*/
#ifndef GRAPHICSBTN_H
#define GRAPHICSBTN_H
#include
#include
#include
#include
#include
#include
#include
class GraphicsBtn : public QObject, public QGraphicsItem
{
Q_OBJECT
Q_INTERFACES(QGraphicsItem)
public:
GraphicsBtn();
void SetEnabled(bool b);
void SetWidth(int w);
void SetLabel(QString str);
void ShowBtn(bool b);
void SetStatesOpacity(const qreal opOver, const qreal opOut);
void InvertStates();
void SetHoverState();
void SetOutState();
void SetPressedState();
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
QRectF boundingRect() const;
signals:
void BtnPressSignal(GraphicsBtn* btn);
protected:
void hoverEnterEvent(QGraphicsSceneHoverEvent* e);
void hoverLeaveEvent(QGraphicsSceneHoverEvent* e);
void mousePressEvent(QGraphicsSceneMouseEvent* e);
void mouseReleaseEvent(QGraphicsSceneMouseEvent* e);
virtual void InitGraphics();
virtual void SetShapes();
QString mLabel;
int mWidth;
int mLabelWidth;
int mYOffs;
qreal mOpOver;
qreal mOpOut;
QRectF mRect;
QRectF mRectFill;
QRectF mIconRect;
QBrush mFillOutBrush;
QBrush mFillOverBrush;
QBrush* mFillBrush;
QBrush mFrameOutBrush;
QBrush mFrameOverBrush;
QBrush* mFrameBrush;
QFont mFont;
};
#endif // GRAPHICSBTN_H
ColorCode-0.8.7/src/CMakeLists.txt 0000644 0001750 0001750 00000004362 14527704234 015407 0 ustar dirk dirk cmake_minimum_required(VERSION 3.5.0)
project(colorcode VERSION 0.8.7 LANGUAGES CXX)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
find_package(Qt5 COMPONENTS Core REQUIRED)
find_package(Qt5 COMPONENTS Gui REQUIRED)
find_package(Qt5 COMPONENTS Widgets REQUIRED)
find_package(Qt5 COMPONENTS LinguistTools REQUIRED)
set(QMDIR "${CMAKE_CURRENT_BINARY_DIR}/.qm")
file(MAKE_DIRECTORY ${QMDIR})
set(TS_FILES
trans_de.ts
trans_en.ts
trans_cs.ts
trans_fr.ts
trans_hu.ts
trans_es.ts
)
set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION ${QMDIR})
qt5_add_translation(QMFILES ${TS_FILES})
set(QMRESFILE "${QMDIR}/cmake_translations.qrc")
file(WRITE ${QMRESFILE} "\n\n")
foreach(QMFILE ${QMFILES})
file(RELATIVE_PATH QMFILE_NAME ${QMDIR} ${QMFILE})
file(APPEND ${QMRESFILE} " ${QMFILE}\n")
endforeach(QMFILE)
file(APPEND ${QMRESFILE} "\n\n")
qt_add_resources(TRANSRES ${QMRESFILE})
qt5_wrap_ui(UIS_HDRS
about.ui
prefdialog.ui
gametablesdialog.ui
)
add_executable(colorcode
${TRANSRES}
${UIS_HDRS}
about.cpp
colorcode.cpp
colorpeg.cpp
main.cpp
msg.cpp
pegrow.cpp
rowhint.cpp
ccsolver.cpp
background.cpp
solutionrow.cpp
graphicsbtn.cpp
settings.cpp
prefdialog.cpp
pegfactory.cpp
gamenodisplay.cpp
timedisplay.cpp
timedisplaybg.cpp
highscore.cpp
ccgame.cpp
buttonscell.cpp
buttondelegate.cpp
cellbtn.cpp
gametimer.cpp
savedgamesmodel.cpp
prevgamesmodel.cpp
highscoresmodel.cpp
gametableview.cpp
gametablesdialog.cpp
gameslistmodel.cpp
docs/GPL.html
resource.qrc
)
target_link_libraries(colorcode
Qt5::Widgets
Qt5::Gui
Qt5::Core
)
target_compile_options(colorcode
BEFORE
PUBLIC
-pipe
-O3
-Wall
-Wextra
-D_REENTRANT
-fPIC
)
# target_compile_options(colorcode PUBLIC -O3)
ColorCode-0.8.7/src/rowhint.h 0000644 0001750 0001750 00000003734 12610736534 014513 0 ustar dirk dirk /* ColorCode, a free MasterMind clone with built in solver
* Copyright (C) 2009 Dirk Laebisch
* http://www.laebisch.com/
*
* ColorCode 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 3 of the License, or
* (at your option) any later version.
*
* ColorCode 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 ColorCode. If not, see .
*/
#ifndef ROWHINT_H
#define ROWHINT_H
#include
#include
#include
#include
#include
#include
#include "colorcode.h"
class RowHint : public QObject, public QGraphicsItem
{
Q_OBJECT
Q_INTERFACES(QGraphicsItem)
public:
RowHint(QObject* parent = 0);
~RowHint();
int mIx;
bool mActive;
bool mSolved;
std::vector mHints;
int GetIx() const;
bool IsActive() const;
std::vector GetHints();
void SetIx(const int ix);
void SetPegCnt(const int pegcnt);
void SetGameMode(const int gamemode);
void SetActive(bool b);
void SetPaused(const bool b);
void DrawHints(std::vector res);
void Reset(const int pegcnt, const int gamemode);
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
QRectF boundingRect() const;
QPainterPath shape() const;
signals:
void HintPressedSignal(int ix);
protected:
void mousePressEvent(QGraphicsSceneMouseEvent* e);
private:
static const int mPegPos[4][5][3];
int mPegCnt;
int mGameMode;
QPen mPen;
QBrush mBrush0;
QBrush mBrush1;
QRectF outlineRect() const;
};
#endif // ROWHINT_H
ColorCode-0.8.7/src/pegrow.h 0000644 0001750 0001750 00000004335 12610736534 014322 0 ustar dirk dirk /* ColorCode, a free MasterMind clone with built in solver
* Copyright (C) 2009 Dirk Laebisch
* http://www.laebisch.com/
*
* ColorCode 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 3 of the License, or
* (at your option) any later version.
*
* ColorCode 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 ColorCode. If not, see .
*/
#ifndef PEGROW_H
#define PEGROW_H
#include
#include
#include
#include
#include
#include
#include
#include "colorcode.h"
class ColorPeg;
class PegRow : public QObject, public QGraphicsItem
{
Q_OBJECT
Q_INTERFACES(QGraphicsItem)
public:
PegRow(QObject* parent = 0);
~PegRow();
int GetIx() const;
bool IsActive() const;
int GetPegCnt() const;
ColorPeg** GetPegs();
std::vector GetSolution() const;
void SetIx(const int ix);
void SetPegCnt(const int pegcnt);
void SetGameMode(const int gamemode);
void SetActive(const bool b);
bool SnapCP(ColorPeg* cp);
void ForceSnap(ColorPeg* cp, int posix);
void RemovePeg(ColorPeg* cp);
void CloseRow();
void OpenRow();
void ClearRow();
void Reset(const int pegcnt, const int gamemode);
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
QRectF boundingRect() const;
QPainterPath shape() const;
signals:
void RowSolutionSignal(int ix);
void RemovePegSignal(ColorPeg* cp);
protected:
std::vector mSolution;
QColor mPend;
QColor mPenl;
QColor mGrad0;
QColor mGrad1;
bool mIsActive;
bool mSolved;
int mIx;
int mPegCnt;
int mGameMode;
int mXOffs;
virtual void SetXOffs();
void CheckSolution();
ColorPeg** mColorPegs;
QRectF outlineRect() const;
};
#endif // PEGROW_H
ColorCode-0.8.7/src/prefdialog.ui 0000644 0001750 0001750 00000101642 12610736534 015320 0 ustar dirk dirk
PrefDialogQt::ApplicationModal00476527Preferences:/img/configure.png:/img/configure.pngtrue0User InterfaceIndicators00If this option is checked, an indicator
inside each peg is displayed.Show Indicators inside pegsQt::HorizontalQSizePolicy::Fixed2020Use unique letters as indicators.Letter IndicatorstrueQt::Horizontal4020Use unique numbers as indicators.Number IndicatorsQt::Horizontal27620Use the same neutral background color for each peg,
when indicators are shown.Hide ColorsQt::Horizontal3102000Click here if you have changed the color order
and now you want to revert it to it's initial state. Reset Color OrdertrueControls00Show or hide the Menubar.Show Menubar00Show or hide the Toolbar.Show Toolbar00Show or hide the Statusbar.Show StatusbarQt::HorizontalQSizePolicy::Fixed7020Qt::Horizontal4020Display the current game number in the footer.
To avoid remembering, you can hide it here.Display Game NumberTimer00You may hide the timer to keep calm ;-)
But note! Even hidden, time's running in the background.Show Game TimerQt::HorizontalQSizePolicy::Fixed2020Uncheck this if you are confused about the time as fast running ;-)Show Tenth and HundredthQt::Horizontal24520Qt::Vertical2040Game SettingsGame PropertiesSelect One of the Level Presets:Select from predefined combinations
of the three different level related settings,
the number of colors, the number of slots (columns)
and the possibility of pegs of the same color in one row. Or Set the Particular Properties:Number of pegs in a single row.
Higher values are harder to guess.Number of SlotsNumber of all possible colors.
Higher values are harder to guess.Number of ColorsIf this option is checked, the hidden combination
may contain one or more (even all would be possible)
pegs of the same color.
If checked, the combination is generally harder to guess.Allow Pegs of Same ColorQt::Horizontal4020Qt::Horizontal4020Qt::Horizontal4020Qt::VerticalQSizePolicy::Fixed2010Game Flow00If checked, a row is closed as soon as you place the last peg
and your guess is submitted immediatly.
This option only affects the Human vs. Computer game mode.Close Rows when the last Peg is placed00If checked, the computer will determine the corresponding hints for the solver's guess.
This option affects only Computer vs. Human games.
If checked, you only have to place your secret combination.
Then the rest of the game runs automatically until the end.
But you can set a delay between the guesses.Set Hints automatically00Adjust the delay (in ms) between two guesses.Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenterDelay in msQt::Horizontal4020SolverSelect from 3 different strength levels for your computer opponent.
This option only affects the Computer vs. Human game mode.
For the computer's guess in the Human vs. Computer mode
always the highest level will be used.Qt::Horizontal4020Solver StrengthGame ModeSelect from the different game modes.
In the 1. mode you have to to guess the hidden,
computer generated combination,
In the 2. mode your computer will try to guess your
own secret combination.Qt::Horizontal4020Qt::Vertical2040Game ListsGame ListsMaximum Row Count: Limit the number of rows in game tables like highscores etc.
Valid values range from 5 to 50.Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter550515Qt::Horizontal4020Use Customized Table Row Highlight ColorsQt::HorizontalQSizePolicy::Fixed20200024242424falseForeground0024242424falseBackgroundQt::Horizontal4020HighscoresUse HighscoresQt::HorizontalQSizePolicy::Fixed2020Raise the dialog after a game has been won and prompt for the nametrueAutomatically insert Highscores using the name belowQt::Horizontal02000Provide a name with maximum 20 characters here
to be used for highscore entries.
If you checked the automatic option above, this name
is mandatory, otherwise it will be used as proposal
which you may change later in the dialog.20Name (mandatory for the second option)Qt::Horizontal8121Qt::Horizontal4020Qt::Vertical2040Qt::HorizontalQDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::RestoreDefaults1010truetruetrue
ColorCode-0.8.7/src/cellbtn.cpp 0000644 0001750 0001750 00000001623 12610736534 014772 0 ustar dirk dirk /* ColorCode, a free MasterMind clone with built in solver
* Copyright (C) 2009 Dirk Laebisch
* http://www.laebisch.com/
*
* ColorCode 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 3 of the License, or
* (at your option) any later version.
*
* ColorCode 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 ColorCode. If not, see .
*/
#include "cellbtn.h"
CellBtn::CellBtn(QWidget *parent) : QToolButton(parent)
{
setMouseTracking(true);
setAttribute(Qt::WA_Hover, true);
}
ColorCode-0.8.7/src/ccgame.cpp 0000644 0001750 0001750 00000011761 14526106236 014570 0 ustar dirk dirk /* ColorCode, a free MasterMind clone with built in solver
* Copyright (C) 2009 Dirk Laebisch
* http://www.laebisch.com/
*
* ColorCode 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 3 of the License, or
* (at your option) any later version.
*
* ColorCode 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 ColorCode. If not, see .
*/
#include "ccgame.h"
#include "settings.h"
using namespace std;
CCGame::CCGame()
{
mUserNm = "";
mTime = 0;
mScore = 0;
mGameNo = 0;
mGuessCnt = 0;
mHintCnt = 0;
mDuration = 0;
mColorCnt = 0;
mPegCnt = 0;
mDoubles = 0;
mGameMode = ColorCode::MODE_HVM;
}
CCGame::CCGame(const QString &str)
{
QStringList fields = str.split(QString("|"));
if (fields.size() == 11)
{
SetUserName(QUrl::fromPercentEncoding(fields.at(0).toUtf8()));
bool ok;
mTime = fields.at(1).toInt(&ok);
mScore = fields.at(2).toInt(&ok);
mGameNo = fields.at(3).toUInt(&ok);
mGuessCnt = fields.at(4).toInt(&ok);
mHintCnt = fields.at(5).toInt(&ok);
mDuration = fields.at(6).toUInt(&ok);
mGameMode = fields.at(7).toInt(&ok);
mColorCnt = fields.at(8).toInt(&ok);
mPegCnt = fields.at(9).toInt(&ok);
mDoubles = fields.at(10).toInt(&ok);
}
else
{
mUserNm = "";
mTime = 0;
mScore = 0;
mGameNo = 0;
mGuessCnt = 0;
mHintCnt = 0;
mDuration = 0;
mGameMode = ColorCode::MODE_HVM;
mColorCnt = 0;
mPegCnt = 0;
mDoubles = 0;
}
}
CCGame::CCGame(const QString &unm, const uint t, const int sc, const uint gameno, const int gcnt, const int hcnt, const uint dur, const int gmode, const int ccnt, const int pcnt, const int d)
{
mUserNm = unm;
mTime = t;
mScore = sc;
mGameNo = gameno;
mGuessCnt = gcnt;
mHintCnt = hcnt;
mDuration = dur;
mGameMode = gmode;
mColorCnt = ccnt;
mPegCnt = pcnt;
mDoubles = d;
}
bool CCGame::operator==(const CCGame &other) const
{
return ( GetCCUserName() == other.GetCCUserName()
&& mTime == other.mTime
&& mScore == other.mScore
&& mGameNo == other.mGameNo
&& mGuessCnt == other.mGuessCnt
&& mHintCnt == other.mHintCnt
&& mDuration == other.mDuration
&& mGameMode == other.mGameMode
&& mColorCnt == other.mColorCnt
&& mPegCnt == other.mPegCnt
&& mDoubles == other.mDoubles );
}
bool CCGame::operator!=(const CCGame &other) const
{
return !(*this == other);
}
QString CCGame::GetCCUserName() const
{
return mUserNm;
}
void CCGame::SetUserName(QString unm)
{
QRegExp rx("[^\\S ]+");
unm.replace(rx, "");
unm = unm.trimmed();
unm.truncate(Settings::MAX_LENGTH_USERNAME);
mUserNm = unm;
}
uint CCGame::GetTime() const
{
return mTime;
}
int CCGame::GetScore() const
{
return mScore;
}
QString CCGame::GetDatePartStr() const
{
return QDateTime::fromTime_t(mTime).date().toString(Qt::ISODate);
}
QString CCGame::GetTimePartStr() const
{
return QDateTime::fromTime_t(mTime).time().toString(Qt::ISODate);
}
QString CCGame::GetDateTimeStr() const
{
return QDateTime::fromTime_t(mTime).toString(Qt::TextDate);
}
QString CCGame::GetCmbStr() const
{
return QString::number(mGameNo) + QString(" (") + QString::number(mDoubles) + QString("|") + QString::number(mPegCnt) + QString("|") + QString::number(mColorCnt) + QString(") ") + GetDateTimeStr();
}
void CCGame::Anonymize()
{
SetUserName("");
mHintCnt = mGuessCnt = mDuration = mScore = 0;
}
QString CCGame::ToString() const
{
QStringList slist = QStringList();
slist << QString(QUrl::toPercentEncoding(mUserNm));
slist << QString::number(mTime);
slist << QString::number(mScore);
slist << QString::number(mGameNo);
slist << QString::number(mGuessCnt);
slist << QString::number(mHintCnt);
slist << QString::number(mDuration);
slist << QString::number(mGameMode);
slist << QString::number(mColorCnt);
slist << QString::number(mPegCnt);
slist << QString::number(mDoubles);
return slist.join("|");
}
bool CCGame::HasSameSettings(const CCGame &g) const
{
return (mGameNo == g.mGameNo && mColorCnt == g.mColorCnt && mPegCnt == g.mPegCnt && mDoubles == g.mDoubles);
}
bool CCGame::IsValidGame() const
{
return ( mGameNo > 0
&& mColorCnt >= ColorCode::MIN_COLOR_CNT && mColorCnt <= ColorCode::MAX_COLOR_CNT
&& mPegCnt >= 2 && mPegCnt <= 5
&& (mDoubles == 1 || mDoubles == 0) );
}
ColorCode-0.8.7/src/pegrow.cpp 0000644 0001750 0001750 00000016330 14524754364 014662 0 ustar dirk dirk /* ColorCode, a free MasterMind clone with built in solver
* Copyright (C) 2009 Dirk Laebisch
* http://www.laebisch.com/
*
* ColorCode 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 3 of the License, or
* (at your option) any later version.
*
* ColorCode 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 ColorCode. If not, see .
*/
#include
#include "colorpeg.h"
#include "pegrow.h"
#include "rowhint.h"
using namespace std;
PegRow::PegRow(QObject*)
{
setAcceptedMouseButtons(Qt::NoButton);
mIx = -1;
mPegCnt = 0;
mXOffs = 0;
mPend = QColor("#646568");
mPenl = QColor("#ecedef");
mGrad0 = QColor("#cccdcf");
mGrad1 = QColor("#fcfdff");
mColorPegs = NULL;
Reset(0, 0);
}
PegRow::~PegRow()
{
for (int i = 0; i < mPegCnt; ++i)
{
delete mColorPegs[i];
}
delete [] mColorPegs;
mColorPegs = NULL;
}
bool PegRow::IsActive() const
{
return mIsActive;
}
void PegRow::Reset(const int pegcnt, const int gamemode)
{
ClearRow();
mSolution.clear();
SetActive(false);
mSolved = false;
SetPegCnt(pegcnt);
SetGameMode(gamemode);
}
void PegRow::ClearRow()
{
if (mColorPegs == NULL) { return; };
for (int i = 0; i < mPegCnt; ++i)
{
if (mColorPegs[i] != NULL)
{
emit(RemovePegSignal(mColorPegs[i]));
}
}
}
int PegRow::GetIx() const
{
return mIx;
}
void PegRow::SetIx(const int ix)
{
mIx = ix;
}
void PegRow::SetPegCnt(const int pegcnt)
{
ClearRow();
for (int i = 0; i < mPegCnt; ++i)
{
delete mColorPegs[i];
}
delete [] mColorPegs;
mColorPegs = NULL;
mPegCnt = pegcnt;
mColorPegs = new ColorPeg* [mPegCnt];
for (int i = 0; i < mPegCnt; ++i)
{
mColorPegs[i] = NULL;
}
SetXOffs();
}
void PegRow::SetGameMode(const int gamemode)
{
mGameMode = gamemode;
}
void PegRow::SetXOffs()
{
mXOffs = 100 - mPegCnt * 20;
}
int PegRow::GetPegCnt() const
{
if (mColorPegs == NULL) { return 0; };
int cnt = 0;
int i = 0;
for (i = 0; i < mPegCnt; ++i)
{
if (mColorPegs[i] != NULL)
{
++cnt;
}
}
return cnt;
}
ColorPeg** PegRow::GetPegs()
{
return mColorPegs;
}
void PegRow::SetActive(const bool b)
{
mIsActive = b;
update(boundingRect());
}
bool PegRow::SnapCP(ColorPeg *cp)
{
if (mColorPegs == NULL)
{
return false;
}
bool snapped = false;
if (mIsActive)
{
QPointF p = mapFromParent(cp->pos());
p.rx() += 18;
p.ry() += 18;
int ix = -1;
int i;
if (p.y() >= 0 && p.y() <= 40)
{
for (i = 0; i < mPegCnt; ++i)
{
if (p.x() >= mXOffs + i * 40 && p.x() < mXOffs + (i + 1) * 40)
{
if (mColorPegs[i] != NULL)
{
emit RemovePegSignal(mColorPegs[i]);
mColorPegs[i] = NULL;
}
mColorPegs[i] = cp;
cp->SetPegRow(this);
ix = i;
cp->setPos(mapToParent(mXOffs + i * 40 + 2, 2));
break;
}
}
}
snapped = ix > -1;
CheckSolution();
}
return snapped;
}
void PegRow::ForceSnap(ColorPeg* cp, int posix)
{
if (mColorPegs == NULL)
{
return;
}
if (posix > mPegCnt - 1)
{
return;
}
if (mIsActive)
{
if (mColorPegs[posix] != NULL)
{
emit RemovePegSignal(mColorPegs[posix]);
mColorPegs[posix] = NULL;
}
mColorPegs[posix] = cp;
cp->setSelected(false);
cp->SetPegRow(this);
cp->setPos(mapToParent(mXOffs + posix * 40 + 2, 2));
CheckSolution();
}
}
void PegRow::CloseRow()
{
mSolved = true;
if (mColorPegs == NULL)
{
;
}
else
{
for (int i = 0; i < mPegCnt; ++i)
{
if (mColorPegs[i] != NULL)
{
mColorPegs[i]->SetEnabled(false);
}
}
}
SetActive(false);
}
void PegRow::OpenRow()
{
mSolved = false;
if (mColorPegs == NULL)
{
;
}
else
{
for (int i = 0; i < mPegCnt; ++i)
{
if (mColorPegs[i] != NULL)
{
mColorPegs[i]->SetEnabled(true);
}
}
}
SetActive(true);
}
void PegRow::CheckSolution()
{
mSolution.clear();
if (mColorPegs == NULL)
{
;
}
else
{
for (int i = 0; i < mPegCnt; ++i)
{
if (mColorPegs[i] != NULL)
{
mSolution.push_back(mColorPegs[i]->GetPegType()->ix);
}
}
}
emit RowSolutionSignal(mIx);
}
std::vector PegRow::GetSolution() const
{
return mSolution;
}
void PegRow::RemovePeg(ColorPeg *cp)
{
if (mColorPegs == NULL)
{
return;
}
for (int i = 0; i < mPegCnt; ++i)
{
if (mColorPegs[i] == cp)
{
mColorPegs[i] = NULL;
if (mIsActive)
{
CheckSolution();
}
}
}
}
QPainterPath PegRow::shape() const
{
QPainterPath path;
path.addRect(boundingRect());
return path;
}
QRectF PegRow::boundingRect() const
{
const int Margin = 1;
return outlineRect().adjusted(-Margin, -Margin, +Margin, +Margin);
}
QRectF PegRow::outlineRect() const
{
return QRectF(0.0, 0.0, 200.0, 40.0);
}
void PegRow::paint(QPainter* painter, const QStyleOptionGraphicsItem* , QWidget* )
{
if (mPegCnt == 0)
{
return;
}
painter->setRenderHint(QPainter::Antialiasing, true);
if (mIsActive)
{
mPend.setAlpha(0xff);
mPenl.setAlpha(0xff);
mGrad0.setAlpha(0xff);
mGrad1.setAlpha(0xff);
}
else if (mSolved)
{
mPend.setAlpha(0xa0);
mPenl.setAlpha(0xa0);
mGrad0.setAlpha(0xa0);
mGrad1.setAlpha(0xa0);
}
else
{
mPend.setAlpha(0x32);
mPenl.setAlpha(0x50);
mGrad0.setAlpha(0x32);
mGrad1.setAlpha(0x32);
}
painter->setPen(Qt::NoPen);
int i;
for (i = 0; i < mPegCnt; i++)
{
painter->setBrush(QBrush(mPenl));
painter->drawRect(QRectF(mXOffs + i * 40, 0.0, 39, 1));
painter->drawRect(QRectF(mXOffs + i * 40, 0.0, 1, 39));
painter->setBrush(QBrush(mPend));
painter->drawRect(QRectF(mXOffs + i * 40, 39.0, 40, 1));
painter->drawRect(QRectF(mXOffs + i * 40 + 39, 0.0, 1, 40));
QRadialGradient grad(QPointF(mXOffs + i * 40 + 10, 10), 100);
grad.setColorAt(0, mGrad0);
grad.setColorAt(1, mGrad1);
painter->setBrush(QBrush(grad));
painter->drawRect(QRectF(mXOffs + i * 40 + 1, 1.0, 38.0, 38.0));
}
}
ColorCode-0.8.7/src/trans_es.ts 0000644 0001750 0001750 00000110622 14527465645 015044 0 ustar dirk dirk
About&Author&Autoriconicono&License&LicenciaA needful game to train your brain ;-)Un juego necesario para entrenar tu cerebro ;-)ColorCodeColorCodeAbout ColorCodeAcerca de ColorCode<br><br>Free MasterMind clone including a built in,<br>rather intelligent solver.<br><br>Clon libre de Free MasterMind con un <br>solucionador bastante inteligente.VersionVersiónAuthorAutorThis 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 3 of the License, or (at your option) any later version.Este programa es software libre; lo puedes distribuir y/o modificar bajo los términos de la Licencia general pública (GPL) tal y como la publica la Free Software Foundation; ya la bien la versión 3 de la licencia, o (si se desea) cualquier versión posterior.ButtonsCellPlay this Game againSave this Game as BookmarkRemove from ListCopy Game Number to ClipboardColorCodeNew GameNuevo juegoDo you want to give in
and start a new Game?¿Quieres rendirte y
comenzar un nuevo juego?About QtAcerca de Qt&New Game&Nuevo juegoCtrl+NCtrl+N&Restart Game&Reiniciar el juegoCtrl+RCtrl+RE&xit&SalirCtrl+QCtrl+QCtrl+TCtrl+TCtrl+CCtrl+CCtrl+ACtrl+AAbout &QtAcerca de &Qt&Game&Juego&Settings&Condiguración&Help&AyudaGameJuegoMessageMensajeThe changed settings will only apply to new games!
Do you want to give in the current and start a new Game?¡Los cambies en la configuración solo tendrán efecto en las nuevas partidas!
¿Quieres abandonar la actual y comenzar una nueva partida?Place Your pegs ...Coloca las fichas ...Congratulation! You have won!¡Felicidades! ¡Has ganado!Sorry! You lost!¡Lo siento! ¡Has perdido!Ctrl+ICtrl+IGive InRendirseDo you really want to give in?¿Realmente quieres darte por vencido?&Throw In The Towel&Tirar la toallaCtrl+GCtrl+GSure, You're too weak for me!Claro, ¡Eres demasiado débil para mi!Ctrl+Shift+RCtrl+Shift+RCtrl+Shift+CCtrl+Shift+CFill Row by RandomRellenar una fila de forma aleatoriaDuplicate Previous RowDuplicar fila anteriorCtrl+DCtrl+DClear RowDespejar fila&Row&FilaColorCodeColorCodeAbout &ColorCodeAcerca de &ColorCodeCtrl+MCtrl+MShow ToolbarMostrar barra de herramientasShow MenubarMostrar barra de menusShow StatusbarMostrar barra de estadoAllow Pegs of the Same ColorPermitir fichas del mismo colorLevelNivelComputer's GuessConjetura del ordenadorCtrl+HCtrl+HPress the Hint Field or Key Enter if You're done.Pulsa el campo pista o la tecla enter si has terminado.Disallow Pegs of the Same ColorNo permitir fichas del mismo colorClose Rows when the last Peg is placedCerrar filas cuando se coloque la última fichaCtrl+LCtrl+LBeginner (2 Colors, 2 Slots, Doubles)Prinicipiante (2 Colores, 2 Ranuras, Dobles)Easy (4 Colors, 3 Slots, No Doubles)Fácil (4 Colores, 2 Ranuras, Dobles)Classic (6 Colors, 4 Slots, Doubles)Clásico (6 Colores, 4 Ranuras, Dobles)Challenging (8 Colors, 4 Slots, Doubles)Desafiante (8 Colores, 4 Ranuras, Dobles)Hard (10 Colors, 5 Slots, Doubles)Difícil (10 Colores, 5 Ranuras, Dobles)Level PresetsValores prefijados del nivelColorsColoresPegs of Same ColorFichas del mismo colorSlotsRanurasYesSíNoNoReset Color OrderResetear el orden de los coloresCtrl+Shift+LCtrl+Shift+LOnline &Help&Ayuda en líneaF1F1DoneHechoCtrl+Shift+NCtrl+Shift+NRate it for mePuntúalo por miHuman vs ComputerHumano vs OrdenadorComputer vs HumanOrdenador vs HumanoGame ModeModo de juegoPress the button below or Key Enter if You're done.Pulsa el botón a continuación o la tecla enter si has terminado.Place Your secret ColorCode ...Introduce tu código de colores secreto ...Please rate the guess. Press OK or Key Enter if You're done.Por favor, puntúe la conjetura. Pular Ok o la tecla enter una vez listo.The impossible happened, sorry.Lo imposible ha sucedido, lo siento.Yeah! I guessed it, man!¡Sii! ¡Lo adiviné!Embarrassing! I lost a game!¡Embarazoso! ¡He perdido un juego!Nope! Thats impossible! Did you gave me false hints?¡No! ¡Es imposible! ¿Me has dado indicaciones falsas?Don't you like to see me winning? ;-)¿No quieres verme ganar? ;-)Set Hints automaticallyMostar pistas automáticamenteCtrl+Shift+HCtrl+Shift+HPreferencesPreferenciasCtrl+PCtrl+PShow IndicatorsMostrar indicadoresThe chosen settings do not allow pegs of the same color!¡La configuración elegida no permite fichas del mismo color!&Start particular GameCtrl+B&HighscoresCtrl+Alt+H&Recent GamesCtrl+Alt+R&BookmarksCtrl+Alt+BCtrl+Shift+SGame &Listsguessed and rated ...Let me think ...Computer vs. HumanOrdenador vs HumanoCtrl+Shift+BCtrl+Alt+N&Have a Break&Bookmark Current GameCtrl+Shift+TShow TimerDisplay Game NumberAllow Pegs of Same ColorPermitir fichas del mismo colorDisallow Pegs of Same ColorCtrl+Alt+CCtrl+Shift+P&Resume GameHuman vs. ComputerHumano vs OrdenadorGame NumberPaused&Copy Game NumberGameNoDisplayHuman vs. ComputerHumano vs OrdenadorGameTablesDialogColorCode GamesGame PropertiesUserColor CountSlot CountPegs of Same ColorFichas del mismo colorGame NumberDate and TimeDurationInsert Game NumberPlayRecent GamesBookmarksHighscoresClear ListCloseInsert an arbitrary game number greater than 0 in the input field above. <br><br>The game properties like color count, slot count etc. will be displayed in the corresponding area above.<br><br>Click the Play button or press key Enter, to play the game. If a game is currently running, it will be aborted.YesSíNoNoMessageMensajeThis will permanently remove all entries from the List.
Do You want to proceed?Game Number InputBookmarked GamesHigh Score ListPlease provide a name!
Otherwise your score won't be saved.Game ListsGamesListModelYesSíNoNoPegs of Same ColorFichas del mismo colorActionsRankUserScoreDateTimeColorsColoresSlotsRanurasGame No.PrefDialog... Select from predefined level settings... Seleccionar de las configuraciones de niveles predefinidasBeginner (2 Colors, 2 Slots, Doubles)Prinicipiante (2 Colores, 2 Ranuras, Dobles)Easy (4 Colors, 3 Slots, No Doubles)Fácil (4 Colores, 2 Ranuras, Dobles)Classic (6 Colors, 4 Slots, Doubles)Clásico (6 Colores, 4 Ranuras, Dobles)Challenging (8 Colors, 4 Slots, Doubles)Desafiante (8 Colores, 4 Ranuras, Dobles)Hard (10 Colors, 5 Slots, Doubles)Difícil (10 Colores, 5 Ranuras, Dobles)SlotsRanurasColorsColoresHuman vs. ComputerHumano vs OrdenadorComputer vs. HumanOrdenador vs HumanoLowBajoMediumMedioHighAltoPreferencesPreferenciasAppearanceAparienciaControlsControlesShow or hide the Menubar.Mostrar o ocultar la barra de menus.Show MenubarMostrar barra de menusShow or hide the Toolbar.Mostrar o ocultar la barra de herramientas.Show ToolbarMostrar barra de herramientasShow or hide the Statusbar.Mostrar o ocultar la barra de estado.Show StatusbarMostrar barra de estadoIndicatorsIndicadoresIf this option is checked, an indicator
inside each peg is displayed.Si esta opción esta marcada, se muestra
un indicador dentro de cada ficha.Show Indicators inside pegsMostrar indicadores dentro de las fichasUse unique letters as indicators.Usar letras únicas como indicadores.Letter IndicatorsIndicadores de letraUse unique numbers as indicators.Usar números únicos como indicadores.Number IndicatorsNúmero de indicadoresUse the same neutral background color for each peg,
when indicators are shown.Usar el mismo fondo neutro por cada ficha,
cuando se muestran los indicadores.Hide ColorsOcultar coloresClick here if you have changed the color order
and now you want to revert it to it's initial state. Haz click aquí si has cambiado el orden de los colores
y ahora quieres volver al estado inicial.Reset Color OrderRestablecer orden de coloresGame SettingsConfiguración del juegoLevel PresetsValores prefijados del nivelSelect from predefined combinations
of the three different level related settings,
the number of colors, the number of slots (columns)
and the possibility of pegs of the same color in one row. Seleccionar de entra las combinaciones predefinidas
de tres niveles de configuraciones relativas al nivel,
el número de colores, el número de ranuras (columnas)
y la posibilidad de fichas del mismo color en una fila.Number of SlotsNúmero de ranurasNumber of ColorsNúmero de coloresNumber of pegs in a single row.
Higher values are harder to guess.Número de fichas en una única línea.
Los valores más altos son más difíciles de averiguar.Number of all possible colors.
Higher values are harder to guess.Número de colores posible.
Los valores más altos son más difíciles de averiguar.If this option is checked, the hidden combination
may contain one or more (even all would be possible)
pegs of the same color.
If checked, the combination is generally harder to guess.Si esta opción esta seleccionada, la combinación oculta
puede contener una o más (incluso todas sería posible)
fichas del mismo color.
Si se marca, la combinación suele ser más difícil de adivinar.Allow Pegs of Same ColorPermitir fichas del mismo colorGame ModeModo de juegoSelect from the different game modes.
In the 1. mode you have to to guess the hidden,
computer generated combination,
In the 2. mode your computer will try to guess your
own secret combination.Seleccionar de entre los distintos tipos de partidas.
En el modo 1 tienes que adivinar la combinación
oculta, generada por el ordenador,
en el modo 2 tu ordenador intentará adivinar tu
propia combinación secreta.If checked, a row is closed as soon as you place the last peg
and your guess is submitted immediatly.
This option only affects the Human vs. Computer game mode.Si se marca, una fila se cierra tan pronto como pongas la última ficha
y tu conjetura se envía inmediatamente.
Esta opción solo afecta a las partidas en modo Humano vs. Ordenador.Close Rows when the last Peg is placedCerrar filas cuando se coloque la última fichaIf checked, the computer will determine the corresponding hints for the solver's guess.
This option affects only Computer vs. Human games.
If checked, you only have to place your secret combination.
Then the rest of the game runs automatically until the end.
But you can set a delay between the guesses.Si se marca, el ordenador determinará las correspondientes pistas para la conjetura del solucionador.
Esta opción afecta sólo a las aprtidas Ordenador vs. Humano.
Si se marca, sólo tienes que fijar la combinación secreta.
Entonces el resto del juego se ejecuta automáticamente hasta el final.
Pero puedes fijar el retraso entre las conjeturas.Set Hints automaticallyMostrar pistas automáticamenteAdjust the delay (in ms) between two guesses.Ajustar el retraso (en ms) entre dos conjeturas.Delay in msRetraso en msSolver StrengthHabilidad del resolvedorSelect from 3 different strength levels for your computer opponent.
This option only affects the Computer vs. Human game mode.
For the computer's guess in the Human vs. Computer mode
always the highest level will be used.Seleccionar de entre 3 niveles distintos de dificultar para el ordendor contrincante.
Esta opción solo afecta al modo de juego Ordenador vs. Humano.
Para la conjetura del ordenador en el modo Humano vs Ordenador
siempre se utiliza el nivel máximo.Show Game TimerDisplay Game NumberGame ListsMaximum Row Count: Use HighscoresRaise the dialog after a game has been won and prompt for the nameAutomatically insert Highscores using the name belowName (mandatory for the second option)User InterfaceDisplay the current game number in the footer.
To avoid remembering, you can hide it here.TimerYou may hide the timer to keep calm ;-)
But note! Even hidden, time's running in the background.Game PropertiesSelect One of the Level Presets:Or Set the Particular Properties:Game FlowSolverLimit the number of rows in game tables like highscores etc.
Valid values range from 5 to 50.Use Customized Table Row Highlight ColorsForegroundBackgroundHighscoresProvide a name with maximum 20 characters here
to be used for highscore entries.
If you checked the automatic option above, this name
is mandatory, otherwise it will be used as proposal
which you may change later in the dialog.Uncheck this if you are confused about the time as fast running ;-)Show Tenth and HundredthRowHintCommit Your solutionEnviar tu soluciónClick the circles to rate my guess.
Hit Ctrl+H or the corresponding toolbar button to let an impartial part of me do this for you ;-)Haz click en los círculos para puntuar mi resultado.
Pulsa Ctrl+H o el botón correspondiente de la barra de tareas para dejar a una parte imparcial de mi hacerlo ;-)
ColorCode-0.8.7/src/gameslistmodel.h 0000644 0001750 0001750 00000007027 12610736534 016031 0 ustar dirk dirk /* ColorCode, a free MasterMind clone with built in solver
* Copyright (C) 2009 Dirk Laebisch
* http://www.laebisch.com/
*
* ColorCode 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 3 of the License, or
* (at your option) any later version.
*
* ColorCode 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 ColorCode. If not, see .
*/
#ifndef GAMESLISTMODEL_H
#define GAMESLISTMODEL_H
#include
#include
#include
#include
#include "ccgame.h"
#include "buttonscell.h"
#include "gametableview.h"
class GamesListModel : public QAbstractTableModel
{
Q_OBJECT
public:
GamesListModel(QObject* parent = 0);
static const int MODEL_ID_DEFAULT;
static const int MODEL_ID_PREV;
static const int MODEL_ID_SAVED;
static const int MODEL_ID_HIGH;
static const int COL_RANKING;
static const int COL_SCORE;
static const int COL_USERNAME;
static const int COL_DELETE;
static const int COL_GAMENO;
static const int COL_DATE;
static const int COL_TIME;
static const int COL_CCNT;
static const int COL_PCNT;
static const int COL_DOUBLES;
static bool SortListScore(CCGame a, CCGame b);
static bool SortListTime(CCGame a, CCGame b);
virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
virtual bool setData(const QModelIndex &index, const QVariant &value, int role);
int GetId();
QString GetListStr() const;
void SetView(GameTableView* view);
void SetMaxSize(const int max);
void SetRowHColors(QString fg, QString bg);
virtual void InsertRow(CCGame g);
void EditField();
void ReadList(const QString &str);
void SetEditIndex(QModelIndex ix);
QModelIndex GetEditIndex() const;
QString GetEditValue() const;
const CCGame* GetGameAt(const int row) const;
virtual int GetColIx(const int ix) const = 0;
virtual int GetMaxColCnt() const = 0;
public slots:
void HoverRowSlot(int row);
signals:
void CloseEditorSignal(const QModelIndex &index);
void SaveListGameSignal(CCGame* g);
void NewGameInputSignal(CCGame* g);
void ValidNameCommitSignal();
protected:
QString GetHHeaderLabel(const int col) const;
virtual void DoSort(QList &list) = 0;
void LimitGamesListSize();
int mId;
int mMaxSize;
int mHoverRow;
GameTableView* mView;
QList mGamesList;
QModelIndex mEditIndex;
QColor mRowHFg;
QColor mRowHBg;
};
#endif // GAMESLISTMODEL_H
ColorCode-0.8.7/src/ccsolver.cpp 0000644 0001750 0001750 00000040620 14525124731 015164 0 ustar dirk dirk /* ColorCode, a free MasterMind clone with built in solver
* Copyright (C) 2009 Dirk Laebisch
* http://www.laebisch.com/
*
* ColorCode 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 3 of the License, or
* (at your option) any later version.
*
* ColorCode 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 ColorCode. If not, see .
*/
#include "ccsolver.h"
#include
#include
using namespace std;
const int CCSolver::STRENGTH_LOW = 0;
const int CCSolver::STRENGTH_MEDIUM = 1;
const int CCSolver::STRENGTH_HIGH = 2;
const int CCSolver::STRENGTH_DYNAMIC = 3;
const int CCSolver::mFGCnts[4][9][4] = {
{
{2, 0, 0, 0},
{2, 0, 0, 0},
{1, 1, 0, 0},
{1, 1, 0, 0},
{1, 1, 0, 0},
{1, 1, 0, 0},
{1, 1, 0, 0},
{1, 1, 0, 0},
{1, 1, 0, 0}
},
{
{3, 0, 0, 0},
{2, 1, 0, 0},
{1, 1, 1, 0},
{1, 1, 1, 0},
{1, 1, 1, 0},
{1, 1, 1, 0},
{1, 1, 1, 0},
{1, 1, 1, 0},
{1, 1, 1, 0}
},
{
{3, 1, 0, 0},
{3, 1, 0, 0},
{2, 1, 1, 0},
{2, 2, 0, 0},
{2, 2, 0, 0},
{1, 1, 1, 1},
{1, 1, 1, 1},
{1, 1, 1, 1},
{1, 1, 1, 1}
},
{
{4, 1, 0, 0},
{3, 2, 0, 0},
{3, 1, 1, 0},
{2, 2, 1, 0},
{2, 1, 1, 1},
{2, 2, 1, 0},
{2, 1, 1, 1},
{2, 1, 1, 1},
{2, 1, 1, 1}
}
};
const int CCSolver::GAME_NOS_CNT = 66;
const int CCSolver::mGameNos[66][4] = {
{ 2, 2, 2, 0},
{ 6, 2, 2, 1},
{ 12, 3, 2, 0},
{ 21, 3, 2, 1},
{ 33, 4, 2, 0},
{ 49, 4, 2, 1},
{ 69, 5, 2, 0},
{ 94, 5, 2, 1},
{ 124, 6, 2, 0},
{ 160, 6, 2, 1},
{ 202, 7, 2, 0},
{ 251, 7, 2, 1},
{ 307, 8, 2, 0},
{ 371, 8, 2, 1},
{ 443, 9, 2, 0},
{ 524, 9, 2, 1},
{ 614, 10, 2, 0},
{ 714, 10, 2, 1},
{ 722, 2, 3, 1},
{ 728, 3, 3, 0},
{ 755, 3, 3, 1},
{ 779, 4, 3, 0},
{ 843, 4, 3, 1},
{ 903, 5, 3, 0},
{ 1028, 5, 3, 1},
{ 1148, 6, 3, 0},
{ 1364, 6, 3, 1},
{ 1574, 7, 3, 0},
{ 1917, 7, 3, 1},
{ 2253, 8, 3, 0},
{ 2765, 8, 3, 1},
{ 3269, 9, 3, 0},
{ 3998, 9, 3, 1},
{ 4718, 10, 3, 0},
{ 5718, 10, 3, 1},
{ 5734, 2, 4, 1},
{ 5815, 3, 4, 1},
{ 5839, 4, 4, 0},
{ 6095, 4, 4, 1},
{ 6215, 5, 4, 0},
{ 6840, 5, 4, 1},
{ 7200, 6, 4, 0},
{ 8496, 6, 4, 1},
{ 9336, 7, 4, 0},
{ 11737, 7, 4, 1},
{ 13417, 8, 4, 0},
{ 17513, 8, 4, 1},
{ 20537, 9, 4, 0},
{ 27098, 9, 4, 1},
{ 32138, 10, 4, 0},
{ 42138, 10, 4, 1},
{ 42170, 2, 5, 1},
{ 42413, 3, 5, 1},
{ 43437, 4, 5, 1},
{ 43557, 5, 5, 0},
{ 46682, 5, 5, 1},
{ 47402, 6, 5, 0},
{ 55178, 6, 5, 1},
{ 57698, 7, 5, 0},
{ 74505, 7, 5, 1},
{ 81225, 8, 5, 0},
{113993, 8, 5, 1},
{129113, 9, 5, 0},
{188162, 9, 5, 1},
{218402, 10, 5, 0},
{318402, 10, 5, 1}
};
CCSolver::CCSolver(QObject* parent) : QThread(parent)
{
mColorCnt = 0;
mPegCnt = 0;
mDoubles = -1;
mLevel = -1;
mMaxGuessCnt = 0;
mAllCnt = 0;
mPosCnt = 0;
mHistCnt = 0;
mGuessCnt = 0;
mMaxRes = 0;
mResCnt = 0;
mRestartCnt = 0;
mResTable = NULL;
mCascade = NULL;
mPossible = NULL;
mPos2AllIx = NULL;
mAllTable = NULL;
mHist = NULL;
mS = NULL;
mP = NULL;
mInterrupt = false;
}
CCSolver::~CCSolver()
{
wait();
FreeTables();
}
int CCSolver::GetRandGameNo(const int ccnt, const int pcnt, const int doubles) const
{
int min = 0;
int max = 0;
int i;
for (i = 0; i < GAME_NOS_CNT; ++i)
{
if (mGameNos[i][1] == ccnt && mGameNos[i][2] == pcnt && mGameNos[i][3] == doubles)
{
max = mGameNos[i][0];
if (i > 0)
{
min = mGameNos[i - 1][0];
}
break;
}
}
if (max == 0)
{
return 1;
}
int range = max - min;
int rndm = (QRandomGenerator::global()->generate() % range) + 1;
return min + rndm;
}
int CCSolver::GetRealGameNo(const uint no) const
{
int realno = 1;
if (no > 0)
{
realno = no % mGameNos[GAME_NOS_CNT - 1][0];
}
return realno;
}
int CCSolver::GetGameIxByNo(const int no) const
{
int ix = -1;
int i;
for (i = 0; i < GAME_NOS_CNT; ++i)
{
if (mGameNos[i][0] >= no)
{
ix = i;
break;
}
}
if (ix == -1)
{
ix = 0;
}
return ix;
}
const int* CCSolver::GetGameByNo(const int no) const
{
int realno = GetRealGameNo(no);
int ix = GetGameIxByNo(realno);
return mGameNos[ix];
}
vector CCSolver::GetSolutionByNo(const uint no) const
{
int realno = GetRealGameNo(no);
int gameix = GetGameIxByNo(realno);
if (gameix > 0)
{
realno -= mGameNos[gameix - 1][0];
}
vector solvec;
int* sol = mAllTable[mPos2AllIx[realno - 1]];
for (int i = 0; i < mPegCnt; ++i)
{
solvec.push_back(sol[i]);
}
return solvec;
}
void CCSolver::NewGame(const int ccnt, const int pcnt, const int doubles, const int level, const int gcnt)
{
FreeTables();
mColorCnt = ccnt;
mPegCnt = pcnt;
mDoubles = doubles;
mLevel = level;
mMaxGuessCnt = gcnt;
mMaxPosCnt = 0;
mAllCnt = 0;
mPosCnt = 0;
mHistCnt = 0;
mGuessCnt = 0;
mMaxRes = 0;
mResCnt = 0;
mRestartCnt = 0;
mLastPosCnt = 0;
InitTables();
}
void CCSolver::RestartGame()
{
if (mGuessCnt > 0)
{
++mRestartCnt;
}
for (int i = 0 ; i < mMaxGuessCnt ; ++i)
{
mHist[i] = NULL;
}
mGuessCnt = 0;
}
void CCSolver::Interrupt()
{
mInterrupt = true;
}
void CCSolver::run()
{
mInterrupt = false;
mLastGuess = Guess();
if (mLastGuess < 0 || mLastGuess >= mAllCnt)
{
;
}
else
{
mLastPosCnt = mPosCnt;
}
}
int CCSolver::GetAllCnt() const
{
return mAllCnt;
}
void CCSolver::GuessIn(string str)
{
int ix = Row2Ix(str);
mHist[mGuessCnt] = new int[2];
mHist[mGuessCnt][0] = ix;
}
void CCSolver::GuessIn(const vector* rowsol)
{
int ix = Row2Ix(rowsol);
mHist[mGuessCnt] = new int[2];
mHist[mGuessCnt][0] = ix;
}
void CCSolver::StartGuess()
{
if (mPosCnt == mLastPosCnt && (mGuessCnt > 0 || mRestartCnt > 0))
{
emit GuessDoneSignal();
return;
}
mLastGuess = -1;
start(QThread::NormalPriority);
}
int* CCSolver::GuessOut()
{
if (mLastGuess < 0 || mLastGuess >= mAllCnt)
{
return NULL;
}
return mAllTable[mLastGuess];
}
int CCSolver::ResIn(const vector* res)
{
int r = 0;
int len = res->size();
int i;
for (i = 0; i < len; ++i)
{
if (res->at(i) == 2)
{
r += 10;
}
else if (res->at(i) == 1)
{
r += 1;
}
}
mHist[mGuessCnt][1] = r;
UpdPos(mHist[mGuessCnt][0], r);
++mGuessCnt;
return r;
}
void CCSolver::FreeTables()
{
int i;
delete [] mPos2AllIx;
mPos2AllIx = NULL;
delete [] mCascade;
mCascade = NULL;
delete [] mPossible;
mPossible = NULL;
for (i = 0 ; i < mAllCnt ; ++i)
{
delete [] mAllTable[i] ;
}
delete [] mAllTable;
mAllTable = NULL;
for (i = 0 ; i < mMaxGuessCnt ; ++i)
{
delete [] mHist[i] ;
}
delete [] mHist;
mHist = NULL;
delete [] mResTable;
mResTable = NULL;
delete [] mS;
mS = NULL;
delete [] mP;
mP = NULL;
}
void CCSolver::InitTables()
{
int i, j, k;
if (mDoubles != 1 && mColorCnt < mPegCnt)
{
return;
}
mMaxPosCnt = CalcPosCnt(mColorCnt, mPegCnt, mDoubles);
mPos2AllIx = new int [mMaxPosCnt];
mCascade = new int [mPegCnt];
for (i = 0; i < mPegCnt; ++i)
{
mCascade[i] = IntPow(mColorCnt, mPegCnt - i - 1);
}
mAllCnt = CalcAllCnt(mColorCnt, mPegCnt);
mAllTable = new int* [mAllCnt];
for (i = 0; i < mAllCnt; ++i)
{
mAllTable[i] = new int [mPegCnt];
}
mPossible = new int [mAllCnt];
for (i = 0; i < mAllCnt; ++i)
{
FillTable(i);
}
mHist = new int* [mMaxGuessCnt];
for (i = 0 ; i < mMaxGuessCnt ; ++i)
{
mHist[i] = NULL;
}
mS = new int [mColorCnt];
mP = new int [mColorCnt];
mMaxRes = mPegCnt * 10;
mResCnt = (IntFac(mPegCnt + 2)) / (IntFac(mPegCnt) * 2) - 1;
mResTable = new int[mResCnt];
k = 0;
for (i = 0; i <= mPegCnt; ++i)
{
for (j = 0; j <= mPegCnt - i; ++j, ++k)
{
if (i == mPegCnt - 1 && j == 1)
{
--k;
continue;
}
mResTable[k] = i * 10 + j;
}
}
}
void CCSolver::FillTable(const int ix)
{
int i;
int v = ix;
int pos = 1;
int j;
for (i = 0; i < mPegCnt; ++i)
{
mAllTable[ix][i] = 0;
}
for (i = 0; i < mPegCnt; ++i)
{
while (v >= mCascade[i])
{
++mAllTable[ix][i];
v -= mCascade[i];
}
if (mDoubles != 1 && pos == 1)
{
for (j = 0; j < i; j++)
{
if (mAllTable[ix][j] == mAllTable[ix][i])
{
pos = 0;
break;
}
}
}
}
if (pos == 1)
{
mPos2AllIx[mPosCnt] = ix;
}
mPosCnt += pos;
mPossible[ix] = pos;
}
int CCSolver::RowCmp(const int* sol, const int* pat)
{
int bl = 0;
int wh = 0;
int i;
for (i = 0; i < mColorCnt; ++i)
{
mS[i] = mP[i] = 0;
}
for (i = 0; i < mPegCnt; ++i)
{
if (sol[i] == pat[i])
{
++bl;
}
else
{
if (mP[sol[i]] > 0)
{
++wh;
--mP[sol[i]];
}
else
{
++mS[sol[i]];
}
if (mS[pat[i]] > 0)
{
++wh;
--mS[pat[i]];
}
else
{
++mP[pat[i]];
}
}
}
return (10 * bl + wh);
}
void CCSolver::UpdPos(const int ix, const int res)
{
int i;
for (i = 0; i < mAllCnt; ++i)
{
if (!mPossible[i])
{
continue;
}
if (RowCmp(mAllTable[i], mAllTable[ix]) != res)
{
mPossible[i] = 0;
--mPosCnt;
}
}
}
string CCSolver::FirstGuess()
{
int i, j, r;
int pegcnt = 0;
int diffcnt = 0;
const int* fg = mFGCnts[mPegCnt-2][mColorCnt-2];
char s[mPegCnt];
int t[mColorCnt];
for (i = 0; i < mColorCnt; ++i)
{
t[i] = 0;
}
if (mDoubles == 1)
{
for (i = 0; i < 4; ++i)
{
if (fg[i] == 0)
{
break;
}
do
{
r = rand() % mColorCnt;
}
while (t[r] > 0);
++t[r];
++diffcnt;
for (j = 0; j < fg[i]; ++j)
{
s[pegcnt++] = 'A' + r;
}
if (pegcnt == mPegCnt)
{
break;
}
}
if (mPegCnt > 2 && diffcnt > 1)
{
for (int i = 0; i < (mPegCnt - 1); ++i)
{
r = i + (rand() % (mPegCnt - i));
if (i != r)
{
char tmp = s[i];
s[i] = s[r];
s[r] = tmp;
}
}
}
}
else
{
for (i = 0; i < mPegCnt; ++i)
{
do
{
r = rand() % mColorCnt;
}
while (t[r] > 0);
++t[r];
s[i] = 'A' + r;
}
}
return string(s, mPegCnt);
}
int CCSolver::Guess()
{
//clock_t start, finish;
//start = clock();
if (mLevel > STRENGTH_LOW && mGuessCnt == 0 && mRestartCnt == 0)
{
return Row2Ix(FirstGuess());
}
int level = mLevel;
if (level == STRENGTH_HIGH && mPosCnt > 10000)
{
level = STRENGTH_MEDIUM;
}
int i, j;
if (level == STRENGTH_LOW)
{
for (i = 0; i < mAllCnt; ++i)
{
if (mPossible[i])
{
break;
}
}
}
else if (level == STRENGTH_MEDIUM)
{
int m = mPosCnt >> 1;
for (i = 0; i < mAllCnt; ++i)
{
if (mPossible[i])
{
if (--m <= 0)
{
break;
}
}
}
}
else
{
// Donald E. Knuth. The Computer as Master Mind. J. Recreational Mathematics, 9 (1976-77), 1-6.
// Kenji Koyama, Tony W. Lai. An optimal Mastermind Strategy. J. Recreational Mathematics, 1994.
// we'll only take the still possible ones into account, but ...
int solix = -1;
int shortest = 1000000;
int longest;
int res2pos[mMaxRes];
for (j = 0; j <= mMaxRes; ++j)
{
res2pos[j] = 0;
}
for (i = 0; i < mAllCnt; ++i)
{
if (mInterrupt)
{
i = -1;
break;
}
if (!mPossible[i])
{
continue;
}
for (j = 0; j < mAllCnt; ++j)
{
if (!mPossible[j])
{
continue;
}
++res2pos[RowCmp(mAllTable[j], mAllTable[i])];
}
longest = 0;
for (j = 0; j < mResCnt; ++j)
{
if (res2pos[mResTable[j]] > longest)
{
longest = res2pos[mResTable[j]];
}
res2pos[mResTable[j]] = 0;
}
if (longest < shortest)
{
shortest = longest;
solix = i;
}
}
i = solix;
}
//finish = clock();
return i;
}
string CCSolver::RowOut(const int* r)
{
char s[mPegCnt];
int i;
for (i = 0; i < mPegCnt; ++i)
{
s[i] = 'A' + r[i];
}
return string(s, mPegCnt);
}
int CCSolver::Row2Ix(const vector* v)
{
int i;
int ix = 0;
int len = v->size();
if (len != mPegCnt)
{
return -1;
}
int j;
for (i = 0; i < mPegCnt; ++i)
{
j = v->at(i);
if (j >= mColorCnt)
{
ix = -1;
break;
}
ix += j * mCascade[i];
}
if (ix >= 0 && ix < mAllCnt)
{
return ix;
}
return -1;
}
int CCSolver::Row2Ix(const string str)
{
int i;
int ix = 0;
int len = int(str.size());
if (len != mPegCnt)
{
return -1;
}
int j;
for (i = 0; i < mPegCnt; ++i)
{
j = toupper(int(str[i])) - 'A';
if (j >= mColorCnt)
{
ix = -1;
break;
}
ix += j * mCascade[i];
}
if (ix >= 0 && ix < mAllCnt)
{
return ix;
}
return -1;
}
int CCSolver::IntPow(const int b, const int e) const
{
int i;
int ret = 1;
for (i = 0; i < e; ++i)
{
ret *= b;
}
return ret;
}
int CCSolver::IntFac(const int n) const
{
int fac = 1;
int i;
for (i = n; i > 1; --i)
{
fac *= i;
}
return fac;
}
int CCSolver::CalcAllCnt(const int ccnt, const int pcnt) const
{
if (ccnt < 2 || pcnt < 2)
{
return 0;
}
return IntPow(ccnt, pcnt);
}
int CCSolver::CalcPosCnt(const int ccnt, const int pcnt, const int doubles) const
{
if (ccnt < 2 || pcnt < 2 || (doubles != 0 && doubles != 1))
{
return 0;
}
if (ccnt < pcnt && doubles == 0)
{
return 0;
}
if (doubles == 1)
{
return CalcAllCnt(ccnt, pcnt);
}
return IntFac(ccnt) / IntFac(ccnt - pcnt);
}
ColorCode-0.8.7/src/about.o 0000644 0001750 0001750 00000067220 14526050342 014134 0 ustar dirk dirk ELF > Pf @ @ !
H HPH HHG fSH H߾ [ f H HHPH HHG ff. @ SH_H H߾ [ @ Hh Ð@ AWAVAUATUHSH H H}0HHPH HU HE H= L$ H$ 11LHH$ L$ HL LH L H H$
t/H$ s
H= LuX 11LHH$ HL H H$
t/H$ k
H= L 11LHH$ HL H H$ t/H$ HEhH5 1LAH HD$ H5 A1LH L$ H5 A1H L H$ H5 A1H HH$ H$ H5 HHD$XI H5 L H$ H$ z H5 H H$ HHHD$( H$ t/H$ } H$ H$ w H$ H4$HHD$P H$ H$ 0 H$ LHHD$H H$ H$
H5 H H$ HHHD$ H$ t/H$ H$ H$ 7
H$ LHHD$@ H$ H$
H5 H H$ HHHD$ H$ S t/H$ < H$ HT$x
HD$xH5 HHD$8 HT$xHT$p H5 H HD$pHHHD$ H$ t/H$ HT$pHT$h& HD$hLHHD$0 HT$hHT$` H5 H Lt$`HL H$ t/H$ H|$L H|$` t/H|$` H|$h t/H|$hq H|$p t/H|$p H|$x t/H|$x H$ t/H$ H$ t/H$ H$ t/H$ H$ t/H$ H$ t/H$ H$ t/H$ y H$ t/H$ q H$ t/H$ i H$ x t/H$ a H$ p t/H$ Y H$ h t/H$ Q H= H<$H$ L L H= HLH$ H$ t/H$ H L H4$H H HLL L$ MmL LL LL H$ t/H$ H$ t/H$ H H L H$ t/H$ o H []A\A]A^A_D H5 A1LH L H5 L LL H$ H$ H5 H HL H$ t/H$ LL H$ t/H$ j H$ @ t/H$ ) H$ t/H$ H$ }@ &@ E@ y@ o@ @ @ @ H|$xC H$ H H$ P H$ X H$ ` H$ h H$ p H$ x H$ H$ H$ H$ {@ @@ @ @ 6@ @ @ }
' Y T@ lI I H I H H I H H H H H I I HH$ HD$ H H H H I I H H I HH$ HD$( H I HHD$pHD$ H H HH$ HD$ H I HD$ HLt$` H I H H I
Htt(t H H About vboxLayout tabWidget mAuthorTab hboxLayout vboxLayout1 mAuthorIcon mAuthorText mLicenseTab hboxLayout1 vboxLayout2 mLicenseIcon mLicenseText buttonBox About ColorCode icon &Author