mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-18 03:19:30 -04:00
update ColorCode plugin to 0.5.5
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2249 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
b899327f13
commit
d5dbe6bd38
36 changed files with 5168 additions and 1836 deletions
674
plugins/ColorCode_plugin/COPYING
Normal file
674
plugins/ColorCode_plugin/COPYING
Normal file
|
@ -0,0 +1,674 @@
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
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.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
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
|
||||||
|
<http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
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
|
||||||
|
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
@ -25,26 +25,34 @@ SOURCES += ColorCodePlugin.cpp
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
|
||||||
|
# Input
|
||||||
SOURCES += main.cpp \
|
HEADERS += about.h \
|
||||||
mainwindow.cpp \
|
colorcode.h \
|
||||||
colorpeg.cpp \
|
|
||||||
rowhint.cpp \
|
|
||||||
pegrow.cpp \
|
|
||||||
msg.cpp \
|
|
||||||
about.cpp
|
|
||||||
HEADERS += mainwindow.h \
|
|
||||||
colorpeg.h \
|
colorpeg.h \
|
||||||
rowhint.h \
|
|
||||||
pegrow.h \
|
|
||||||
msg.h \
|
msg.h \
|
||||||
about.h
|
pegrow.h \
|
||||||
RESOURCES += resource.qrc
|
rowhint.h \
|
||||||
|
ccsolver.h \
|
||||||
|
background.h \
|
||||||
|
solrow.h
|
||||||
FORMS += about.ui
|
FORMS += about.ui
|
||||||
OTHER_FILES += docs/GPL.html \
|
SOURCES += about.cpp \
|
||||||
|
colorcode.cpp \
|
||||||
|
colorpeg.cpp \
|
||||||
|
main.cpp \
|
||||||
|
msg.cpp \
|
||||||
|
pegrow.cpp \
|
||||||
|
rowhint.cpp \
|
||||||
|
ccsolver.cpp \
|
||||||
|
background.cpp \
|
||||||
|
solrow.cpp
|
||||||
|
RESOURCES += resource.qrc
|
||||||
|
OTHER_FILES += docs/GPL.html
|
||||||
|
win32 {
|
||||||
|
RC_FILE = ColorCode.rc
|
||||||
|
}
|
||||||
|
TRANSLATIONS += trans_de.ts \
|
||||||
trans_en.ts \
|
trans_en.ts \
|
||||||
trans_de.ts
|
trans_cs.ts
|
||||||
TRANSLATIONS = trans_en.ts \
|
|
||||||
trans_de.ts
|
|
||||||
CODECFORTR = UTF-8
|
CODECFORTR = UTF-8
|
||||||
CODECFORSRC = UTF-8
|
CODECFORSRC = UTF-8
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
//#include <QPushButton>
|
//#include <QPushButton>
|
||||||
|
|
||||||
#include "ColorCodePlugin.h"
|
#include "ColorCodePlugin.h"
|
||||||
#include "mainwindow.h"
|
#include "colorcode.h"
|
||||||
|
|
||||||
QString
|
QString
|
||||||
ColorCodePlugin::pluginDescription() const
|
ColorCodePlugin::pluginDescription() const
|
||||||
|
@ -44,7 +44,7 @@ ColorCodePlugin::pluginName() const
|
||||||
QWidget*
|
QWidget*
|
||||||
ColorCodePlugin::pluginWidget(QWidget * parent )
|
ColorCodePlugin::pluginWidget(QWidget * parent )
|
||||||
{
|
{
|
||||||
MainWindow* window = new MainWindow();
|
ColorCode* window = new ColorCode();
|
||||||
|
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
ColorCode 0.1
|
# simply run:
|
||||||
|
|
||||||
simply run:
|
|
||||||
|
|
||||||
qmake-qt4 -project
|
|
||||||
qmake-qt4
|
qmake-qt4
|
||||||
make
|
make
|
||||||
|
|
||||||
|
# to install:
|
||||||
|
cp ColorCode /usr/bin/
|
||||||
|
|
||||||
|
# to uninstall:
|
||||||
|
rm /usr/bin/ColorCode
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,21 @@
|
||||||
|
/* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
#include "about.h"
|
#include "about.h"
|
||||||
|
|
||||||
About::About(QWidget* parent, Qt::WindowFlags f) : QDialog(parent, f)
|
About::About(QWidget* parent, Qt::WindowFlags f) : QDialog(parent, f)
|
||||||
|
@ -9,7 +27,8 @@ About::About(QWidget* parent, Qt::WindowFlags f) : QDialog(parent, f)
|
||||||
|
|
||||||
mAuthorText->setText("<b>" + tr("ColorCode") + "</b><br>" +
|
mAuthorText->setText("<b>" + tr("ColorCode") + "</b><br>" +
|
||||||
tr("A needful game to train your brain ;-)") +
|
tr("A needful game to train your brain ;-)") +
|
||||||
"<br><br>Version: 0.2<br>Author: Dirk Laebisch");
|
tr("<br><br>Free MasterMind clone including a built in,<br>rather intelligent solver.") +
|
||||||
|
"<br><br>" + tr("Version") + ": 0.5.5<br>" + tr("Author") + ": Dirk Laebisch");
|
||||||
|
|
||||||
QString license_file = ":/docs/GPL.html";
|
QString license_file = ":/docs/GPL.html";
|
||||||
if (QFile::exists(license_file))
|
if (QFile::exists(license_file))
|
||||||
|
@ -44,5 +63,5 @@ About::~About()
|
||||||
|
|
||||||
QSize About::sizeHint () const
|
QSize About::sizeHint () const
|
||||||
{
|
{
|
||||||
return QSize(320, 240);
|
return QSize(360, 270);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,21 @@
|
||||||
|
/* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef ABOUT_H
|
#ifndef ABOUT_H
|
||||||
#define ABOUT_H
|
#define ABOUT_H
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>320</width>
|
<width>360</width>
|
||||||
<height>240</height>
|
<height>270</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
|
140
plugins/ColorCode_plugin/background.cpp
Normal file
140
plugins/ColorCode_plugin/background.cpp
Normal file
|
@ -0,0 +1,140 @@
|
||||||
|
/* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#include <QtGui>
|
||||||
|
|
||||||
|
#include "background.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
BackGround::BackGround(QObject*)
|
||||||
|
{
|
||||||
|
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
||||||
|
|
||||||
|
QLinearGradient topgrad(0, 16, 0, 129);
|
||||||
|
topgrad.setColorAt(0.0, QColor(0xf8, 0xf8, 0xf8));
|
||||||
|
topgrad.setColorAt(0.6, QColor(0xb8, 0xb9, 0xbb));
|
||||||
|
topgrad.setColorAt(1, QColor(0xd4, 0xd5, 0xd7));
|
||||||
|
mTopGrad = QBrush(topgrad);
|
||||||
|
|
||||||
|
QLinearGradient botgrad(0, 530, 0, 557);
|
||||||
|
botgrad.setColorAt(0.0, QColor("#d4d5d7"));
|
||||||
|
botgrad.setColorAt(0.3, QColor("#cecfd1"));
|
||||||
|
botgrad.setColorAt(1.0, QColor("#b0b1b3"));
|
||||||
|
mBotGrad = QBrush(botgrad);
|
||||||
|
|
||||||
|
QLinearGradient lgrad(0, 190, 320, 370);
|
||||||
|
lgrad.setColorAt(0.0, QColor(0xff, 0xff, 0xff, 0xa0));
|
||||||
|
lgrad.setColorAt(0.49, QColor(0xff, 0xff, 0xff, 0xa0));
|
||||||
|
lgrad.setColorAt(0.50, QColor(0, 0, 0, 0x80));
|
||||||
|
lgrad.setColorAt(1.0, QColor(0, 0, 0, 0x80));
|
||||||
|
mFramePen = QPen(QBrush(lgrad), 1);
|
||||||
|
|
||||||
|
mPend = QColor("#646568");
|
||||||
|
mPenl = QColor("#ecedef");
|
||||||
|
mGrad0 = QColor("#cccdcf");
|
||||||
|
mGrad1 = QColor("#fcfdff");
|
||||||
|
|
||||||
|
mPend.setAlpha(0x32);
|
||||||
|
mPenl.setAlpha(0x50);
|
||||||
|
mGrad0.setAlpha(0x32);
|
||||||
|
mGrad1.setAlpha(0x32);
|
||||||
|
}
|
||||||
|
|
||||||
|
BackGround::~BackGround()
|
||||||
|
{
|
||||||
|
scene()->removeItem(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
QRectF BackGround::boundingRect() const
|
||||||
|
{
|
||||||
|
const int margin = 1;
|
||||||
|
return outlineRect().adjusted(-margin, -margin, +margin, +margin);
|
||||||
|
}
|
||||||
|
|
||||||
|
QRectF BackGround::outlineRect() const
|
||||||
|
{
|
||||||
|
return QRectF(0.0, 0.0, 320.0, 560.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BackGround::paint(QPainter* painter, const QStyleOptionGraphicsItem* /*option*/, QWidget* /* widget */)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
painter->setPen(Qt::NoPen);
|
||||||
|
|
||||||
|
QRectF cr = QRectF(3, 3, 314, 554);
|
||||||
|
QPainterPath cpath;
|
||||||
|
cpath.addRoundedRect(cr, 10.1, 10.1);
|
||||||
|
painter->setClipPath(cpath);
|
||||||
|
painter->setClipping(true);
|
||||||
|
|
||||||
|
painter->setBrush(mTopGrad);
|
||||||
|
painter->drawRect(QRect(4, 4, 312, 125));
|
||||||
|
painter->setBrush(QBrush(QColor("#707173")));
|
||||||
|
painter->drawRect(QRect(1, 129, 318, 1));
|
||||||
|
|
||||||
|
painter->setPen(Qt::NoPen);
|
||||||
|
for (i = 0; i < 10; ++i)
|
||||||
|
{
|
||||||
|
painter->setBrush(QBrush(QColor("#9e9fa0")));
|
||||||
|
painter->drawRect(QRect(1, i * 40 + 130, 318, 1));
|
||||||
|
QLinearGradient rowgrad(0, i * 40 + 131, 0, i * 40 + 169);
|
||||||
|
rowgrad.setColorAt(0.0, QColor("#9a9b9d"));
|
||||||
|
rowgrad.setColorAt(1.0, QColor("#949597"));
|
||||||
|
painter->setBrush(QBrush(rowgrad));
|
||||||
|
painter->drawRect(QRect(1, i * 40 + 131, 318, 38));
|
||||||
|
painter->setBrush(QBrush(QColor("#88898b")));
|
||||||
|
painter->drawRect(QRect(1, i * 40 + 169, 318, 1));
|
||||||
|
|
||||||
|
painter->setBrush(QBrush(mPenl));
|
||||||
|
painter->drawRect(QRectF(277, i * 40 + 130, 39, 1));
|
||||||
|
painter->drawRect(QRectF(277, i * 40 + 130, 1, 39));
|
||||||
|
painter->setBrush(QBrush(mPend));
|
||||||
|
painter->drawRect(QRectF(277, i * 40 + 130 + 39, 40, 1));
|
||||||
|
painter->drawRect(QRectF(277 + 39, i * 40 + 130, 1, 40));
|
||||||
|
|
||||||
|
QRadialGradient grad(QPointF(277 + 10, i * 40 + 130 + 10), 100);
|
||||||
|
grad.setColorAt(0, mGrad0);
|
||||||
|
grad.setColorAt(1, mGrad1);
|
||||||
|
painter->setBrush(QBrush(grad));
|
||||||
|
painter->drawRect(QRectF(277 + 1, i * 40 + 131, 38.0, 38.0));
|
||||||
|
|
||||||
|
painter->setBrush(Qt::NoBrush);
|
||||||
|
QPointF x0 = QPointF(279, i * 40 + 130 + 2);
|
||||||
|
QLinearGradient lgrad(x0, QPointF(x0.x() + 36, x0.y() + 36));
|
||||||
|
lgrad.setColorAt(0.0, QColor(0, 0, 0, 0x80));
|
||||||
|
lgrad.setColorAt(1.0, QColor(0xff, 0xff, 0xff, 0xa0));
|
||||||
|
painter->setPen(QPen(QBrush(lgrad), 0.5));
|
||||||
|
painter->drawEllipse(QRectF(x0.x(), x0.y(), 36, 36));
|
||||||
|
painter->setPen(Qt::NoPen);
|
||||||
|
}
|
||||||
|
|
||||||
|
painter->setBrush(mBotGrad);
|
||||||
|
painter->drawRect(QRect(1, 531, 318, 27));
|
||||||
|
painter->setBrush(QBrush(QColor("#eff0f2")));
|
||||||
|
painter->drawRect(QRect(1, 530, 318, 1));
|
||||||
|
|
||||||
|
painter->setClipping(false);
|
||||||
|
|
||||||
|
QRectF r = QRectF(3.5, 3.5, 313, 553);
|
||||||
|
painter->setBrush(Qt::NoBrush);
|
||||||
|
painter->setPen(mFramePen);
|
||||||
|
painter->drawRoundedRect(r, 9.8, 9.8);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
55
plugins/ColorCode_plugin/background.h
Normal file
55
plugins/ColorCode_plugin/background.h
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
/* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BACKGROUND_H
|
||||||
|
#define BACKGROUND_H
|
||||||
|
|
||||||
|
#include <QGraphicsItem>
|
||||||
|
#include <QColor>
|
||||||
|
#include <QPen>
|
||||||
|
#include <QRadialGradient>
|
||||||
|
#include <iostream>
|
||||||
|
#include "colorcode.h"
|
||||||
|
|
||||||
|
class BackGround : public QObject, public QGraphicsItem
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
BackGround(QObject* parent = 0);
|
||||||
|
~BackGround();
|
||||||
|
|
||||||
|
QRectF boundingRect() const;
|
||||||
|
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QRectF outlineRect() const;
|
||||||
|
|
||||||
|
QBrush mTopGrad;
|
||||||
|
QBrush mBotGrad;
|
||||||
|
|
||||||
|
QPen mFramePen;
|
||||||
|
|
||||||
|
QColor mPend;
|
||||||
|
QColor mPenl;
|
||||||
|
QColor mGrad0;
|
||||||
|
QColor mGrad1;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // BACKGROUND_H
|
674
plugins/ColorCode_plugin/ccsolver.cpp
Normal file
674
plugins/ColorCode_plugin/ccsolver.cpp
Normal file
|
@ -0,0 +1,674 @@
|
||||||
|
/* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ccsolver.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
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}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
CCSolver::CCSolver(ColorCode* cc)
|
||||||
|
{
|
||||||
|
mCc = cc;
|
||||||
|
|
||||||
|
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;
|
||||||
|
mAllTable = NULL;
|
||||||
|
mHist = NULL;
|
||||||
|
|
||||||
|
mS = NULL;
|
||||||
|
mP = NULL;
|
||||||
|
|
||||||
|
mBusy = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CCSolver::~CCSolver()
|
||||||
|
{
|
||||||
|
FreeTables();
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
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::GuessIn(string str)
|
||||||
|
{
|
||||||
|
int ix = Row2Ix(str);
|
||||||
|
mHist[mGuessCnt] = new int[2];
|
||||||
|
mHist[mGuessCnt][0] = ix;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCSolver::GuessIn(const vector<int>* rowsol)
|
||||||
|
{
|
||||||
|
int ix = Row2Ix(rowsol);
|
||||||
|
mHist[mGuessCnt] = new int[2];
|
||||||
|
mHist[mGuessCnt][0] = ix;
|
||||||
|
}
|
||||||
|
|
||||||
|
int* CCSolver::GuessOut()
|
||||||
|
{
|
||||||
|
if (mPosCnt == mLastPosCnt && (mGuessCnt > 0 || mRestartCnt > 0))
|
||||||
|
{
|
||||||
|
return mAllTable[mLastGuess];
|
||||||
|
}
|
||||||
|
|
||||||
|
int g = Guess();
|
||||||
|
if (g < 0 || g >= mAllCnt)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
mLastPosCnt = mPosCnt;
|
||||||
|
mLastGuess = g;
|
||||||
|
return mAllTable[g];
|
||||||
|
}
|
||||||
|
|
||||||
|
int CCSolver::ResIn(const vector<int>* 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 [] 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
mCascade = new int [mPegCnt];
|
||||||
|
|
||||||
|
for (i = 0; i < mPegCnt; ++i)
|
||||||
|
{
|
||||||
|
mCascade[i] = IntPow(mColorCnt, mPegCnt - i - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
mAllCnt = 1;
|
||||||
|
for (i = 0; i < mPegCnt; ++i)
|
||||||
|
{
|
||||||
|
mAllCnt *= mColorCnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 (pegcnt != mPegCnt)
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 (mGuessCnt == 0 && mRestartCnt == 0)
|
||||||
|
{
|
||||||
|
return Row2Ix(FirstGuess());
|
||||||
|
}
|
||||||
|
|
||||||
|
mBusy = true;
|
||||||
|
|
||||||
|
int level = mLevel;
|
||||||
|
if (level == 2 && mPosCnt > 10000)
|
||||||
|
{
|
||||||
|
level = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int i, j;
|
||||||
|
|
||||||
|
if (level == 0)
|
||||||
|
{
|
||||||
|
for (i = 0; i < mAllCnt; ++i)
|
||||||
|
{
|
||||||
|
if (mPossible[i])
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (level == 1)
|
||||||
|
{
|
||||||
|
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 (!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();
|
||||||
|
mBusy = false;
|
||||||
|
|
||||||
|
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<int>* 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)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int ret = 1;
|
||||||
|
for (i = 0; i < e; ++i)
|
||||||
|
{
|
||||||
|
ret *= b;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CCSolver::IntFac(const int n)
|
||||||
|
{
|
||||||
|
int fac = 1;
|
||||||
|
int i;
|
||||||
|
for (i = n; i > 1; --i)
|
||||||
|
{
|
||||||
|
fac *= i;
|
||||||
|
}
|
||||||
|
return fac;
|
||||||
|
}
|
90
plugins/ColorCode_plugin/ccsolver.h
Normal file
90
plugins/ColorCode_plugin/ccsolver.h
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
/* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CCSOLVER_H
|
||||||
|
#define CCSOLVER_H
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include "colorcode.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
class CCSolver
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCSolver(ColorCode* cc);
|
||||||
|
~CCSolver();
|
||||||
|
|
||||||
|
void NewGame(const int ccnt, const int pcnt = 4, const int doubles = 1, const int level = 2, const int gcnt = 10);
|
||||||
|
void RestartGame();
|
||||||
|
string FirstGuess();
|
||||||
|
void GuessIn(string str);
|
||||||
|
void GuessIn(const vector<int>* rowsol);
|
||||||
|
int ResIn(const vector<int>* res);
|
||||||
|
int* GuessOut();
|
||||||
|
|
||||||
|
volatile bool mBusy;
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const int mFGCnts[4][9][4];
|
||||||
|
|
||||||
|
ColorCode* mCc;
|
||||||
|
|
||||||
|
int mMaxGuessCnt;
|
||||||
|
int mColorCnt;
|
||||||
|
int mPegCnt;
|
||||||
|
int mDoubles;
|
||||||
|
int mLevel;
|
||||||
|
|
||||||
|
int mLastGuess;
|
||||||
|
int mLastPosCnt;
|
||||||
|
|
||||||
|
int mAllCnt;
|
||||||
|
int mPosCnt;
|
||||||
|
int mHistCnt;
|
||||||
|
int mGuessCnt;
|
||||||
|
int mMaxRes;
|
||||||
|
int mResCnt;
|
||||||
|
|
||||||
|
int mRestartCnt;
|
||||||
|
|
||||||
|
int* mResTable;
|
||||||
|
int* mCascade;
|
||||||
|
int* mPossible;
|
||||||
|
int** mAllTable;
|
||||||
|
int** mHist;
|
||||||
|
|
||||||
|
int* mS;
|
||||||
|
int* mP;
|
||||||
|
|
||||||
|
void FreeTables();
|
||||||
|
void InitTables();
|
||||||
|
void FillTable(const int ix);
|
||||||
|
int RowCmp(const int* sol, const int* pat);
|
||||||
|
void UpdPos(const int ix, const int res);
|
||||||
|
int Guess();
|
||||||
|
|
||||||
|
string RowOut(const int* r);
|
||||||
|
int Row2Ix(const string str);
|
||||||
|
int Row2Ix(const vector<int>* v);
|
||||||
|
|
||||||
|
int IntPow(const int b, const int e);
|
||||||
|
int IntFac(const int n);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CCSOLVER_H
|
84
plugins/ColorCode_plugin/changelog
Normal file
84
plugins/ColorCode_plugin/changelog
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
* 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.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
1588
plugins/ColorCode_plugin/colorcode.cpp
Normal file
1588
plugins/ColorCode_plugin/colorcode.cpp
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,23 @@
|
||||||
#ifndef MAINWINDOW_H
|
/* ColorCode, a free MasterMind clone with built in solver
|
||||||
#define MAINWINDOW_H
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef COLORCODE_H
|
||||||
|
#define COLORCODE_H
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
@ -7,30 +25,34 @@
|
||||||
struct PegType
|
struct PegType
|
||||||
{
|
{
|
||||||
int ix;
|
int ix;
|
||||||
QRadialGradient grad;
|
char let;
|
||||||
|
QRadialGradient* grad;
|
||||||
QColor pencolor;
|
QColor pencolor;
|
||||||
};
|
};
|
||||||
|
|
||||||
//typedef std::vector<PegType> TypesMap;
|
|
||||||
|
|
||||||
class QAction;
|
class QAction;
|
||||||
class QActionGroup;
|
class QActionGroup;
|
||||||
class QComboBox;
|
class QComboBox;
|
||||||
|
class QLabel;
|
||||||
class QGraphicsItem;
|
class QGraphicsItem;
|
||||||
class QGraphicsTextItem;
|
class QGraphicsTextItem;
|
||||||
class QGraphicsScene;
|
class QGraphicsScene;
|
||||||
class QGraphicsView;
|
class QGraphicsView;
|
||||||
|
class CCSolver;
|
||||||
class ColorPeg;
|
class ColorPeg;
|
||||||
class PegRow;
|
class PegRow;
|
||||||
class RowHint;
|
class RowHint;
|
||||||
class Msg;
|
class Msg;
|
||||||
|
class BackGround;
|
||||||
|
class SolRow;
|
||||||
|
|
||||||
class MainWindow : public QMainWindow
|
class ColorCode : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainWindow();
|
ColorCode();
|
||||||
|
~ColorCode();
|
||||||
|
|
||||||
static const int STATE_RUNNING;
|
static const int STATE_RUNNING;
|
||||||
static const int STATE_WON;
|
static const int STATE_WON;
|
||||||
|
@ -38,13 +60,13 @@ class MainWindow : public QMainWindow
|
||||||
static const int STATE_GAVE_UP;
|
static const int STATE_GAVE_UP;
|
||||||
|
|
||||||
static const int MAX_COLOR_CNT;
|
static const int MAX_COLOR_CNT;
|
||||||
static const int LEVEL_COLOR_CNTS[3];
|
|
||||||
|
|
||||||
int ROW_CNT;
|
int ROW_CNT;
|
||||||
int POS_CNT;
|
int ROW_Y0;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void PegPressSlot(ColorPeg *cp);
|
void PegPressSlot(ColorPeg *cp);
|
||||||
|
void PegSortSlot(ColorPeg* cp);
|
||||||
void PegReleasedSlot(ColorPeg *cp);
|
void PegReleasedSlot(ColorPeg *cp);
|
||||||
void RowSolutionSlot(int ix);
|
void RowSolutionSlot(int ix);
|
||||||
void HintPressedSlot(int ix);
|
void HintPressedSlot(int ix);
|
||||||
|
@ -54,6 +76,7 @@ class MainWindow : public QMainWindow
|
||||||
protected :
|
protected :
|
||||||
void resizeEvent(QResizeEvent* e);
|
void resizeEvent(QResizeEvent* e);
|
||||||
void contextMenuEvent(QContextMenuEvent* e);
|
void contextMenuEvent(QContextMenuEvent* e);
|
||||||
|
void keyPressEvent(QKeyEvent *e);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void InitRows();
|
void InitRows();
|
||||||
|
@ -62,12 +85,16 @@ class MainWindow : public QMainWindow
|
||||||
void RestartGameSlot();
|
void RestartGameSlot();
|
||||||
void GiveInSlot();
|
void GiveInSlot();
|
||||||
void ResetRows();
|
void ResetRows();
|
||||||
|
void OnlineHelpSlot();
|
||||||
void AboutSlot();
|
void AboutSlot();
|
||||||
void AboutQtSlot();
|
void AboutQtSlot();
|
||||||
void ShowToolbarSlot();
|
void ShowToolbarSlot();
|
||||||
void ShowMenubarSlot();
|
void ShowMenubarSlot();
|
||||||
void ShowStatusbarSlot();
|
void ShowStatusbarSlot();
|
||||||
void SameColorSlot();
|
void ResetColorsOrderSlot();
|
||||||
|
void ShowLetterSlot();
|
||||||
|
void SameColorSlot(bool checked);
|
||||||
|
void SetSameColor(bool checked);
|
||||||
void AutoCloseSlot();
|
void AutoCloseSlot();
|
||||||
void ForceLevelSlot();
|
void ForceLevelSlot();
|
||||||
|
|
||||||
|
@ -75,22 +102,30 @@ class MainWindow : public QMainWindow
|
||||||
void PrevRowSlot();
|
void PrevRowSlot();
|
||||||
void ClearRowSlot();
|
void ClearRowSlot();
|
||||||
|
|
||||||
void LevelChangedSlot();
|
void mColorCntChangedSlot();
|
||||||
|
void PegCntChangedSlot();
|
||||||
|
|
||||||
void UpdateRowMenuSlot();
|
void UpdateRowMenuSlot();
|
||||||
|
|
||||||
|
void GetGuessSlot();
|
||||||
|
|
||||||
void TestSlot();
|
void TestSlot();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum Level { LEVEL_EASY,
|
static const int mLevelSettings[5][3];
|
||||||
LEVEL_MEDIUM,
|
|
||||||
LEVEL_HARD };
|
|
||||||
|
|
||||||
static Level mLevel;
|
static int mLevel;
|
||||||
static int mColorCnt;
|
static int mColorCnt;
|
||||||
|
static int mPegCnt;
|
||||||
|
static int mDoubles;
|
||||||
static int mMaxZ;
|
static int mMaxZ;
|
||||||
|
static int mXOffs;
|
||||||
|
|
||||||
|
volatile static bool mNoAct;
|
||||||
|
|
||||||
int mGameState;
|
int mGameState;
|
||||||
|
int mGameId;
|
||||||
|
int mGuessCnt;
|
||||||
|
|
||||||
std::vector<int> mSolution;
|
std::vector<int> mSolution;
|
||||||
|
|
||||||
|
@ -98,29 +133,37 @@ class MainWindow : public QMainWindow
|
||||||
QGraphicsView* view;
|
QGraphicsView* view;
|
||||||
QSize* mOrigSize;
|
QSize* mOrigSize;
|
||||||
|
|
||||||
|
CCSolver* mSolver;
|
||||||
Msg* mMsg;
|
Msg* mMsg;
|
||||||
|
BackGround* mBg;
|
||||||
|
|
||||||
PegRow* mCurRow;
|
PegRow* mCurRow;
|
||||||
|
|
||||||
|
std::vector<ColorPeg *> mAllPegs;
|
||||||
std::vector<ColorPeg *> mPegBuff;
|
std::vector<ColorPeg *> mPegBuff;
|
||||||
PegRow* mSolRow;
|
SolRow* mSolRow;
|
||||||
PegRow* mPegRows[10];
|
PegRow* mPegRows[10];
|
||||||
RowHint* mHintBtns[10];
|
RowHint* mHintBtns[10];
|
||||||
|
|
||||||
PegType* mTypesMap[10];
|
PegType* mTypesMap[10];
|
||||||
|
QRadialGradient mGradMap[10];
|
||||||
|
QRadialGradient mGradBuff[10];
|
||||||
ColorPeg* mPegBtns[10];
|
ColorPeg* mPegBtns[10];
|
||||||
ColorPeg* mSolPegs[4];
|
ColorPeg** mSolPegs;
|
||||||
QPoint mBtnPos[10];
|
QPoint mBtnPos[10];
|
||||||
|
|
||||||
void FillTypesMap();
|
void InitTypesMap();
|
||||||
|
|
||||||
void InitSolution();
|
void InitSolution();
|
||||||
void InitActions();
|
void InitActions();
|
||||||
void InitMenus();
|
void InitMenus();
|
||||||
void InitToolBars();
|
void InitToolBars();
|
||||||
|
|
||||||
void SetLevel();
|
void SetPegCnt();
|
||||||
|
void SetColorCnt();
|
||||||
|
void CheckLevel();
|
||||||
|
void CheckSameColorsSetting();
|
||||||
void SetState(const int s);
|
void SetState(const int s);
|
||||||
|
void ResetGame();
|
||||||
void NewGame();
|
void NewGame();
|
||||||
void SetSolution();
|
void SetSolution();
|
||||||
void ShowSolution();
|
void ShowSolution();
|
||||||
|
@ -138,10 +181,13 @@ class MainWindow : public QMainWindow
|
||||||
QMenu* LevelMenu;
|
QMenu* LevelMenu;
|
||||||
QMenu* HelpMenu;
|
QMenu* HelpMenu;
|
||||||
QMenu* RowContextMenu;
|
QMenu* RowContextMenu;
|
||||||
|
QMenuBar* mMenuBar;
|
||||||
QToolBar* mGameToolbar;
|
QToolBar* mGameToolbar;
|
||||||
QToolBar* mLevelToolbar;
|
QToolBar* mLevelToolbar;
|
||||||
|
|
||||||
QComboBox* mLevelCmb;
|
QComboBox* mColorCntCmb;
|
||||||
|
QComboBox* mPegCntCmb;
|
||||||
|
QLabel* mStatusLabel;
|
||||||
|
|
||||||
QActionGroup* mLevelActions;
|
QActionGroup* mLevelActions;
|
||||||
QAction* NewGameAction;
|
QAction* NewGameAction;
|
||||||
|
@ -151,19 +197,28 @@ class MainWindow : public QMainWindow
|
||||||
QAction* ShowMenubarAction;
|
QAction* ShowMenubarAction;
|
||||||
QAction* ShowStatusbarAction;
|
QAction* ShowStatusbarAction;
|
||||||
QAction* SameColorAction;
|
QAction* SameColorAction;
|
||||||
|
QAction* mActResetColorsOrder;
|
||||||
|
QAction* mActShowLetter;
|
||||||
|
QAction* mActSameColorIcon;
|
||||||
QAction* AutoCloseAction;
|
QAction* AutoCloseAction;
|
||||||
QAction* AboutAction;
|
QAction* AboutAction;
|
||||||
QAction* AboutQtAction;
|
QAction* AboutQtAction;
|
||||||
QAction* ExitAction;
|
QAction* ExitAction;
|
||||||
|
|
||||||
|
QAction* mActSetPegCnt;
|
||||||
|
|
||||||
QAction* mActLevelEasy;
|
QAction* mActLevelEasy;
|
||||||
|
QAction* mActLevelClassic;
|
||||||
QAction* mActLevelMedium;
|
QAction* mActLevelMedium;
|
||||||
|
QAction* mActLevelChallenging;
|
||||||
QAction* mActLevelHard;
|
QAction* mActLevelHard;
|
||||||
|
QAction* mLaunchHelpAction;
|
||||||
|
|
||||||
QAction* RandRowAction;
|
QAction* RandRowAction;
|
||||||
QAction* PrevRowAction;
|
QAction* PrevRowAction;
|
||||||
QAction* ClearRowAction;
|
QAction* ClearRowAction;
|
||||||
|
|
||||||
|
QAction* mActGetGuess;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // COLORCODE_H
|
|
@ -1,12 +1,39 @@
|
||||||
|
/* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
|
|
||||||
#include "colorpeg.h"
|
#include "colorpeg.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
const QFont ColorPeg::mFont = ColorPeg::GetLetterFont();
|
||||||
const QBrush ColorPeg::mShadowBrush = ColorPeg::GetShadowBrush();
|
const QBrush ColorPeg::mShadowBrush = ColorPeg::GetShadowBrush();
|
||||||
const QPen ColorPeg::mPen = ColorPeg::GetOutlinePen();
|
const QBrush ColorPeg::mOutlineBrush = ColorPeg::GetOutlineBrush();
|
||||||
|
const QBrush ColorPeg::mGlossyBrush = ColorPeg::GetGlossyBrush();
|
||||||
|
|
||||||
|
QFont ColorPeg::GetLetterFont()
|
||||||
|
{
|
||||||
|
QFont lf("Arial", 12, QFont::Bold, false);
|
||||||
|
lf.setStyleHint(QFont::SansSerif);
|
||||||
|
|
||||||
|
return lf;
|
||||||
|
}
|
||||||
|
|
||||||
QBrush ColorPeg::GetShadowBrush()
|
QBrush ColorPeg::GetShadowBrush()
|
||||||
{
|
{
|
||||||
|
@ -17,12 +44,20 @@ QBrush ColorPeg::GetShadowBrush()
|
||||||
return QBrush(rgrad);
|
return QBrush(rgrad);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPen ColorPeg::GetOutlinePen()
|
QBrush ColorPeg::GetOutlineBrush()
|
||||||
{
|
{
|
||||||
QRadialGradient rgrad(20, 20, 32, 0, 0);
|
QLinearGradient lgrad(0, 0, 38, 38);
|
||||||
rgrad.setColorAt(0.0, Qt::black);
|
lgrad.setColorAt(0.0, QColor(0, 0, 0, 0xa0));
|
||||||
rgrad.setColorAt(1.0, Qt::white);
|
lgrad.setColorAt(1.0, QColor(0xff, 0xff, 0xff, 0xa0));
|
||||||
return QPen(QBrush(rgrad), 2);
|
return QBrush(lgrad);
|
||||||
|
}
|
||||||
|
|
||||||
|
QBrush ColorPeg::GetGlossyBrush()
|
||||||
|
{
|
||||||
|
QLinearGradient lgrad(20, 4, 20, 20);
|
||||||
|
lgrad.setColorAt(0.0, QColor(0xff, 0xff, 0xff, 0x80));
|
||||||
|
lgrad.setColorAt(1.0, QColor(0xff, 0xff, 0xff, 0x00));
|
||||||
|
return QBrush(lgrad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,6 +68,8 @@ ColorPeg::ColorPeg(QObject*)
|
||||||
mPegRow = NULL;
|
mPegRow = NULL;
|
||||||
SetBtn(true);
|
SetBtn(true);
|
||||||
mIsDragged = false;
|
mIsDragged = false;
|
||||||
|
mShowLetter = false;
|
||||||
|
mSort = 0;
|
||||||
mId = -1;
|
mId = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,6 +103,11 @@ bool ColorPeg::IsBtn() const
|
||||||
return mIsBtn;
|
return mIsBtn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ColorPeg::GetSort() const
|
||||||
|
{
|
||||||
|
return mSort;
|
||||||
|
}
|
||||||
|
|
||||||
void ColorPeg::SetBtn(bool b)
|
void ColorPeg::SetBtn(bool b)
|
||||||
{
|
{
|
||||||
mIsBtn = b;
|
mIsBtn = b;
|
||||||
|
@ -105,23 +147,43 @@ void ColorPeg::SetIsDragged(bool b)
|
||||||
void ColorPeg::SetEnabled(const bool b)
|
void ColorPeg::SetEnabled(const bool b)
|
||||||
{
|
{
|
||||||
setEnabled(b);
|
setEnabled(b);
|
||||||
//setFlags(QGraphicsItem::GraphicsItemFlags(0));
|
|
||||||
SetCursorShape();
|
SetCursorShape();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ColorPeg::ShowLetter(const bool b)
|
||||||
|
{
|
||||||
|
if (mShowLetter != b)
|
||||||
|
{
|
||||||
|
mShowLetter = b;
|
||||||
|
update(boundingRect());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ColorPeg::SetCursorShape(Qt::CursorShape shape, const bool force)
|
void ColorPeg::SetCursorShape(Qt::CursorShape shape, const bool force)
|
||||||
{
|
{
|
||||||
if (!force)
|
if (!force)
|
||||||
{
|
{
|
||||||
if (mIsDragged)
|
if (mIsDragged)
|
||||||
|
{
|
||||||
|
if (mSort == 0)
|
||||||
{
|
{
|
||||||
shape = Qt::ClosedHandCursor;
|
shape = Qt::ClosedHandCursor;
|
||||||
}
|
}
|
||||||
|
else if (mSort == 1)
|
||||||
|
{
|
||||||
|
shape = Qt::SizeVerCursor;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
shape = Qt::SplitVCursor;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (isEnabled())
|
else if (isEnabled())
|
||||||
{
|
{
|
||||||
shape = Qt::OpenHandCursor;
|
shape = Qt::OpenHandCursor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursor().shape() != shape)
|
if (cursor().shape() != shape)
|
||||||
{
|
{
|
||||||
setCursor(QCursor(shape));
|
setCursor(QCursor(shape));
|
||||||
|
@ -130,16 +192,7 @@ void ColorPeg::SetCursorShape(Qt::CursorShape shape, const bool force)
|
||||||
|
|
||||||
QVariant ColorPeg::itemChange(GraphicsItemChange change, const QVariant &value)
|
QVariant ColorPeg::itemChange(GraphicsItemChange change, const QVariant &value)
|
||||||
{
|
{
|
||||||
if (change == ItemPositionHasChanged)
|
if (change == ItemSelectedHasChanged)
|
||||||
{
|
|
||||||
}
|
|
||||||
else if (change == ItemPositionChange)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
else if (change == ItemFlagsChange)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
else if (change == ItemSelectedHasChanged)
|
|
||||||
{
|
{
|
||||||
scene()->update(scene()->sceneRect());
|
scene()->update(scene()->sceneRect());
|
||||||
}
|
}
|
||||||
|
@ -148,21 +201,38 @@ QVariant ColorPeg::itemChange(GraphicsItemChange change, const QVariant &value)
|
||||||
|
|
||||||
void ColorPeg::mousePressEvent(QGraphicsSceneMouseEvent *e)
|
void ColorPeg::mousePressEvent(QGraphicsSceneMouseEvent *e)
|
||||||
{
|
{
|
||||||
|
QGraphicsItem::mousePressEvent(e);
|
||||||
if (mPegType != NULL)
|
if (mPegType != NULL)
|
||||||
{
|
{
|
||||||
if (e->button() == Qt::LeftButton)
|
if (e->button() == Qt::LeftButton)
|
||||||
{
|
{
|
||||||
Reset();
|
Reset();
|
||||||
SetIsDragged(true);
|
SetIsDragged(true);
|
||||||
|
if (IsBtn() && (e->modifiers() & Qt::ControlModifier) != 0)
|
||||||
|
{
|
||||||
|
if ((e->modifiers() & Qt::ShiftModifier) == 0)
|
||||||
|
{
|
||||||
|
mSort = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mSort = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mSort = 0;
|
||||||
|
|
||||||
|
}
|
||||||
emit PegPressSignal(this);
|
emit PegPressSignal(this);
|
||||||
SetCursorShape();
|
SetCursorShape();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QGraphicsItem::mousePressEvent(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorPeg::mouseReleaseEvent (QGraphicsSceneMouseEvent *e)
|
void ColorPeg::mouseReleaseEvent (QGraphicsSceneMouseEvent *e)
|
||||||
{
|
{
|
||||||
|
QGraphicsItem::mouseReleaseEvent(e);
|
||||||
if (mPegType != NULL)
|
if (mPegType != NULL)
|
||||||
{
|
{
|
||||||
if (e->button() == Qt::LeftButton)
|
if (e->button() == Qt::LeftButton)
|
||||||
|
@ -172,7 +242,6 @@ void ColorPeg::mouseReleaseEvent (QGraphicsSceneMouseEvent *e)
|
||||||
SetCursorShape();
|
SetCursorShape();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QGraphicsItem::mouseReleaseEvent(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QPainterPath ColorPeg::shape() const
|
QPainterPath ColorPeg::shape() const
|
||||||
|
@ -202,31 +271,39 @@ QRectF ColorPeg::outlineRect() const
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QRectF ColorPeg::GetColorRect() const
|
||||||
|
{
|
||||||
|
QRectF rect(1.0, 1.0, 34.0, 34.0);
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
||||||
void ColorPeg::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget* /* widget */)
|
void ColorPeg::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget* /* widget */)
|
||||||
{
|
|
||||||
/*
|
|
||||||
QPen pen(Qt::red);
|
|
||||||
pen.setWidth(2);
|
|
||||||
if (option->state & QStyle::State_Selected)
|
|
||||||
{
|
|
||||||
pen.setStyle(Qt::DotLine);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
if (mIsDragged)
|
|
||||||
{
|
{
|
||||||
painter->setPen(Qt::NoPen);
|
painter->setPen(Qt::NoPen);
|
||||||
|
|
||||||
|
if (!mIsDragged)
|
||||||
|
{
|
||||||
|
painter->setBrush(ColorPeg::mOutlineBrush);
|
||||||
|
painter->drawEllipse(outlineRect());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
painter->translate(QPointF(-2, -2));
|
painter->translate(QPointF(-2, -2));
|
||||||
painter->setBrush(ColorPeg::mShadowBrush);
|
painter->setBrush(ColorPeg::mShadowBrush);
|
||||||
painter->drawEllipse(QRectF(0, 0, 44, 44));
|
painter->drawEllipse(QRectF(0, 0, 44, 44));
|
||||||
painter->translate(QPointF(2, 2));
|
painter->translate(QPointF(2, 2));
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
painter->setPen(ColorPeg::mPen);
|
|
||||||
}
|
|
||||||
|
|
||||||
painter->setBrush(QBrush(mPegType->grad));
|
painter->setBrush(QBrush(*mPegType->grad));
|
||||||
painter->drawEllipse(outlineRect());
|
painter->drawEllipse(GetColorRect());
|
||||||
|
painter->setBrush(mGlossyBrush);
|
||||||
|
painter->drawEllipse(QRectF(5, 3, 24, 20));
|
||||||
|
|
||||||
|
if (mShowLetter)
|
||||||
|
{
|
||||||
|
painter->setPen(QPen(QColor("#303133")));
|
||||||
|
painter->setRenderHint(QPainter::TextAntialiasing, true);
|
||||||
|
painter->setFont(mFont);
|
||||||
|
painter->drawText(QRectF(1.5, 2.0, 32.0, 32.0), Qt::AlignCenter, QString(mPegType->let));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,21 @@
|
||||||
|
/* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef COLORPEG_H
|
#ifndef COLORPEG_H
|
||||||
#define COLORPEG_H
|
#define COLORPEG_H
|
||||||
|
|
||||||
|
@ -7,7 +25,7 @@
|
||||||
#include <QGraphicsItem>
|
#include <QGraphicsItem>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "mainwindow.h"
|
#include "colorcode.h"
|
||||||
#include "pegrow.h"
|
#include "pegrow.h"
|
||||||
#include "rowhint.h"
|
#include "rowhint.h"
|
||||||
|
|
||||||
|
@ -15,7 +33,6 @@
|
||||||
class ColorPeg : public QObject, public QGraphicsItem
|
class ColorPeg : public QObject, public QGraphicsItem
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
//Q_DECLARE_TR_FUNCTIONS(ColorPeg)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ColorPeg(QObject* parent = 0);
|
ColorPeg(QObject* parent = 0);
|
||||||
|
@ -33,6 +50,7 @@ public:
|
||||||
|
|
||||||
void SetType(const int t);
|
void SetType(const int t);
|
||||||
void SetEnabled(const bool b);
|
void SetEnabled(const bool b);
|
||||||
|
void ShowLetter(const bool b);
|
||||||
void SetCursorShape( Qt::CursorShape shape = Qt::ArrowCursor, const bool force = false);
|
void SetCursorShape( Qt::CursorShape shape = Qt::ArrowCursor, const bool force = false);
|
||||||
PegType* GetPegType();
|
PegType* GetPegType();
|
||||||
int GetType() const;
|
int GetType() const;
|
||||||
|
@ -40,12 +58,14 @@ public:
|
||||||
QColor GetBrushColor() const;
|
QColor GetBrushColor() const;
|
||||||
|
|
||||||
bool IsBtn() const;
|
bool IsBtn() const;
|
||||||
|
int GetSort() const;
|
||||||
void SetBtn(bool b);
|
void SetBtn(bool b);
|
||||||
void Reset();
|
void Reset();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void PegReleasedSignal(ColorPeg* cp);
|
void PegReleasedSignal(ColorPeg* cp);
|
||||||
void PegPressSignal(ColorPeg* cp);
|
void PegPressSignal(ColorPeg* cp);
|
||||||
|
void PegSortSignal(ColorPeg* cp);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PegType* mPegType;
|
PegType* mPegType;
|
||||||
|
@ -55,11 +75,16 @@ protected:
|
||||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent* e);
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent* e);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static const QFont mFont;
|
||||||
|
static QFont GetLetterFont();
|
||||||
static const QBrush mShadowBrush;
|
static const QBrush mShadowBrush;
|
||||||
static QBrush GetShadowBrush();
|
static QBrush GetShadowBrush();
|
||||||
static const QPen mPen;
|
static const QBrush mOutlineBrush;
|
||||||
static QPen GetOutlinePen();
|
static QBrush GetOutlineBrush();
|
||||||
|
static const QBrush mGlossyBrush;
|
||||||
|
static QBrush GetGlossyBrush();
|
||||||
|
|
||||||
|
QRectF GetColorRect() const;
|
||||||
QRectF outlineRect() const;
|
QRectF outlineRect() const;
|
||||||
void SetIsDragged(bool b);
|
void SetIsDragged(bool b);
|
||||||
|
|
||||||
|
@ -68,8 +93,10 @@ private:
|
||||||
const QBrush mBrush;
|
const QBrush mBrush;
|
||||||
|
|
||||||
int mType;
|
int mType;
|
||||||
|
int mSort;
|
||||||
bool mIsBtn;
|
bool mIsBtn;
|
||||||
bool mIsDragged;
|
bool mIsDragged;
|
||||||
|
bool mShowLetter;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Binary file not shown.
BIN
plugins/ColorCode_plugin/img/business_user.png
Normal file
BIN
plugins/ColorCode_plugin/img/business_user.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 768 B |
BIN
plugins/ColorCode_plugin/img/gplv3-80x32.png
Normal file
BIN
plugins/ColorCode_plugin/img/gplv3-80x32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
BIN
plugins/ColorCode_plugin/img/help.png
Normal file
BIN
plugins/ColorCode_plugin/img/help.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
BIN
plugins/ColorCode_plugin/img/same_color_0.png
Normal file
BIN
plugins/ColorCode_plugin/img/same_color_0.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 774 B |
BIN
plugins/ColorCode_plugin/img/same_color_1.png
Normal file
BIN
plugins/ColorCode_plugin/img/same_color_1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 618 B |
|
@ -1,9 +1,27 @@
|
||||||
|
/* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <QtGui/QApplication>
|
#include <QtGui/QApplication>
|
||||||
#include <QLibraryInfo>
|
#include <QLibraryInfo>
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
#include "mainwindow.h"
|
#include "colorcode.h"
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
|
@ -20,13 +38,13 @@ int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
cout << "usage: ColorCode [options]" << endl;
|
cout << "usage: ColorCode [options]" << endl;
|
||||||
cout << " options:" << endl;
|
cout << " options:" << endl;
|
||||||
cout << " -l cc, --lang=cc use country code cc instead of system locale, accepted values for cc: en|de" << endl;
|
cout << " -l cc, --lang=cc use country code cc instead of system locale, accepted values for cc: en|de|cs" << endl;
|
||||||
cout << " -h, --help prints this message ;-)" << endl;
|
cout << " -h, --help prints this message ;-)" << endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (str == "-l" && i < argc - 1)
|
else if (str == "-l" && i < argc - 1)
|
||||||
{
|
{
|
||||||
if (std::string(argv[i + 1]) == "de" || std::string(argv[i + 1]) == "en")
|
if (std::string(argv[i + 1]) == "de" || std::string(argv[i + 1]) == "en" || std::string(argv[i + 1]) == "cs")
|
||||||
{
|
{
|
||||||
std::string test(argv[i]);
|
std::string test(argv[i]);
|
||||||
lang = argv[i + 1];
|
lang = argv[i + 1];
|
||||||
|
@ -34,7 +52,7 @@ int main(int argc, char* argv[])
|
||||||
}
|
}
|
||||||
else if ( str.size() == 9
|
else if ( str.size() == 9
|
||||||
&& str.find("--lang=") != string::npos
|
&& str.find("--lang=") != string::npos
|
||||||
&& (str.substr(7) == "en" || str.substr(7) == "de") )
|
&& (str.substr(7) == "en" || str.substr(7) == "de" || str.substr(7) == "cs") )
|
||||||
{
|
{
|
||||||
lang = str.substr(7);
|
lang = str.substr(7);
|
||||||
}
|
}
|
||||||
|
@ -57,7 +75,7 @@ int main(int argc, char* argv[])
|
||||||
QTranslator appTranslator;
|
QTranslator appTranslator;
|
||||||
if (lang == "")
|
if (lang == "")
|
||||||
{
|
{
|
||||||
appTranslator.load("trans_" + QLocale::system().name());
|
appTranslator.load(":/trans_" + QLocale::system().name());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -65,7 +83,7 @@ int main(int argc, char* argv[])
|
||||||
}
|
}
|
||||||
app.installTranslator(&appTranslator);
|
app.installTranslator(&appTranslator);
|
||||||
|
|
||||||
MainWindow w;
|
ColorCode w;
|
||||||
w.show();
|
w.show();
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,3 +1,21 @@
|
||||||
|
/* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
|
|
||||||
#include "msg.h"
|
#include "msg.h"
|
||||||
|
@ -6,21 +24,7 @@ using namespace std;
|
||||||
|
|
||||||
Msg::Msg()
|
Msg::Msg()
|
||||||
{
|
{
|
||||||
/*
|
mFont = QFont("Arial", 12, QFont::Bold, false);
|
||||||
setFont(QFont("Arial", 14, QFont::Bold, false));
|
|
||||||
setDefaultTextColor(QColor("#cccccc"));
|
|
||||||
setTextWidth(300);
|
|
||||||
|
|
||||||
mTd = new QTextDocument();
|
|
||||||
mTd->setDefaultFont(QFont("Arial", 14, QFont::Bold, false));
|
|
||||||
mTd->setTextWidth(300);
|
|
||||||
|
|
||||||
|
|
||||||
//QAbstractTextDocumentLayout* lay = mTd->documentLayout();
|
|
||||||
|
|
||||||
setDocument(mTd);
|
|
||||||
*/
|
|
||||||
mFont = QFont("Arial", 14, QFont::Bold, false);
|
|
||||||
mFont.setStyleHint(QFont::SansSerif);
|
mFont.setStyleHint(QFont::SansSerif);
|
||||||
mLay = new QTextLayout();
|
mLay = new QTextLayout();
|
||||||
mLay->setFont(mFont);
|
mLay->setFont(mFont);
|
||||||
|
@ -34,13 +38,10 @@ Msg::~Msg()
|
||||||
|
|
||||||
void Msg::ShowMsg(const QString str)
|
void Msg::ShowMsg(const QString str)
|
||||||
{
|
{
|
||||||
//setPlainText(str);
|
|
||||||
//mTd->clear();
|
|
||||||
//mTd->setPlainText(str);
|
|
||||||
mUpdateRect = boundingRect();
|
mUpdateRect = boundingRect();
|
||||||
|
|
||||||
mLay->setText(str);
|
mLay->setText(str);
|
||||||
int leading = -3;//fontMetrics.leading();
|
int leading = -3;
|
||||||
qreal h = 10;
|
qreal h = 10;
|
||||||
qreal maxw = 0;
|
qreal maxw = 0;
|
||||||
qreal maxh = 0;
|
qreal maxh = 0;
|
||||||
|
@ -62,7 +63,6 @@ void Msg::ShowMsg(const QString str)
|
||||||
}
|
}
|
||||||
mLay->endLayout();
|
mLay->endLayout();
|
||||||
|
|
||||||
|
|
||||||
maxw = qMax(mUpdateRect.width(), mLay->boundingRect().width());
|
maxw = qMax(mUpdateRect.width(), mLay->boundingRect().width());
|
||||||
maxh = qMax(mUpdateRect.height(), mLay->boundingRect().height() + 8);
|
maxh = qMax(mUpdateRect.height(), mLay->boundingRect().height() + 8);
|
||||||
mUpdateRect = QRectF(0, 0, maxw, maxh);
|
mUpdateRect = QRectF(0, 0, maxw, maxh);
|
||||||
|
@ -77,7 +77,7 @@ QRectF Msg::boundingRect() const
|
||||||
|
|
||||||
void Msg::paint(QPainter* painter, const QStyleOptionGraphicsItem* /*option*/, QWidget* /* widget */)
|
void Msg::paint(QPainter* painter, const QStyleOptionGraphicsItem* /*option*/, QWidget* /* widget */)
|
||||||
{
|
{
|
||||||
//painter->setBrush(Qt::NoBrush);
|
painter->setRenderHint(QPainter::TextAntialiasing, true);
|
||||||
painter->setPen(QPen(QColor("#f0f0f0")));
|
painter->setPen(QPen(QColor("#303133")));
|
||||||
mLay->draw(painter, QPoint(0, 0));
|
mLay->draw(painter, QPoint(0, 0));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,21 @@
|
||||||
|
/* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef MSG_H
|
#ifndef MSG_H
|
||||||
#define MSG_H
|
#define MSG_H
|
||||||
|
|
||||||
|
@ -19,10 +37,6 @@ public:
|
||||||
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
|
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/*
|
|
||||||
QTextDocument* mTd;
|
|
||||||
QTextBlock mTb;
|
|
||||||
*/
|
|
||||||
QTextLayout* mLay;
|
QTextLayout* mLay;
|
||||||
QFont mFont;
|
QFont mFont;
|
||||||
QRectF mUpdateRect;
|
QRectF mUpdateRect;
|
||||||
|
|
|
@ -1,3 +1,21 @@
|
||||||
|
/* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
|
|
||||||
#include "colorpeg.h"
|
#include "colorpeg.h"
|
||||||
|
@ -9,32 +27,41 @@ using namespace std;
|
||||||
PegRow::PegRow(QObject*)
|
PegRow::PegRow(QObject*)
|
||||||
{
|
{
|
||||||
mIx = -1;
|
mIx = -1;
|
||||||
|
mPegCnt = 0;
|
||||||
|
mXOffs = 0;
|
||||||
|
mPend = QColor("#646568");
|
||||||
|
mPenl = QColor("#ecedef");
|
||||||
|
mGrad0 = QColor("#cccdcf");
|
||||||
|
mGrad1 = QColor("#fcfdff");
|
||||||
|
|
||||||
//setFlags(QGraphicsItem::GraphicsItemFlags(0));
|
mColorPegs = NULL;
|
||||||
|
|
||||||
mPen = QPen(QColor("#808080"));
|
Reset(0);
|
||||||
|
|
||||||
for (int i = 0; i < 4; ++i)
|
|
||||||
{
|
|
||||||
mColorPegs[i] = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
Reset();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PegRow::~PegRow()
|
PegRow::~PegRow()
|
||||||
{
|
{
|
||||||
|
for (int i = 0; i < mPegCnt; ++i)
|
||||||
|
{
|
||||||
|
delete mColorPegs[i];
|
||||||
|
}
|
||||||
|
delete [] mColorPegs;
|
||||||
|
mColorPegs = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PegRow::Reset()
|
void PegRow::Reset(const int pegcnt)
|
||||||
{
|
{
|
||||||
ClearRow();
|
ClearRow();
|
||||||
SetActive(false);
|
SetActive(false);
|
||||||
|
mSolved = false;
|
||||||
|
SetPegCnt(pegcnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PegRow::ClearRow()
|
void PegRow::ClearRow()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 4; ++i)
|
if (mColorPegs == NULL) { return; };
|
||||||
|
|
||||||
|
for (int i = 0; i < mPegCnt; ++i)
|
||||||
{
|
{
|
||||||
if (mColorPegs[i] != NULL)
|
if (mColorPegs[i] != NULL)
|
||||||
{
|
{
|
||||||
|
@ -53,11 +80,32 @@ void PegRow::SetIx(const int ix)
|
||||||
mIx = 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;
|
||||||
|
}
|
||||||
|
mXOffs = 100 - mPegCnt * 20;
|
||||||
|
}
|
||||||
|
|
||||||
int PegRow::GetPegCnt()
|
int PegRow::GetPegCnt()
|
||||||
{
|
{
|
||||||
|
if (mColorPegs == NULL) { return 0; };
|
||||||
|
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (i = 0; i < 4; ++i)
|
for (i = 0; i < mPegCnt; ++i)
|
||||||
{
|
{
|
||||||
if (mColorPegs[i] != NULL)
|
if (mColorPegs[i] != NULL)
|
||||||
{
|
{
|
||||||
|
@ -75,19 +123,15 @@ ColorPeg** PegRow::GetPegs()
|
||||||
void PegRow::SetActive(const bool b)
|
void PegRow::SetActive(const bool b)
|
||||||
{
|
{
|
||||||
mIsActive = b;
|
mIsActive = b;
|
||||||
if (b)
|
|
||||||
{
|
|
||||||
setOpacity(1.0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setOpacity(0.5);
|
|
||||||
}
|
|
||||||
update(boundingRect());
|
update(boundingRect());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PegRow::SnapCP(ColorPeg *cp)
|
bool PegRow::SnapCP(ColorPeg *cp)
|
||||||
{
|
{
|
||||||
|
if (mColorPegs == NULL)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool snapped = false;
|
bool snapped = false;
|
||||||
if (mIsActive)
|
if (mIsActive)
|
||||||
|
@ -102,9 +146,9 @@ bool PegRow::SnapCP(ColorPeg *cp)
|
||||||
|
|
||||||
if (p.y() >= 0 && p.y() <= 40)
|
if (p.y() >= 0 && p.y() <= 40)
|
||||||
{
|
{
|
||||||
for (i = 0; i < 4; ++i)
|
for (i = 0; i < mPegCnt; ++i)
|
||||||
{
|
{
|
||||||
if (p.x() >= i * 40 && p.x() < (i + 1) * 40)
|
if (p.x() >= mXOffs + i * 40 && p.x() < mXOffs + (i + 1) * 40)
|
||||||
{
|
{
|
||||||
if (mColorPegs[i] != NULL)
|
if (mColorPegs[i] != NULL)
|
||||||
{
|
{
|
||||||
|
@ -114,7 +158,7 @@ bool PegRow::SnapCP(ColorPeg *cp)
|
||||||
mColorPegs[i] = cp;
|
mColorPegs[i] = cp;
|
||||||
cp->SetPegRow(this);
|
cp->SetPegRow(this);
|
||||||
ix = i;
|
ix = i;
|
||||||
cp->setPos(mapToParent(i * 40 + 2, 2));
|
cp->setPos(mapToParent(mXOffs + i * 40 + 2, 2));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,6 +173,16 @@ bool PegRow::SnapCP(ColorPeg *cp)
|
||||||
|
|
||||||
void PegRow::ForceSnap(ColorPeg* cp, int posix)
|
void PegRow::ForceSnap(ColorPeg* cp, int posix)
|
||||||
{
|
{
|
||||||
|
if (mColorPegs == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (posix > mPegCnt - 1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (mIsActive)
|
if (mIsActive)
|
||||||
{
|
{
|
||||||
if (mColorPegs[posix] != NULL)
|
if (mColorPegs[posix] != NULL)
|
||||||
|
@ -138,7 +192,7 @@ void PegRow::ForceSnap(ColorPeg* cp, int posix)
|
||||||
}
|
}
|
||||||
mColorPegs[posix] = cp;
|
mColorPegs[posix] = cp;
|
||||||
cp->SetPegRow(this);
|
cp->SetPegRow(this);
|
||||||
cp->setPos(mapToParent(posix * 40 + 2, 2));
|
cp->setPos(mapToParent(mXOffs + posix * 40 + 2, 2));
|
||||||
|
|
||||||
CheckSolution();
|
CheckSolution();
|
||||||
}
|
}
|
||||||
|
@ -146,26 +200,36 @@ void PegRow::ForceSnap(ColorPeg* cp, int posix)
|
||||||
|
|
||||||
void PegRow::CloseRow()
|
void PegRow::CloseRow()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 4; ++i)
|
mSolved = true;
|
||||||
|
if (mColorPegs == NULL)
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < mPegCnt; ++i)
|
||||||
{
|
{
|
||||||
if (mColorPegs[i] != NULL)
|
if (mColorPegs[i] != NULL)
|
||||||
{
|
{
|
||||||
mColorPegs[i]->SetEnabled(false);
|
mColorPegs[i]->SetEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
SetActive(false);
|
SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PegRow::CheckSolution()
|
void PegRow::CheckSolution()
|
||||||
{
|
{
|
||||||
mSolution.clear();
|
mSolution.clear();
|
||||||
|
if (mColorPegs == NULL)
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 4; ++i)
|
for (int i = 0; i < mPegCnt; ++i)
|
||||||
{
|
{
|
||||||
if (mColorPegs[i] != NULL)
|
if (mColorPegs[i] != NULL)
|
||||||
{
|
{
|
||||||
//mColorPegs[i]->setEnabled(false);
|
|
||||||
//mColorPegs[i]->setFlags(QGraphicsItem::GraphicsItemFlags(0));
|
|
||||||
mSolution.push_back(mColorPegs[i]->GetPegType()->ix);
|
mSolution.push_back(mColorPegs[i]->GetPegType()->ix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -180,7 +244,12 @@ std::vector<int> PegRow::GetSolution() const
|
||||||
|
|
||||||
void PegRow::RemovePeg(ColorPeg *cp)
|
void PegRow::RemovePeg(ColorPeg *cp)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 4; ++i)
|
if (mColorPegs == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < mPegCnt; ++i)
|
||||||
{
|
{
|
||||||
if (mColorPegs[i] == cp)
|
if (mColorPegs[i] == cp)
|
||||||
{
|
{
|
||||||
|
@ -213,26 +282,52 @@ QRectF PegRow::boundingRect() const
|
||||||
|
|
||||||
QRectF PegRow::outlineRect() const
|
QRectF PegRow::outlineRect() const
|
||||||
{
|
{
|
||||||
return QRectF(0.0, 0.0, 160.0, 40.0);
|
return QRectF(0.0, 0.0, 200.0, 40.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PegRow::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* /* widget */)
|
void PegRow::paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget* /* widget */)
|
||||||
{
|
{
|
||||||
mPen.setWidth(2);
|
if (mPegCnt == 0)
|
||||||
if (option->state & QStyle::State_Selected)
|
|
||||||
{
|
{
|
||||||
mPen.setStyle(Qt::DotLine);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
painter->setPen(mPen);
|
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;
|
int i;
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < mPegCnt; i++)
|
||||||
{
|
{
|
||||||
QRadialGradient grad(QPointF(i * 40 + 10, 10), 100);
|
painter->setBrush(QBrush(mPenl));
|
||||||
grad.setColorAt(0, QColor("#cccccc"));
|
painter->drawRect(QRectF(mXOffs + i * 40, 0.0, 39, 1));
|
||||||
grad.setColorAt(1, QColor("#ffffff"));
|
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->setBrush(QBrush(grad));
|
||||||
painter->drawRect(QRectF(i * 40, 0.0, 40.0, 40.0));
|
painter->drawRect(QRectF(mXOffs + i * 40 + 1, 1.0, 38.0, 38.0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,21 @@
|
||||||
|
/* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef PEGROW_H
|
#ifndef PEGROW_H
|
||||||
#define PEGROW_H
|
#define PEGROW_H
|
||||||
|
|
||||||
|
@ -8,7 +26,7 @@
|
||||||
#include <QGraphicsItem>
|
#include <QGraphicsItem>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "mainwindow.h"
|
#include "colorcode.h"
|
||||||
#include "pegrow.h"
|
#include "pegrow.h"
|
||||||
#include "colorpeg.h"
|
#include "colorpeg.h"
|
||||||
|
|
||||||
|
@ -25,6 +43,7 @@ public:
|
||||||
ColorPeg** GetPegs();
|
ColorPeg** GetPegs();
|
||||||
std::vector<int> GetSolution() const;
|
std::vector<int> GetSolution() const;
|
||||||
void SetIx(const int ix);
|
void SetIx(const int ix);
|
||||||
|
void SetPegCnt(const int pegcnt);
|
||||||
void SetActive(const bool b);
|
void SetActive(const bool b);
|
||||||
bool SnapCP(ColorPeg* cp);
|
bool SnapCP(ColorPeg* cp);
|
||||||
void ForceSnap(ColorPeg* cp, int posix);
|
void ForceSnap(ColorPeg* cp, int posix);
|
||||||
|
@ -32,7 +51,7 @@ public:
|
||||||
|
|
||||||
void CloseRow();
|
void CloseRow();
|
||||||
void ClearRow();
|
void ClearRow();
|
||||||
void Reset();
|
void Reset(const int pegcnt);
|
||||||
|
|
||||||
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
|
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
|
||||||
QRectF boundingRect() const;
|
QRectF boundingRect() const;
|
||||||
|
@ -44,27 +63,23 @@ signals:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
||||||
//void contextMenuEvent(QGraphicsSceneContextMenuEvent* e);
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
//void FillRandSlot();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<int> mSolution;
|
std::vector<int> mSolution;
|
||||||
QPen mPen;
|
|
||||||
|
QColor mPend;
|
||||||
|
QColor mPenl;
|
||||||
|
QColor mGrad0;
|
||||||
|
QColor mGrad1;
|
||||||
bool mIsActive;
|
bool mIsActive;
|
||||||
|
bool mSolved;
|
||||||
int mIx;
|
int mIx;
|
||||||
|
int mPegCnt;
|
||||||
|
int mXOffs;
|
||||||
|
|
||||||
void CheckSolution();
|
void CheckSolution();
|
||||||
ColorPeg* mColorPegs[4];
|
ColorPeg** mColorPegs;
|
||||||
QRectF outlineRect() const;
|
QRectF outlineRect() const;
|
||||||
/*
|
|
||||||
void InitActions();
|
|
||||||
void InitMenus();
|
|
||||||
QAction* FillRandAct;
|
|
||||||
QAction* ClearRowAct;
|
|
||||||
QMenu* ContextMenu;
|
|
||||||
*/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PEGROW_H
|
#endif // PEGROW_H
|
||||||
|
|
|
@ -21,5 +21,10 @@
|
||||||
<file>img/cc32.png</file>
|
<file>img/cc32.png</file>
|
||||||
<file>img/cc64.png</file>
|
<file>img/cc64.png</file>
|
||||||
<file>cc32.ico</file>
|
<file>cc32.ico</file>
|
||||||
|
<file>img/business_user.png</file>
|
||||||
|
<file>trans_cs.qm</file>
|
||||||
|
<file>img/same_color_0.png</file>
|
||||||
|
<file>img/same_color_1.png</file>
|
||||||
|
<file>img/help.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -1,14 +1,62 @@
|
||||||
|
/* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
|
|
||||||
#include "rowhint.h"
|
#include "rowhint.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
const int RowHint::mPegPos[4][5][3] = {
|
||||||
|
{
|
||||||
|
{ 6, 14, 12 },
|
||||||
|
{ 22, 14, 12 },
|
||||||
|
{ 0, 0, 0 },
|
||||||
|
{ 0, 0, 0 },
|
||||||
|
{ 0, 0, 0 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{ 6, 6, 12 },
|
||||||
|
{ 22, 6, 12 },
|
||||||
|
{ 14, 22, 12 },
|
||||||
|
{ 0, 0, 0 },
|
||||||
|
{ 0, 0, 0 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{ 6, 6, 12 },
|
||||||
|
{ 22, 6, 12 },
|
||||||
|
{ 6, 22, 12 },
|
||||||
|
{ 22, 22, 12 },
|
||||||
|
{ 0, 0, 0 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{ 4, 4, 12 },
|
||||||
|
{ 24, 4, 12 },
|
||||||
|
{ 14, 14, 12 },
|
||||||
|
{ 4, 24, 12 },
|
||||||
|
{ 24, 24, 12 }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
RowHint::RowHint(QObject*)
|
RowHint::RowHint(QObject*)
|
||||||
{
|
{
|
||||||
//setFlags(QGraphicsItem::GraphicsItemFlags(0));
|
|
||||||
|
|
||||||
mIx = -1;
|
mIx = -1;
|
||||||
|
mPegCnt = 0;
|
||||||
|
|
||||||
mPen = QPen(QColor("#808080"));
|
mPen = QPen(QColor("#808080"));
|
||||||
mPen.setWidth(2);
|
mPen.setWidth(2);
|
||||||
|
@ -21,7 +69,7 @@ RowHint::RowHint(QObject*)
|
||||||
grad.setColorAt(1, QColor(255, 255, 255, 51));
|
grad.setColorAt(1, QColor(255, 255, 255, 51));
|
||||||
mBrush0 = QBrush(grad);
|
mBrush0 = QBrush(grad);
|
||||||
|
|
||||||
Reset();
|
Reset(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
RowHint::~RowHint()
|
RowHint::~RowHint()
|
||||||
|
@ -29,11 +77,12 @@ RowHint::~RowHint()
|
||||||
scene()->removeItem(this);
|
scene()->removeItem(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RowHint::Reset()
|
void RowHint::Reset(const int pegcnt)
|
||||||
{
|
{
|
||||||
mActive = true;
|
mActive = true;
|
||||||
mHints.clear();
|
mHints.clear();
|
||||||
mSolved = false;
|
mSolved = false;
|
||||||
|
SetPegCnt(pegcnt);
|
||||||
SetActive(false);
|
SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +96,11 @@ void RowHint::SetIx(const int ix)
|
||||||
mIx = ix;
|
mIx = ix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RowHint::SetPegCnt(const int pegcnt)
|
||||||
|
{
|
||||||
|
mPegCnt = pegcnt;
|
||||||
|
}
|
||||||
|
|
||||||
void RowHint::SetActive(bool b)
|
void RowHint::SetActive(bool b)
|
||||||
{
|
{
|
||||||
if (b == mActive)
|
if (b == mActive)
|
||||||
|
@ -60,16 +114,14 @@ void RowHint::SetActive(bool b)
|
||||||
if (b)
|
if (b)
|
||||||
{
|
{
|
||||||
setCursor(Qt::PointingHandCursor);
|
setCursor(Qt::PointingHandCursor);
|
||||||
//setOpacity(1);
|
|
||||||
setToolTip(tr("Commit Your solution"));
|
setToolTip(tr("Commit Your solution"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setCursor(Qt::ArrowCursor);
|
setCursor(Qt::ArrowCursor);
|
||||||
//setOpacity(0.2);
|
|
||||||
setToolTip(QString(""));
|
setToolTip(QString(""));
|
||||||
}
|
}
|
||||||
//scene()->update(mapRectToScene(boundingRect()));
|
|
||||||
update(boundingRect());
|
update(boundingRect());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,24 +129,28 @@ void RowHint::DrawHints(std::vector<int> res)
|
||||||
{
|
{
|
||||||
mHints = res;
|
mHints = res;
|
||||||
mSolved = true;
|
mSolved = true;
|
||||||
for (unsigned i = 0; i < mHints.size(); ++i)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
update(boundingRect());
|
update(boundingRect());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RowHint::mousePressEvent(QGraphicsSceneMouseEvent *e)
|
void RowHint::mousePressEvent(QGraphicsSceneMouseEvent *e)
|
||||||
{
|
{
|
||||||
|
bool disabled = false;
|
||||||
if (mActive && !mSolved)
|
if (mActive && !mSolved)
|
||||||
{
|
{
|
||||||
if (e->button() == Qt::LeftButton)
|
if (e->button() == Qt::LeftButton)
|
||||||
{
|
{
|
||||||
SetActive(false);
|
SetActive(false);
|
||||||
emit HintPressedSignal(mIx);
|
emit HintPressedSignal(mIx);
|
||||||
|
disabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!disabled)
|
||||||
|
{
|
||||||
QGraphicsItem::mousePressEvent(e);
|
QGraphicsItem::mousePressEvent(e);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QPainterPath RowHint::shape() const
|
QPainterPath RowHint::shape() const
|
||||||
{
|
{
|
||||||
|
@ -105,8 +161,8 @@ QPainterPath RowHint::shape() const
|
||||||
|
|
||||||
QRectF RowHint::boundingRect() const
|
QRectF RowHint::boundingRect() const
|
||||||
{
|
{
|
||||||
const int Margin = 1;
|
const int margin = 1;
|
||||||
return outlineRect().adjusted(-Margin, -Margin, +Margin, +Margin);
|
return outlineRect().adjusted(-margin, -margin, 2 * margin, 2 * margin);
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF RowHint::outlineRect() const
|
QRectF RowHint::outlineRect() const
|
||||||
|
@ -116,30 +172,73 @@ QRectF RowHint::outlineRect() const
|
||||||
|
|
||||||
void RowHint::paint(QPainter* painter, const QStyleOptionGraphicsItem* /*option*/, QWidget* /* widget */)
|
void RowHint::paint(QPainter* painter, const QStyleOptionGraphicsItem* /*option*/, QWidget* /* widget */)
|
||||||
{
|
{
|
||||||
painter->setPen(mPen);
|
if (mPegCnt == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int i;
|
||||||
|
|
||||||
|
QColor pend = QColor("#646568");
|
||||||
|
QColor penl = QColor("#ecedef");
|
||||||
|
QColor grad0 = QColor("#cccdcf");
|
||||||
|
QColor grad1 = QColor("#fcfdff");
|
||||||
if (mActive)
|
if (mActive)
|
||||||
{
|
{
|
||||||
painter->setBrush(mBrush1);
|
pend.setAlpha(0xff);
|
||||||
|
penl.setAlpha(0xff);
|
||||||
|
grad0.setAlpha(0xff);
|
||||||
|
grad1.setAlpha(0xff);
|
||||||
|
}
|
||||||
|
else if (mSolved)
|
||||||
|
{
|
||||||
|
pend.setAlpha(0xa0);
|
||||||
|
penl.setAlpha(0xa0);
|
||||||
|
grad0.setAlpha(0xa0);
|
||||||
|
grad1.setAlpha(0xa0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
painter->setBrush(mBrush0);
|
pend.setAlpha(0x32);
|
||||||
|
penl.setAlpha(0x50);
|
||||||
|
grad0.setAlpha(0x32);
|
||||||
|
grad1.setAlpha(0x32);
|
||||||
}
|
}
|
||||||
|
painter->setPen(Qt::NoPen);
|
||||||
|
|
||||||
QPainterPath path;
|
painter->setBrush(QBrush(penl));
|
||||||
path.addRect(QRectF(0.0, 0.0, 40.0, 40.0));
|
painter->drawRect(QRectF(0.0, 0.0, 39, 1));
|
||||||
for (int i = 0; i < 4; i++)
|
painter->drawRect(QRectF(0.0, 0.0, 1, 39));
|
||||||
|
painter->setBrush(QBrush(pend));
|
||||||
|
painter->drawRect(QRectF(0.0, 39.0, 40, 1));
|
||||||
|
painter->drawRect(QRectF(39, 0.0, 1, 40));
|
||||||
|
|
||||||
|
QRadialGradient grad(QPointF(10, 10), 100);
|
||||||
|
grad.setColorAt(0, grad0);
|
||||||
|
grad.setColorAt(1, grad1);
|
||||||
|
painter->setBrush(QBrush(grad));
|
||||||
|
painter->drawRect(QRectF(1, 1.0, 38.0, 38.0));
|
||||||
|
|
||||||
|
painter->setBrush(Qt::NoBrush);
|
||||||
|
|
||||||
|
int posix = mPegCnt - 2;
|
||||||
|
QPointF x0;
|
||||||
|
for (i = 0; i < mPegCnt; i++)
|
||||||
{
|
{
|
||||||
//painter->drawEllipse(QRect((i % 2) * 16 + 6, floor(i / 2) * 16 + 6, 12, 12));
|
x0 = QPointF(mPegPos[posix][i][0], mPegPos[posix][i][1]);
|
||||||
path.addEllipse(QRectF((i % 2) * 16 + 6, floor(i / 2) * 16 + 6, 12, 12));
|
QLinearGradient lgrad(x0, QPointF(x0.x() + 10, x0.y() + 10));
|
||||||
|
lgrad.setColorAt(0.0, QColor(0, 0, 0, 0xa0));
|
||||||
|
lgrad.setColorAt(1.0, QColor(0xff, 0xff, 0xff, 0xa0));
|
||||||
|
painter->setPen(QPen(QBrush(lgrad), 0.5));
|
||||||
|
painter->drawEllipse(QRectF(mPegPos[posix][i][0], mPegPos[posix][i][1], mPegPos[posix][i][2], mPegPos[posix][i][2]));
|
||||||
}
|
}
|
||||||
//painter->drawRect(QRectF(0.0, 0.0, 40.0, 40.0));
|
|
||||||
painter->drawPath(path);
|
|
||||||
|
|
||||||
if (mSolved)
|
if (mSolved)
|
||||||
{
|
{
|
||||||
|
painter->setPen(Qt::NoPen);
|
||||||
for (unsigned i = 0; i < mHints.size(); i++)
|
for (unsigned i = 0; i < mHints.size(); i++)
|
||||||
{
|
{
|
||||||
|
x0 = QPointF(mPegPos[posix][i][0], mPegPos[posix][i][1]);
|
||||||
if (mHints.at(i) == 2)
|
if (mHints.at(i) == 2)
|
||||||
{
|
{
|
||||||
painter->setBrush(QBrush(Qt::black));
|
painter->setBrush(QBrush(Qt::black));
|
||||||
|
@ -148,7 +247,7 @@ void RowHint::paint(QPainter* painter, const QStyleOptionGraphicsItem* /*option*
|
||||||
{
|
{
|
||||||
painter->setBrush(QBrush(Qt::white));
|
painter->setBrush(QBrush(Qt::white));
|
||||||
}
|
}
|
||||||
painter->drawEllipse(QRectF((i % 2) * 16 + 6, floor(i / 2) * 16 + 6, 12, 12));
|
painter->drawEllipse(QRectF(mPegPos[posix][i][0], mPegPos[posix][i][1], mPegPos[posix][i][2], mPegPos[posix][i][2]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,21 @@
|
||||||
|
/* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef ROWHINT_H
|
#ifndef ROWHINT_H
|
||||||
#define ROWHINT_H
|
#define ROWHINT_H
|
||||||
|
|
||||||
|
@ -7,7 +25,7 @@
|
||||||
#include <QRadialGradient>
|
#include <QRadialGradient>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "mainwindow.h"
|
#include "colorcode.h"
|
||||||
|
|
||||||
class RowHint : public QObject, public QGraphicsItem
|
class RowHint : public QObject, public QGraphicsItem
|
||||||
{
|
{
|
||||||
|
@ -24,9 +42,10 @@ public:
|
||||||
|
|
||||||
int GetIx() const;
|
int GetIx() const;
|
||||||
void SetIx(const int ix);
|
void SetIx(const int ix);
|
||||||
|
void SetPegCnt(const int pegcnt);
|
||||||
void SetActive(bool b);
|
void SetActive(bool b);
|
||||||
void DrawHints(std::vector<int> res);
|
void DrawHints(std::vector<int> res);
|
||||||
void Reset();
|
void Reset(const int pegcnt);
|
||||||
|
|
||||||
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
|
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
|
||||||
QRectF boundingRect() const;
|
QRectF boundingRect() const;
|
||||||
|
@ -39,6 +58,10 @@ protected:
|
||||||
void mousePressEvent(QGraphicsSceneMouseEvent* e);
|
void mousePressEvent(QGraphicsSceneMouseEvent* e);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static const int mPegPos[4][5][3];
|
||||||
|
|
||||||
|
int mPegCnt;
|
||||||
|
|
||||||
QPen mPen;
|
QPen mPen;
|
||||||
QBrush mBrush0;
|
QBrush mBrush0;
|
||||||
QBrush mBrush1;
|
QBrush mBrush1;
|
||||||
|
|
97
plugins/ColorCode_plugin/solrow.cpp
Normal file
97
plugins/ColorCode_plugin/solrow.cpp
Normal file
|
@ -0,0 +1,97 @@
|
||||||
|
/* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <QtGui>
|
||||||
|
#include "solrow.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
SolRow::SolRow()
|
||||||
|
{
|
||||||
|
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
||||||
|
|
||||||
|
mPegCnt = 0;
|
||||||
|
mSolved = false;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SolRow::SetState(const int pegcnt, const bool solved)
|
||||||
|
{
|
||||||
|
mPegCnt = pegcnt;
|
||||||
|
mSolved = solved;
|
||||||
|
update(boundingRect());
|
||||||
|
}
|
||||||
|
|
||||||
|
QRectF SolRow::boundingRect() const
|
||||||
|
{
|
||||||
|
const double margin = 0.5;
|
||||||
|
return mRect.adjusted(-margin, -margin, 2 * margin, 2 * margin);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SolRow::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget* /* widget */)
|
||||||
|
{
|
||||||
|
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('?'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
45
plugins/ColorCode_plugin/solrow.h
Normal file
45
plugins/ColorCode_plugin/solrow.h
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
/* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SOLROW_H
|
||||||
|
#define SOLROW_H
|
||||||
|
|
||||||
|
#include <QGraphicsItem>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
class SolRow : public QGraphicsItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SolRow();
|
||||||
|
|
||||||
|
void SetState(const int pegcnt, const bool solved);
|
||||||
|
QRectF boundingRect() const;
|
||||||
|
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QRectF mRect;
|
||||||
|
QRectF mRectC;
|
||||||
|
QBrush mBgBrush;
|
||||||
|
QPen mFramePen;
|
||||||
|
QFont mFont;
|
||||||
|
|
||||||
|
int mPegCnt;
|
||||||
|
bool mSolved;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SOLROW_H
|
BIN
plugins/ColorCode_plugin/trans_cs.qm
Normal file
BIN
plugins/ColorCode_plugin/trans_cs.qm
Normal file
Binary file not shown.
343
plugins/ColorCode_plugin/trans_cs.ts
Normal file
343
plugins/ColorCode_plugin/trans_cs.ts
Normal file
|
@ -0,0 +1,343 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE TS>
|
||||||
|
<TS version="2.0" language="cs_CZ">
|
||||||
|
<defaultcodec>UTF-8</defaultcodec>
|
||||||
|
<context>
|
||||||
|
<name>About</name>
|
||||||
|
<message>
|
||||||
|
<source>&Author</source>
|
||||||
|
<translation>&Autor</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>icon</source>
|
||||||
|
<translation>ikona</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>&License</source>
|
||||||
|
<translation>&Licence</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>A needful game to train your brain ;-)</source>
|
||||||
|
<translation>Hra pro udržení bdělosti <br>vašeho mozku ;-)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.</source>
|
||||||
|
<translation>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 2 licence nebo (podle své volby) podle jakékoli pozdější verze.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>ColorCode</source>
|
||||||
|
<translation>ColorCode</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>About ColorCode</source>
|
||||||
|
<translation>O ColorCode</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source><br><br>Free MasterMind clone including a built in,<br>rather intelligent solver.</source>
|
||||||
|
<translation><br><br>Klon Freie MasterMind s vestavěným<br>celkem schopným řešitelem.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Version</source>
|
||||||
|
<translation>Verze</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Author</source>
|
||||||
|
<translation>Autor</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>ColorCode</name>
|
||||||
|
<message>
|
||||||
|
<source>New Game</source>
|
||||||
|
<translation>Nová hra</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Do you want to give in
|
||||||
|
and start a new Game?</source>
|
||||||
|
<translation>Chcete vzdát hru
|
||||||
|
a začít novou?</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>About Qt</source>
|
||||||
|
<translation>O Qt</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>&New Game</source>
|
||||||
|
<translation>&Nová hra</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Ctrl+N</source>
|
||||||
|
<translation></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>&Restart Game</source>
|
||||||
|
<translation>&Začít hru znovu</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Ctrl+R</source>
|
||||||
|
<translation></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>E&xit</source>
|
||||||
|
<translation>&Ukončit</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Ctrl+Q</source>
|
||||||
|
<translation></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Ctrl+T</source>
|
||||||
|
<translation></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Ctrl+C</source>
|
||||||
|
<translation></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Ctrl+A</source>
|
||||||
|
<translation></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>About &Qt</source>
|
||||||
|
<translation>O &Qt</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>&Game</source>
|
||||||
|
<translation>&Hra</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>&Settings</source>
|
||||||
|
<translation>&Nastavení</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>&Help</source>
|
||||||
|
<translation>&Nápověda</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Game</source>
|
||||||
|
<translation>Hra</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Message</source>
|
||||||
|
<translation>Hlášení</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>The changed settings will only apply to new games!
|
||||||
|
Do you want to give in the current and start a new Game?</source>
|
||||||
|
<translation>Změny v nastavení se projeví teprve po novém spuštění hry!
|
||||||
|
Chcete vzdát nynější hru a začít novou?</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Place Your pegs ...</source>
|
||||||
|
<translation>Umístěte své kameny...</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Congratulation! You have won!</source>
|
||||||
|
<translation>Blahopřejeme! Vyhrál jste!</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Sorry! You lost!</source>
|
||||||
|
<translation>Promiňte, ale nezvládl jste to!</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Ctrl+I</source>
|
||||||
|
<translation></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Give In</source>
|
||||||
|
<translation>Vzdát</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Do you really want to give in?</source>
|
||||||
|
<translation>Skutečně chcete hru vzdát?</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>&Throw In The Towel</source>
|
||||||
|
<translation>&Vhodit ručník</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Ctrl+G</source>
|
||||||
|
<translation></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Sure, You're too weak for me!</source>
|
||||||
|
<translation>Je jasné, že jste pro mě příliš slabý!</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Ctrl+Shift+R</source>
|
||||||
|
<translation></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Ctrl+Shift+C</source>
|
||||||
|
<translation></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Fill Row by Random</source>
|
||||||
|
<translation>Naplnit řádek náhodně</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Duplicate Previous Row</source>
|
||||||
|
<translation>Zdvojit předchozí řádek</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Ctrl+D</source>
|
||||||
|
<translation></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Clear Row</source>
|
||||||
|
<translation>Vyprázdnit řádek</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>&Row</source>
|
||||||
|
<translation>&Řádek</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>ColorCode</source>
|
||||||
|
<translation>ColorCode</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>About &ColorCode</source>
|
||||||
|
<translation>O &ColorCode</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Ctrl+M</source>
|
||||||
|
<translation></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Ctrl+S</source>
|
||||||
|
<translation></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Easy - 6 Colors</source>
|
||||||
|
<translation type="obsolete">Lehká - 6 barev</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Medium - 8 Colors</source>
|
||||||
|
<translation type="obsolete">Střední - 8 barev</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Hard - 10 Colors</source>
|
||||||
|
<translation type="obsolete">Těžká - 10 barev</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Show Toolbar</source>
|
||||||
|
<translation>Ukázat nástrojovou lištu</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Show Menubar</source>
|
||||||
|
<translation>Ukázat lištu s hlavní nabídkou</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Show Statusbar</source>
|
||||||
|
<translation>Ukázat stavový pruh</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Allow Pegs of the Same Color</source>
|
||||||
|
<translation>Povolit kameny se stejnou barvou</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Close Rows when the 4th Peg is placed</source>
|
||||||
|
<translation type="obsolete">Vyhodnotit řádky po umístění čtyř kamenů</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Level</source>
|
||||||
|
<translation>Úroveň</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Computer's Guess</source>
|
||||||
|
<translation>Nechte svůj počítač hádat</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Ctrl+H</source>
|
||||||
|
<translation></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Press the Hint Field or Key Enter if You're done.</source>
|
||||||
|
<translation>Hotovo? Potom klepněte na pole s radou.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Disallow Pegs of the Same Color</source>
|
||||||
|
<translation>Zákázat kameny stejné barvy</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Close Rows when the last Peg is placed</source>
|
||||||
|
<translation>Vyhodnotit řádky po umístění posledního kamene</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Ctrl+L</source>
|
||||||
|
<translation>Ctrl+L</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Beginner (2 Colors, 2 Slots, Doubles)</source>
|
||||||
|
<translation>Začátečník (2 barvy, 2 místa, zdvojení)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Easy (4 Colors, 3 Slots, No Doubles)</source>
|
||||||
|
<translation>Lehká (4 barvy, 3 místa, bez zdvojení)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Classic (6 Colors, 4 Slots, Doubles)</source>
|
||||||
|
<translation>Klasická (6 barev, 4 místa, zdvojení)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Challenging (8 Colors, 4 Slots, Doubles)</source>
|
||||||
|
<translation>Náročná (8 barev, 4 místa, zdvojení)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Hard (10 Colors, 5 Slots, Doubles)</source>
|
||||||
|
<translation>Těžká (10 barev, 5 míst, zdvojení)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Level Presets</source>
|
||||||
|
<translation>Přednastavení stupně obtížnosti</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Colors</source>
|
||||||
|
<translation>Barvy</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Pegs of Same Color</source>
|
||||||
|
<translation>Kameny se stejnou barvou</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Slots</source>
|
||||||
|
<translation>Místa</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Yes</source>
|
||||||
|
<translation>Ano</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>No</source>
|
||||||
|
<translation>Ne</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Reset Color Order</source>
|
||||||
|
<translation>Znovu nastavit pořadí barev</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Show Letter Indicators</source>
|
||||||
|
<translation>Ukázat ukazatele písmen</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Ctrl+Shift+L</source>
|
||||||
|
<translation>Ctrl+Shift+L</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Online &Help</source>
|
||||||
|
<translation>&Nápověda po internetu</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>F1</source>
|
||||||
|
<translation>F1</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>RowHint</name>
|
||||||
|
<message>
|
||||||
|
<source>Commit Your solution</source>
|
||||||
|
<translation>Vyzkoušet své řešení</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
</TS>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue