commit inicial en mercurial
674
COPYING.txt
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>.
|
4
README.txt
Normal file
@ -0,0 +1,4 @@
|
||||
This software was developed by Luis <20>ngel San Mart<72>n Rodr<64>guez (luisangelsm@gmail.com) under GPL v3 license (for more details read COPYING.txt).
|
||||
|
||||
Project home page : http://code.google.com/p/yacreader/
|
||||
|
54
YACReader/YACReader.pro
Normal file
@ -0,0 +1,54 @@
|
||||
# #####################################################################
|
||||
# Automatically generated by qmake (2.01a) mi<EFBFBD> 8. oct 20:54:05 2008
|
||||
# #####################################################################
|
||||
TEMPLATE = app
|
||||
TARGET =
|
||||
DEPENDPATH += . \
|
||||
release
|
||||
INCLUDEPATH += .
|
||||
INCLUDEPATH += ../common
|
||||
QT += network webkit phonon
|
||||
CONFIG += release
|
||||
CONFIG -= flat
|
||||
|
||||
# Input
|
||||
HEADERS += comic.h \
|
||||
configuration.h \
|
||||
goto_dialog.h \
|
||||
magnifying_glass.h \
|
||||
main_window_viewer.h \
|
||||
viewer.h \
|
||||
../common/pictureflow.h \
|
||||
../common/custom_widgets.h \
|
||||
../common/check_new_version.h \
|
||||
../common/qnaturalsorting.h \
|
||||
goto_flow.h \
|
||||
options_dialog.h \
|
||||
bookmarks.h \
|
||||
bookmarks_dialog.h \
|
||||
render.h \
|
||||
shortcuts_dialog.h \
|
||||
translator.h
|
||||
SOURCES += comic.cpp \
|
||||
configuration.cpp \
|
||||
goto_dialog.cpp \
|
||||
magnifying_glass.cpp \
|
||||
main.cpp \
|
||||
main_window_viewer.cpp \
|
||||
viewer.cpp \
|
||||
../common/pictureflow.cpp \
|
||||
../common/custom_widgets.cpp \
|
||||
../common/check_new_version.cpp \
|
||||
../common/qnaturalsorting.cpp \
|
||||
goto_flow.cpp \
|
||||
options_dialog.cpp \
|
||||
bookmarks.cpp \
|
||||
bookmarks_dialog.cpp \
|
||||
render.cpp \
|
||||
shortcuts_dialog.cpp \
|
||||
translator.cpp
|
||||
RESOURCES += images.qrc \
|
||||
files.qrc
|
||||
RC_FILE = icon.rc
|
||||
TRANSLATIONS = yacreader_es.ts \ yacreader_fr.ts
|
||||
FORMS +=
|
159
YACReader/bookmarks.cpp
Normal file
@ -0,0 +1,159 @@
|
||||
#include "bookmarks.h"
|
||||
#include <QFile>
|
||||
#include <QDataStream>
|
||||
#include <QCoreApplication>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
#define NUM_BOOKMARKS 250
|
||||
|
||||
Bookmarks::Bookmarks()
|
||||
:lastPageIndex(0)
|
||||
{
|
||||
list.load();
|
||||
}
|
||||
void Bookmarks::setLastPage(int index,const QPixmap & page)
|
||||
{
|
||||
lastPageIndex = index;
|
||||
lastPage = page;
|
||||
}
|
||||
void Bookmarks::setBookmark(int index,const QPixmap & page)
|
||||
{
|
||||
if(!bookmarks.contains(index))
|
||||
{
|
||||
bookmarks.insert(index,page);
|
||||
latestBookmarks.push_front(index);
|
||||
if(latestBookmarks.count()>3)
|
||||
{
|
||||
bookmarks.remove(latestBookmarks.back());
|
||||
latestBookmarks.pop_back();
|
||||
}
|
||||
}
|
||||
else //udate de pixmap;
|
||||
{
|
||||
bookmarks[index]=page;
|
||||
}
|
||||
}
|
||||
|
||||
void Bookmarks::removeBookmark(int index)
|
||||
{
|
||||
bookmarks.remove(index);
|
||||
}
|
||||
|
||||
QList<int> Bookmarks::getBookmarkPages() const
|
||||
{
|
||||
return bookmarks.keys();
|
||||
}
|
||||
|
||||
QPixmap Bookmarks::getBookmarkPixmap(int page) const
|
||||
{
|
||||
return bookmarks.value(page);
|
||||
}
|
||||
|
||||
QPixmap Bookmarks::getLastPagePixmap() const
|
||||
{
|
||||
return lastPage;
|
||||
}
|
||||
|
||||
int Bookmarks::getLastPage() const
|
||||
{
|
||||
return lastPageIndex;
|
||||
}
|
||||
|
||||
|
||||
bool Bookmarks::isBookmark(int page)
|
||||
{
|
||||
return bookmarks.contains(page);
|
||||
}
|
||||
|
||||
bool Bookmarks::imageLoaded(int page)
|
||||
{
|
||||
return !bookmarks.value(page).isNull();
|
||||
}
|
||||
|
||||
void Bookmarks::newComic(const QString & path)
|
||||
{
|
||||
QFileInfo f(path);
|
||||
QString comicID = f.fileName().toLower()+QString::number(f.size());
|
||||
clear();
|
||||
BookmarksList::Bookmark b = list.get(comicID);
|
||||
comicPath=comicID;
|
||||
lastPageIndex = b.lastPage;
|
||||
latestBookmarks = b.bookmarks;
|
||||
for(int i=0;i<latestBookmarks.count();i++)
|
||||
bookmarks.insert(latestBookmarks.at(i),QPixmap());
|
||||
added = b.added;
|
||||
|
||||
}
|
||||
void Bookmarks::clear()
|
||||
{
|
||||
bookmarks.clear();
|
||||
latestBookmarks.clear();
|
||||
lastPageIndex=0;
|
||||
lastPage = QPixmap();
|
||||
}
|
||||
|
||||
void Bookmarks::save()
|
||||
{
|
||||
BookmarksList::Bookmark b;
|
||||
b.lastPage = lastPageIndex;
|
||||
b.bookmarks = getBookmarkPages();
|
||||
|
||||
BookmarksList::Bookmark previousBookmarks;
|
||||
bool updated = ((previousBookmarks.lastPage != b.lastPage) || (previousBookmarks.bookmarks != b.bookmarks));
|
||||
|
||||
if(b.added.isNull() || updated)
|
||||
b.added = QDateTime::currentDateTime();
|
||||
list.add(comicPath,b);
|
||||
list.save();
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void BookmarksList::load()
|
||||
{
|
||||
QFile f(QCoreApplication::applicationDirPath()+"/bookmarks.yacr");
|
||||
if(f.open(QIODevice::ReadOnly))
|
||||
{
|
||||
QDataStream dataS(&f);
|
||||
dataS >> list;
|
||||
f.close();
|
||||
}
|
||||
}
|
||||
|
||||
void BookmarksList::save()
|
||||
{
|
||||
QFile f(QCoreApplication::applicationDirPath()+"/bookmarks.yacr");
|
||||
f.open(QIODevice::WriteOnly);
|
||||
QDataStream dataS(&f);
|
||||
if(list.count()>NUM_BOOKMARKS)
|
||||
deleteOldest(list.count()-NUM_BOOKMARKS);
|
||||
dataS << list;
|
||||
f.close();
|
||||
}
|
||||
|
||||
|
||||
void BookmarksList::deleteOldest(int num)
|
||||
{
|
||||
QString comic;
|
||||
QDateTime date(QDate(10000,1,1));//TODO MAX_DATE??
|
||||
for(QMap<QString,Bookmark>::const_iterator itr=list.begin();itr!=list.end();itr++)
|
||||
{
|
||||
if(itr->added<date)
|
||||
{
|
||||
comic=itr.key();
|
||||
date = itr->added;
|
||||
}
|
||||
}
|
||||
list.remove(comic);
|
||||
}
|
||||
|
||||
void BookmarksList::add(const QString & comicID, const Bookmark & b)
|
||||
{
|
||||
list.insert(comicID,b);
|
||||
}
|
||||
|
||||
BookmarksList::Bookmark BookmarksList::get(const QString & comicID)
|
||||
{
|
||||
//if(list.contains(comicID)
|
||||
return list.value(comicID);
|
||||
}
|
77
YACReader/bookmarks.h
Normal file
@ -0,0 +1,77 @@
|
||||
#ifndef BOOKMARKS_H
|
||||
#define BOOKMARKS_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QMap>
|
||||
#include <QPixmap>
|
||||
#include <QString>
|
||||
#include <QMap>
|
||||
#include <QDateTime>
|
||||
class BookmarksList
|
||||
{
|
||||
public:
|
||||
struct Bookmark {
|
||||
int lastPage;
|
||||
QList<int> bookmarks;
|
||||
QDateTime added;
|
||||
Bookmark():lastPage(0){};
|
||||
friend QDataStream & operator<< ( QDataStream & out, const Bookmark & bm )
|
||||
{
|
||||
out << bm.lastPage;
|
||||
out << bm.bookmarks;
|
||||
out << bm.added;
|
||||
return out;
|
||||
}
|
||||
friend QDataStream & operator>> ( QDataStream & in, Bookmark & bm )
|
||||
{
|
||||
in >> bm.lastPage;
|
||||
in >> bm.bookmarks;
|
||||
in >> bm.added;
|
||||
return in;
|
||||
}
|
||||
|
||||
};
|
||||
BookmarksList(){}
|
||||
void load();
|
||||
void save();
|
||||
void add(const QString & comicID, const Bookmark & b);
|
||||
Bookmark get(const QString & comicID);
|
||||
protected:
|
||||
QMap<QString,Bookmark> list;
|
||||
void deleteOldest(int num);
|
||||
|
||||
};
|
||||
|
||||
class Bookmarks : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
QString comicPath;
|
||||
//bookmarks setted by the user
|
||||
QMap<int,QPixmap> bookmarks;
|
||||
QList<int> latestBookmarks;
|
||||
//last page readed
|
||||
int lastPageIndex;
|
||||
QPixmap lastPage;
|
||||
BookmarksList list;
|
||||
QDateTime added;
|
||||
|
||||
public:
|
||||
Bookmarks();
|
||||
void setLastPage(int index,const QPixmap & page);
|
||||
void setBookmark(int index,const QPixmap & page);
|
||||
void removeBookmark(int index);
|
||||
QList<int> getBookmarkPages() const;
|
||||
QPixmap getBookmarkPixmap(int page) const;
|
||||
QPixmap getLastPagePixmap() const;
|
||||
int getLastPage() const;
|
||||
bool isBookmark(int page);
|
||||
bool imageLoaded(int page);
|
||||
void newComic(const QString & path);
|
||||
void clear();
|
||||
void save();
|
||||
|
||||
};
|
||||
|
||||
#endif // BOOKMARKS_H
|
182
YACReader/bookmarks_dialog.cpp
Normal file
@ -0,0 +1,182 @@
|
||||
#include "bookmarks_dialog.h"
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QFrame>
|
||||
#include <QImage>
|
||||
|
||||
#include "bookmarks.h"
|
||||
|
||||
BookmarksDialog::BookmarksDialog(QWidget * parent)
|
||||
:QDialog(parent,Qt::FramelessWindowHint)
|
||||
{
|
||||
setModal(true);
|
||||
|
||||
animation = new QPropertyAnimation(this,"windowOpacity");
|
||||
animation->setDuration(150);
|
||||
|
||||
QHBoxLayout * layout = new QHBoxLayout();
|
||||
|
||||
//bookmarks
|
||||
QGridLayout * bookmarksL = new QGridLayout();
|
||||
|
||||
pages.push_back(new QLabel(tr("Lastest Page")));
|
||||
for(int i=0;i<3;i++)
|
||||
pages.push_back(new QLabel("-"));
|
||||
|
||||
int heightDesktopResolution = QApplication::desktop()->screenGeometry().height();
|
||||
int height,width;
|
||||
height = heightDesktopResolution*0.50;
|
||||
width = height*0.65;
|
||||
|
||||
coverSize = QSize(width,height);
|
||||
|
||||
for(int i=0;i<4;i++)
|
||||
{
|
||||
QLabel * l = new QLabel();
|
||||
l->setFixedSize(coverSize);
|
||||
l->setScaledContents(false);
|
||||
//l->setPixmap(QPixmap(":/images/notCover.png"));
|
||||
l->installEventFilter(this);
|
||||
images.push_back(l);
|
||||
}
|
||||
|
||||
for(int i=0;i<3;i++)
|
||||
bookmarksL->addWidget(pages.at(i+1),0,i,Qt::AlignCenter);
|
||||
|
||||
for(int i=0;i<3;i++)
|
||||
bookmarksL->addWidget(images.at(i+1),1,i,Qt::AlignCenter);
|
||||
|
||||
|
||||
//last page
|
||||
QGridLayout * lp = new QGridLayout();
|
||||
lp->addWidget(pages.at(0),0,0,Qt::AlignCenter);
|
||||
lp->addWidget(images.at(0),1,0,Qt::AlignCenter);
|
||||
|
||||
layout->addLayout(bookmarksL);
|
||||
QFrame *f = new QFrame( this );
|
||||
f->setFrameStyle( QFrame::VLine | QFrame::Sunken );
|
||||
layout->addWidget(f);
|
||||
layout->addLayout(lp);
|
||||
|
||||
QHBoxLayout * buttons = new QHBoxLayout();
|
||||
|
||||
cancel = new QPushButton(tr("Close"));
|
||||
cancel->setFlat(true);
|
||||
connect(cancel,SIGNAL(clicked()),this,SLOT(hide()));
|
||||
buttons->addStretch();
|
||||
buttons->addWidget(cancel);
|
||||
|
||||
QVBoxLayout * l = new QVBoxLayout();
|
||||
|
||||
l->addWidget(new QLabel(tr("Click on any image to go to the bookmark")),0,Qt::AlignCenter);
|
||||
l->addLayout(layout);
|
||||
l->addLayout(buttons);
|
||||
|
||||
this->setPalette(QPalette(QColor(25,25,25)));
|
||||
//this->setAutoFillBackground(true);
|
||||
setLayout(l);
|
||||
}
|
||||
|
||||
void BookmarksDialog::setBookmarks(const Bookmarks & bm)
|
||||
{
|
||||
lastPage = bm.getLastPage();
|
||||
if (lastPage > 0)
|
||||
{
|
||||
QPixmap p = bm.getLastPagePixmap();
|
||||
if(p.isNull())
|
||||
{
|
||||
images.at(0)->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
|
||||
images.at(0)->setText(tr("Loading..."));
|
||||
}
|
||||
else
|
||||
{
|
||||
images.at(0)->setAlignment(Qt::AlignHCenter|Qt::AlignBottom);
|
||||
images.at(0)->setPixmap(p.scaled(coverSize,Qt::KeepAspectRatio,Qt::SmoothTransformation));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
images.at(0)->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
|
||||
images.at(0)->setPixmap(QPixmap(":/images/notCover.png").scaled(coverSize,Qt::KeepAspectRatio,Qt::SmoothTransformation));
|
||||
|
||||
}
|
||||
|
||||
QList<int> l = bm.getBookmarkPages();
|
||||
int s = l.count();
|
||||
for(int i=0;i<s;i++)
|
||||
{
|
||||
pages.at(i+1)->setText(QString::number(l.at(i)+1));
|
||||
QPixmap p = bm.getBookmarkPixmap(l.at(i));
|
||||
if(p.isNull())
|
||||
{
|
||||
images.at(i+1)->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
|
||||
images.at(i+1)->setText(tr("Loading..."));
|
||||
}
|
||||
else
|
||||
{
|
||||
images.at(i+1)->setAlignment(Qt::AlignHCenter|Qt::AlignBottom);
|
||||
images.at(i+1)->setPixmap(p.scaled(coverSize,Qt::KeepAspectRatio,Qt::SmoothTransformation));
|
||||
}
|
||||
}
|
||||
for(int i=s;i<3;i++)
|
||||
{
|
||||
pages.at(i+1)->setText("-");
|
||||
images.at(i+1)->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
|
||||
images.at(i+1)->setPixmap(QPixmap(":/images/notCover.png").scaled(coverSize,Qt::KeepAspectRatio,Qt::SmoothTransformation));
|
||||
}
|
||||
}
|
||||
|
||||
bool BookmarksDialog::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::MouseButtonPress)
|
||||
{
|
||||
if (obj == images.at(0))
|
||||
{
|
||||
emit(goToPage(lastPage+1));
|
||||
close();
|
||||
event->accept();
|
||||
}
|
||||
for(int i=1;i<=3;i++)
|
||||
{
|
||||
if(obj == images.at(i))
|
||||
{
|
||||
bool b;
|
||||
int page = pages.at(i)->text().toInt(&b);
|
||||
if(b)
|
||||
{
|
||||
emit(goToPage(page));
|
||||
close();
|
||||
}
|
||||
event->accept();
|
||||
}
|
||||
}
|
||||
}
|
||||
// pass the event on to the parent class
|
||||
return QDialog::eventFilter(obj, event);
|
||||
}
|
||||
|
||||
void BookmarksDialog::keyPressEvent(QKeyEvent * event)
|
||||
{
|
||||
if(event->key() == Qt::Key_M)
|
||||
hide();
|
||||
}
|
||||
|
||||
void BookmarksDialog::show()
|
||||
{
|
||||
QDialog::show();
|
||||
disconnect(animation,SIGNAL(finished()),this,SLOT(close()));
|
||||
animation->setStartValue(0);
|
||||
animation->setEndValue(1);
|
||||
animation->start();
|
||||
}
|
||||
|
||||
void BookmarksDialog::hide()
|
||||
{
|
||||
connect(animation,SIGNAL(finished()),this,SLOT(close()));
|
||||
animation->setStartValue(1);
|
||||
animation->setEndValue(0);
|
||||
animation->start();
|
||||
}
|
45
YACReader/bookmarks_dialog.h
Normal file
@ -0,0 +1,45 @@
|
||||
#ifndef __BOOKMARKS_DIALOG_H
|
||||
#define __BOOKMARKS_DIALOG_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QDialog>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QEvent>
|
||||
#include <QKeyEvent>
|
||||
#include <QPropertyAnimation>
|
||||
|
||||
#include "bookmarks.h"
|
||||
|
||||
class BookmarksDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
QList<QLabel *> pages;
|
||||
QList<QLabel *> images;
|
||||
|
||||
int lastPage;
|
||||
|
||||
QPushButton * accept;
|
||||
QPushButton * cancel;
|
||||
|
||||
QSize coverSize;
|
||||
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
void keyPressEvent(QKeyEvent * event);
|
||||
QPropertyAnimation * animation;
|
||||
|
||||
public:
|
||||
BookmarksDialog(QWidget * parent = 0);
|
||||
|
||||
public slots:
|
||||
void setBookmarks(const Bookmarks & bookmarks);
|
||||
void show();
|
||||
void hide();
|
||||
|
||||
signals:
|
||||
void goToPage(unsigned int page);
|
||||
};
|
||||
|
||||
#endif // BOOKMARKS_DIALOG_H
|
289
YACReader/comic.cpp
Normal file
@ -0,0 +1,289 @@
|
||||
#include "comic.h"
|
||||
|
||||
#include <QPixmap>
|
||||
#include <QRegExp>
|
||||
#include <QString>
|
||||
#include <algorithm>
|
||||
#include <QDir>
|
||||
#include <QFileInfoList>
|
||||
#include "bookmarks.h"
|
||||
#include "qnaturalsorting.h"
|
||||
|
||||
#define EXTENSIONS << "*.jpg" << "*.jpeg" << "*.png" << "*.gif" << "*.tiff" << "*.tif" << "*.bmp"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
Comic::Comic()
|
||||
:_pages(),_index(0),_path(),_loaded(false),bm(new Bookmarks())
|
||||
{
|
||||
setup();
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
Comic::Comic(const QString pathFile)
|
||||
:_pages(),_index(0),_path(pathFile),_loaded(false),bm(new Bookmarks())
|
||||
{
|
||||
setup();
|
||||
loadFromFile(pathFile);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void Comic::setup()
|
||||
{
|
||||
connect(this,SIGNAL(pageChanged(int)),this,SLOT(checkIsBookmark(int)));
|
||||
connect(this,SIGNAL(imageLoaded(int)),this,SLOT(updateBookmarkImage(int)));
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void Comic::load(const QString & path)
|
||||
{
|
||||
QFileInfo fi(path);
|
||||
bm->newComic(path);
|
||||
emit bookmarksLoaded(*bm);
|
||||
if(fi.isFile())
|
||||
{
|
||||
loadFromFile(path);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(fi.isDir())
|
||||
{
|
||||
loadFromDir(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void Comic::loadFromFile(const QString & pathFile)
|
||||
{
|
||||
_path = QDir::cleanPath(pathFile);
|
||||
//load files size
|
||||
_7z = new QProcess();
|
||||
QStringList attributes;
|
||||
attributes << "l" << "-ssc-" << "-r" << _path EXTENSIONS;
|
||||
connect(_7z,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(loadSizes(void)));
|
||||
connect(_7z,SIGNAL(error(QProcess::ProcessError)),this,SLOT(openingError(QProcess::ProcessError)));
|
||||
_7z->start(QCoreApplication::applicationDirPath()+"/utils/7z",attributes);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void Comic::loadFromDir(const QString & pathDir)
|
||||
{
|
||||
_pathDir = pathDir;
|
||||
start();
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void Comic::run()
|
||||
{
|
||||
QDir d(_pathDir);
|
||||
QStringList l;
|
||||
l EXTENSIONS;
|
||||
d.setNameFilters(l);
|
||||
d.setFilter(QDir::Files|QDir::NoDotAndDotDot);
|
||||
//d.setSorting(QDir::Name|QDir::IgnoreCase|QDir::LocaleAware);
|
||||
QFileInfoList list = d.entryInfoList();
|
||||
|
||||
qSort(list.begin(),list.end(),naturalSortLessThanCIFileInfo);
|
||||
|
||||
int nPages = list.size();
|
||||
_pages.clear();
|
||||
_pages.resize(nPages);
|
||||
if(nPages==0)
|
||||
{
|
||||
QMessageBox::critical(NULL,tr("No images found"),tr("There are not images on the selected folder"));
|
||||
emit errorOpening();
|
||||
}
|
||||
else
|
||||
{
|
||||
emit pageChanged(0); // this indicates new comic, index=0
|
||||
emit numPages(_pages.size());
|
||||
_loaded = true;
|
||||
|
||||
for(int i=0;i<nPages;i++)
|
||||
{
|
||||
QFile f(list.at(i).absoluteFilePath());
|
||||
f.open(QIODevice::ReadOnly);
|
||||
_pages[i]=f.readAll();
|
||||
emit imageLoaded(i);
|
||||
emit imageLoaded(i,_pages[i]);
|
||||
}
|
||||
}
|
||||
emit imagesLoaded();
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void Comic::loadSizes()
|
||||
{
|
||||
QRegExp rx("[0-9]{4}-[0-9]{2}-[0-9]{2}[ ]+[0-9]{2}:[0-9]{2}:[0-9]{2}[ ]+.{5}[ ]+([0-9]+)[ ]+([0-9]+)[ ]+(.+)");
|
||||
|
||||
QByteArray ba = _7z->readAllStandardOutput();
|
||||
QList<QByteArray> lines = ba.split('\n');
|
||||
QByteArray line;
|
||||
QString name;
|
||||
foreach(line,lines)
|
||||
{
|
||||
if(rx.indexIn(QString(line))!=-1)
|
||||
{
|
||||
_sizes.push_back(rx.cap(1).toInt());
|
||||
name = rx.cap(3).trimmed();
|
||||
_order.push_back(name);
|
||||
_fileNames.push_back(name);
|
||||
}
|
||||
}
|
||||
if(_sizes.size()==0)
|
||||
{
|
||||
QMessageBox::critical(NULL,tr("File error"),tr("File not found or not images in file"));
|
||||
emit errorOpening();
|
||||
return;
|
||||
}
|
||||
_pages.resize(_sizes.size());
|
||||
|
||||
emit pageChanged(0); // this indicates new comic, index=0
|
||||
emit numPages(_pages.size());
|
||||
_loaded = true;
|
||||
|
||||
_cfi=0;
|
||||
qSort(_fileNames.begin(),_fileNames.end(), naturalSortLessThanCI);
|
||||
int i=0;
|
||||
foreach(name,_fileNames)
|
||||
{
|
||||
_newOrder.insert(name,i);
|
||||
i++;
|
||||
}
|
||||
_7ze = new QProcess();
|
||||
QStringList attributes;
|
||||
attributes << "e" << "-ssc-" << "-so" << "-r" << _path EXTENSIONS;
|
||||
connect(_7ze,SIGNAL(error(QProcess::ProcessError)),this,SLOT(openingError(QProcess::ProcessError)));
|
||||
connect(_7ze,SIGNAL(readyReadStandardOutput()),this,SLOT(loadImages(void)));
|
||||
connect(_7ze,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(loadFinished(void)));
|
||||
_7ze->start(QCoreApplication::applicationDirPath()+"/utils/7z",attributes);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void Comic::loadImages()
|
||||
{
|
||||
|
||||
QByteArray ba = _7ze->readAllStandardOutput();
|
||||
int s;
|
||||
int rigthIndex;
|
||||
while(ba.size()>0)
|
||||
{
|
||||
rigthIndex = _newOrder.value(_order[_cfi]);
|
||||
s = _pages[rigthIndex].size();
|
||||
_pages[rigthIndex].append(ba.left(_sizes[_cfi]-s));
|
||||
ba.remove(0,_sizes[_cfi]-s);
|
||||
if(_pages[rigthIndex].size()==static_cast<int>(_sizes[_cfi]))
|
||||
{
|
||||
emit imageLoaded(rigthIndex);
|
||||
emit imageLoaded(rigthIndex,_pages[rigthIndex]);
|
||||
_cfi++;
|
||||
}
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void Comic::openingError(QProcess::ProcessError error)
|
||||
{
|
||||
switch(error)
|
||||
{
|
||||
case QProcess::FailedToStart:
|
||||
QMessageBox::critical(NULL,tr("7z not found"),tr("7z wasn't found in your PATH."));
|
||||
break;
|
||||
case QProcess::Crashed:
|
||||
QMessageBox::critical(NULL,tr("7z crashed"),tr("7z crashed."));
|
||||
break;
|
||||
case QProcess::ReadError:
|
||||
QMessageBox::critical(NULL,tr("7z reading"),tr("problem reading from 7z"));
|
||||
break;
|
||||
case QProcess::UnknownError:
|
||||
QMessageBox::critical(NULL,tr("7z problem"),tr("Unknown error 7z"));
|
||||
break;
|
||||
default:
|
||||
//TODO
|
||||
break;
|
||||
}
|
||||
_loaded = false;
|
||||
emit errorOpening();
|
||||
}
|
||||
int Comic::nextPage()
|
||||
{
|
||||
if(_index<_pages.size()-1)
|
||||
_index++;
|
||||
|
||||
emit pageChanged(_index);
|
||||
|
||||
return _index;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
int Comic::previousPage()
|
||||
{
|
||||
if(_index>0)
|
||||
_index--;
|
||||
|
||||
emit pageChanged(_index);
|
||||
|
||||
return _index;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void Comic::setIndex(unsigned int index)
|
||||
{
|
||||
if(static_cast<int>(index)<_pages.size()-1)
|
||||
_index = index;
|
||||
else
|
||||
_index = _pages.size()-1;
|
||||
|
||||
emit pageChanged(_index);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
QPixmap * Comic::currentPage()
|
||||
{
|
||||
QPixmap * p = new QPixmap();
|
||||
p->loadFromData(_pages[_index]);
|
||||
return p;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
QPixmap * Comic::operator[](unsigned int index)
|
||||
{
|
||||
QPixmap * p = new QPixmap();
|
||||
p->loadFromData(_pages[index]);
|
||||
return p;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
bool Comic::loaded()
|
||||
{
|
||||
return _loaded;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void Comic::loadFinished()
|
||||
{
|
||||
emit imagesLoaded();
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void Comic::setBookmark()
|
||||
{
|
||||
bm->setBookmark(_index,*operator[](_index));
|
||||
emit bookmarksLoaded(*bm);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void Comic::removeBookmark()
|
||||
{
|
||||
bm->removeBookmark(_index);
|
||||
emit bookmarksLoaded(*bm);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void Comic::saveBookmarks()
|
||||
{
|
||||
bm->setLastPage(_index,*operator[](_index));
|
||||
bm->save();
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void Comic::checkIsBookmark(int index)
|
||||
{
|
||||
emit isBookmark(bm->isBookmark(index));
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void Comic::updateBookmarkImage(int index)
|
||||
{
|
||||
if(bm->isBookmark(index))
|
||||
{
|
||||
bm->setBookmark(index,*operator[](index));
|
||||
emit bookmarksLoaded(*bm);
|
||||
}
|
||||
if(bm->getLastPage() == index)
|
||||
{
|
||||
bm->setLastPage(index,*operator[](index));
|
||||
emit bookmarksLoaded(*bm);
|
||||
}
|
||||
|
||||
}
|
70
YACReader/comic.h
Normal file
@ -0,0 +1,70 @@
|
||||
#ifndef __COMIC_H
|
||||
#define __COMIC_H
|
||||
#include <QtCore>
|
||||
#include <QImage>
|
||||
#include <QtGui>
|
||||
#include <QByteArray>
|
||||
#include <QMap>
|
||||
|
||||
#include "bookmarks.h"
|
||||
|
||||
class Comic : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
//Comic pages, one QPixmap for each file.
|
||||
QVector<QByteArray> _pages;
|
||||
QVector<uint> _sizes;
|
||||
QStringList _fileNames;
|
||||
QMap<QString,int> _newOrder;
|
||||
QVector<QString> _order;
|
||||
int _index;
|
||||
QString _path;
|
||||
bool _loaded;
|
||||
QProcess * _7z;
|
||||
QProcess * _7ze;
|
||||
int _cfi;
|
||||
QString _pathDir;
|
||||
Bookmarks * bm;
|
||||
void run();
|
||||
public:
|
||||
//Constructors
|
||||
Comic();
|
||||
Comic(const QString pathFile);
|
||||
void setup();
|
||||
//Load pages from file
|
||||
void load(const QString & path);
|
||||
void loadFromFile(const QString & pathFile);
|
||||
void loadFromDir(const QString & pathDir);
|
||||
int nextPage();
|
||||
int previousPage();
|
||||
void setIndex(unsigned int index);
|
||||
unsigned int getIndex(){return _index;};
|
||||
unsigned int numPages(){return _pages.size();}
|
||||
QPixmap * currentPage();
|
||||
bool loaded();
|
||||
QPixmap * operator[](unsigned int index);
|
||||
QVector<QByteArray> * getRawData(){return &_pages;};
|
||||
public slots:
|
||||
void loadImages();
|
||||
void loadSizes();
|
||||
void openingError(QProcess::ProcessError error);
|
||||
void loadFinished();
|
||||
void setBookmark();
|
||||
void removeBookmark();
|
||||
void saveBookmarks();
|
||||
void checkIsBookmark(int index);
|
||||
void updateBookmarkImage(int);
|
||||
signals:
|
||||
void imagesLoaded();
|
||||
void imageLoaded(int index);
|
||||
void imageLoaded(int index,const QByteArray & image);
|
||||
void pageChanged(int index);
|
||||
void numPages(unsigned int numPages);
|
||||
void errorOpening();
|
||||
void isBookmark(bool);
|
||||
void bookmarksLoaded(const Bookmarks &);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
199
YACReader/configuration.cpp
Normal file
@ -0,0 +1,199 @@
|
||||
#include "configuration.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#include <QCoreApplication>
|
||||
#include <QStringList>
|
||||
#include <QMessageBox>
|
||||
|
||||
|
||||
|
||||
#define PATH "PATH"
|
||||
#define MAG_GLASS_SIZE "MAG_GLASS_SIZE"
|
||||
#define ZOOM_LEVEL "ZOOM_LEVEL"
|
||||
#define SLIDE_SIZE "SLIDE_SIZE"
|
||||
#define FIT "FIT"
|
||||
#define FLOW_TYPE "FLOW_TYPE"
|
||||
#define FULLSCREEN "FULLSCREEN"
|
||||
#define FIT_TO_WIDTH_RATIO "FIT_TO_WIDTH_RATIO"
|
||||
#define POS "POS"
|
||||
#define SIZE "SIZE"
|
||||
#define MAXIMIZED "MAXIMIZED"
|
||||
#define DOUBLE_PAGE "DOUBLE_PAGE"
|
||||
#define ADJUST_TO_FULL_SIZE "ADJUST_TO_FULL_SIZE"
|
||||
#define BACKGROUND_COLOR "BACKGROUND_COLOR"
|
||||
#define ALWAYS_ON_TOP "ALWAYS_ON_TOP"
|
||||
|
||||
Configuration::Configuration()
|
||||
{
|
||||
//read configuration
|
||||
load("/YACReader.conf");
|
||||
}
|
||||
|
||||
Configuration::Configuration(const Configuration & conf)
|
||||
{
|
||||
//nothing
|
||||
}
|
||||
|
||||
void Configuration::load(const QString & path)
|
||||
{
|
||||
//load default configuration
|
||||
defaultPath = ".";
|
||||
magnifyingGlassSize = QSize(350,175);
|
||||
gotoSlideSize = QSize(126,200); //normal
|
||||
//gotoSlideSize = QSize(79,125); //small
|
||||
//gotoSlideSize = QSize(173,275); //big
|
||||
//gotoSlideSize = QSize(220,350); //huge
|
||||
zoomLevel = 0.5;
|
||||
adjustToWidth = true;
|
||||
flowType = PictureFlow::Strip;
|
||||
fullScreen = false;
|
||||
fitToWidthRatio = 1;
|
||||
windowSize = QSize(0,0);
|
||||
maximized = false;
|
||||
doublePage = false;
|
||||
adjustToFullSize = false;
|
||||
backgroundColor = QColor(0,0,0);
|
||||
alwaysOnTop = false;
|
||||
|
||||
//load from file
|
||||
QFile f(QCoreApplication::applicationDirPath()+path);
|
||||
f.open(QIODevice::ReadOnly);
|
||||
QTextStream txtS(&f);
|
||||
QString content = txtS.readAll();
|
||||
QStringList lines = content.split('\n');
|
||||
QString line,name;
|
||||
int i=0;
|
||||
foreach(line,lines)
|
||||
{
|
||||
if((i%2)==0)
|
||||
{
|
||||
name = line.trimmed();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(name==PATH)
|
||||
defaultPath = line.trimmed();
|
||||
else
|
||||
if(name==MAG_GLASS_SIZE)
|
||||
{
|
||||
QStringList values = line.split(',');
|
||||
magnifyingGlassSize = QSize(values[0].toInt(),values[1].toInt());
|
||||
}
|
||||
else
|
||||
if(name==ZOOM_LEVEL)
|
||||
zoomLevel = line.toFloat();
|
||||
else
|
||||
if(name==SLIDE_SIZE)
|
||||
{
|
||||
int height = line.toInt();
|
||||
gotoSlideSize = QSize(static_cast<int>(height/SLIDE_ASPECT_RATIO),height);
|
||||
}
|
||||
else
|
||||
if(name==FIT)
|
||||
adjustToWidth = line.toInt();
|
||||
else
|
||||
if(name==FLOW_TYPE)
|
||||
flowType = (PictureFlow::FlowType)line.toInt();
|
||||
else
|
||||
if(name==FULLSCREEN)
|
||||
fullScreen = line.toInt();
|
||||
else
|
||||
if(name==FIT_TO_WIDTH_RATIO)
|
||||
fitToWidthRatio = line.toFloat();
|
||||
else
|
||||
if(name==POS)
|
||||
{
|
||||
QStringList l = line.split(',');
|
||||
windowPos = QPoint(l[0].toInt(),l[1].toInt());
|
||||
}
|
||||
else
|
||||
if(name==SIZE)
|
||||
{
|
||||
QStringList l = line.split(',');
|
||||
windowSize = QSize(l[0].toInt(),l[1].toInt());
|
||||
}
|
||||
else
|
||||
if(name==MAXIMIZED)
|
||||
maximized = line.toInt();
|
||||
else
|
||||
if(name==DOUBLE_PAGE)
|
||||
doublePage = line.toInt();
|
||||
else
|
||||
if(name==ADJUST_TO_FULL_SIZE)
|
||||
adjustToFullSize = line.toInt();
|
||||
else
|
||||
if(name==BACKGROUND_COLOR)
|
||||
{
|
||||
QStringList l = line.split(',');
|
||||
backgroundColor = QColor(l[0].toInt(),l[1].toInt(),l[2].toInt());
|
||||
}
|
||||
else
|
||||
if(name==ALWAYS_ON_TOP)
|
||||
alwaysOnTop = line.toInt();
|
||||
|
||||
|
||||
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
void Configuration::save()
|
||||
{
|
||||
QFile f(QCoreApplication::applicationDirPath()+"/YACReader.conf");
|
||||
if(!f.open(QIODevice::WriteOnly))
|
||||
{
|
||||
QMessageBox::critical(NULL,tr("Saving config file...."),tr("There was a problem saving YACReader configuration. Please, check if you have enough permissions in the YACReader root folder."));
|
||||
}
|
||||
else
|
||||
{
|
||||
QTextStream txtS(&f);
|
||||
|
||||
txtS << PATH << "\n";
|
||||
txtS << defaultPath << "\n";
|
||||
|
||||
txtS << MAG_GLASS_SIZE << "\n";
|
||||
txtS << magnifyingGlassSize.width() <<","<< magnifyingGlassSize.height() << "\n";
|
||||
|
||||
txtS << ZOOM_LEVEL << "\n";
|
||||
txtS << zoomLevel << "\n";
|
||||
|
||||
txtS << SLIDE_SIZE << "\n";
|
||||
txtS << gotoSlideSize.height() << "\n";
|
||||
|
||||
txtS << FIT << "\n";
|
||||
txtS << (int)adjustToWidth << "\n";
|
||||
|
||||
txtS << FLOW_TYPE << "\n";
|
||||
txtS << (int)flowType << "\n";
|
||||
|
||||
txtS << FULLSCREEN << "\n";
|
||||
txtS << (int)fullScreen << "\n";
|
||||
|
||||
txtS << FIT_TO_WIDTH_RATIO << "\n";
|
||||
txtS << fitToWidthRatio << "\n";
|
||||
|
||||
txtS << POS << "\n";
|
||||
txtS << windowPos.x() << "," << windowPos.y() << "\n";
|
||||
|
||||
txtS << SIZE << "\n";
|
||||
txtS << windowSize.width() << "," << windowSize.height() << "\n";
|
||||
|
||||
txtS << MAXIMIZED << "\n";
|
||||
txtS << (int)maximized << "\n";
|
||||
|
||||
txtS << DOUBLE_PAGE << "\n";
|
||||
txtS << (int)doublePage << "\n";
|
||||
|
||||
txtS << ADJUST_TO_FULL_SIZE << "\n";
|
||||
txtS << (int) adjustToFullSize << "\n";
|
||||
|
||||
txtS << BACKGROUND_COLOR << "\n";
|
||||
txtS << backgroundColor.red() << "," << backgroundColor.green() << "," << backgroundColor.blue() << "\n";
|
||||
|
||||
txtS << ALWAYS_ON_TOP << "\n";
|
||||
txtS << (int)alwaysOnTop << "\n";
|
||||
}
|
||||
}
|
77
YACReader/configuration.h
Normal file
@ -0,0 +1,77 @@
|
||||
#ifndef __CONFIGURATION_H
|
||||
#define __CONFIGURATION_H
|
||||
#include <QString>
|
||||
#include <QSize>
|
||||
#include <QObject>
|
||||
#include "pictureflow.h"
|
||||
|
||||
#define CONF_FILE_PATH "."
|
||||
#define SLIDE_ASPECT_RATIO 1.585
|
||||
|
||||
class Configuration : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
QString defaultPath;
|
||||
//configuration properties
|
||||
QSize magnifyingGlassSize;
|
||||
QSize gotoSlideSize;
|
||||
float zoomLevel;
|
||||
bool adjustToWidth;
|
||||
bool fullScreen;
|
||||
PictureFlow::FlowType flowType;
|
||||
float fitToWidthRatio;
|
||||
QPoint windowPos;
|
||||
QSize windowSize;
|
||||
bool maximized;
|
||||
bool doublePage;
|
||||
bool alwaysOnTop;
|
||||
bool adjustToFullSize;
|
||||
QColor backgroundColor;
|
||||
|
||||
Configuration();
|
||||
Configuration(const Configuration & conf);
|
||||
void load(const QString & path = CONF_FILE_PATH);
|
||||
|
||||
public:
|
||||
static Configuration & getConfiguration()
|
||||
{
|
||||
static Configuration configuration;
|
||||
return configuration;
|
||||
};
|
||||
QString getDefaultPath() { return defaultPath; };
|
||||
void setDefaultPath(QString defaultPath){this->defaultPath = defaultPath;};
|
||||
QSize getMagnifyingGlassSize() { return magnifyingGlassSize;};
|
||||
void setMagnifyingGlassSize(const QSize & mgs) { magnifyingGlassSize = mgs;};
|
||||
QSize getGotoSlideSize() { return gotoSlideSize;};
|
||||
void setGotoSlideSize(const QSize & gss) { gotoSlideSize = gss;};
|
||||
float getZoomLevel() { return zoomLevel;};
|
||||
void setZoomLevel(float zl) { zoomLevel = zl;};
|
||||
bool getAdjustToWidth() {return adjustToWidth;};
|
||||
void setAdjustToWidth(bool atw=true) {adjustToWidth = atw;};
|
||||
PictureFlow::FlowType getFlowType(){return flowType;};
|
||||
void setFlowType(PictureFlow::FlowType type){flowType = type;};
|
||||
bool getFullScreen(){return fullScreen;};
|
||||
void setFullScreen(bool f){fullScreen = f;};
|
||||
float getFitToWidthRatio(){return fitToWidthRatio;};
|
||||
void setFitToWidthRatio(float r){fitToWidthRatio = r;};
|
||||
QPoint getPos(){return windowPos;};
|
||||
void setPos(QPoint p){windowPos = p;};
|
||||
QSize getSize(){return windowSize;};
|
||||
void setSize(QSize s){windowSize = s;};
|
||||
bool getMaximized(){return maximized;};
|
||||
void setMaximized(bool b){maximized = b;};
|
||||
bool getDoublePage(){return doublePage;};
|
||||
void setDoublePage(bool b){doublePage = b;};
|
||||
void setAdjustToFullSize(bool b){adjustToFullSize = b;};
|
||||
bool getAdjustToFullSize(){return adjustToFullSize;};
|
||||
void setBackgroundColor(const QColor& color){backgroundColor = color;};
|
||||
QColor getBackgroundColor(){return backgroundColor;};
|
||||
void setAlwaysOnTop(bool b){alwaysOnTop = b;};
|
||||
bool getAlwaysOnTop(){return alwaysOnTop;};
|
||||
void save();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
15
YACReader/files.qrc
Normal file
@ -0,0 +1,15 @@
|
||||
<RCC>
|
||||
<qresource>
|
||||
<file>../files/about.html</file>
|
||||
<file>../files/helpYACReader.html</file>
|
||||
<file>../files/shortcuts.html</file>
|
||||
<file>../files/shortcuts2.html</file>
|
||||
<file>../files/translator.html</file>
|
||||
<file>./yacreader_es.qm</file>
|
||||
</qresource>
|
||||
|
||||
<qresource lang="es_ES">
|
||||
<file alias="/files/about.html">../files/about_es_ES.html</file>
|
||||
<file alias="/files/helpYACReader.html">../files/helpYACReader_es_ES.html</file>
|
||||
</qresource>
|
||||
</RCC>
|
71
YACReader/goto_dialog.cpp
Normal file
@ -0,0 +1,71 @@
|
||||
#include "goto_dialog.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QIntValidator>
|
||||
|
||||
|
||||
|
||||
GoToDialog::GoToDialog(QWidget * parent)
|
||||
:QDialog(parent)
|
||||
{
|
||||
setupUI();
|
||||
}
|
||||
|
||||
void GoToDialog::setupUI()
|
||||
{
|
||||
textLabel = new QLabel(tr("Page : "));
|
||||
pageNumber = new QLineEdit;
|
||||
v = new QIntValidator(this);
|
||||
v->setBottom(1);
|
||||
pageNumber->setValidator(v);
|
||||
textLabel->setBuddy(pageNumber);
|
||||
textLabel->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||
|
||||
accept = new QPushButton(tr("Go To"));
|
||||
connect(accept,SIGNAL(clicked()),this,SLOT(goTo()));
|
||||
cancel = new QPushButton(tr("Cancel"));
|
||||
connect(cancel,SIGNAL(clicked()),this,SLOT(close()));
|
||||
|
||||
QHBoxLayout *topLayout = new QHBoxLayout;
|
||||
|
||||
topLayout->addWidget(textLabel);
|
||||
topLayout->addWidget(pageNumber);
|
||||
|
||||
QHBoxLayout *bottomLayout = new QHBoxLayout;
|
||||
bottomLayout->addStretch();
|
||||
bottomLayout->addWidget(accept);
|
||||
bottomLayout->addWidget(cancel);
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
mainLayout->addWidget(numPagesLabel = new QLabel(tr("Total pages : ")));
|
||||
mainLayout->addLayout(topLayout);
|
||||
mainLayout->addStretch();
|
||||
mainLayout->addLayout(bottomLayout);
|
||||
|
||||
QHBoxLayout *imgMainLayout = new QHBoxLayout;
|
||||
QLabel * imgLabel = new QLabel();
|
||||
QPixmap p(":/images/goto.png");
|
||||
imgLabel->setPixmap(p);
|
||||
imgMainLayout->addWidget(imgLabel);
|
||||
imgMainLayout->addLayout(mainLayout);
|
||||
|
||||
setLayout(imgMainLayout);
|
||||
|
||||
setWindowTitle(tr("Go to..."));
|
||||
setModal (true);
|
||||
}
|
||||
|
||||
void GoToDialog::goTo()
|
||||
{
|
||||
unsigned int page = pageNumber->text().toInt();
|
||||
pageNumber->clear();
|
||||
emit(goToPage(page));
|
||||
close();
|
||||
}
|
||||
|
||||
void GoToDialog::setNumPages(unsigned int numPages)
|
||||
{
|
||||
numPagesLabel->setText(tr("Total pages : ")+QString::number(numPages));
|
||||
v->setTop(numPages);
|
||||
}
|
31
YACReader/goto_dialog.h
Normal file
@ -0,0 +1,31 @@
|
||||
#ifndef __GOTODIALOG_H
|
||||
#define __GOTODIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QIntValidator>
|
||||
|
||||
class GoToDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GoToDialog(QWidget * parent = 0);
|
||||
private:
|
||||
QLabel * numPagesLabel;
|
||||
QLabel * textLabel;
|
||||
QLineEdit * pageNumber;
|
||||
QIntValidator * v;
|
||||
QPushButton * accept;
|
||||
QPushButton * cancel;
|
||||
void setupUI();
|
||||
public slots:
|
||||
void goTo();
|
||||
void setNumPages(unsigned int numPages);
|
||||
signals:
|
||||
void goToPage(unsigned int page);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
373
YACReader/goto_flow.cpp
Normal file
@ -0,0 +1,373 @@
|
||||
#include "goto_flow.h"
|
||||
#include "configuration.h"
|
||||
#include "comic.h"
|
||||
#include "custom_widgets.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QSize>
|
||||
#include <QImage>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QMutex>
|
||||
#include <QCoreApplication>
|
||||
|
||||
/*#define WIDTH 126
|
||||
#define HEIGHT 200*/
|
||||
|
||||
QMutex mutexGoToFlow;
|
||||
|
||||
|
||||
|
||||
GoToFlow::GoToFlow(QWidget *parent,PictureFlow::FlowType flowType)
|
||||
:QWidget(parent),ready(false)
|
||||
{
|
||||
updateTimer = new QTimer;
|
||||
connect(updateTimer, SIGNAL(timeout()), this, SLOT(updateImageData()));
|
||||
|
||||
worker = new PageLoader;
|
||||
|
||||
QVBoxLayout * layout = new QVBoxLayout(this);
|
||||
flow = new YACReaderFlow(this,flowType);
|
||||
flow->setReflectionEffect(PictureFlow::PlainReflection);
|
||||
imageSize = Configuration::getConfiguration().getGotoSlideSize();
|
||||
|
||||
flow->setSlideSize(imageSize);
|
||||
connect(flow,SIGNAL(centerIndexChanged(int)),this,SLOT(setPageNumber(int)));
|
||||
connect(flow,SIGNAL(selected(unsigned int)),this,SLOT(goTo()));
|
||||
|
||||
QHBoxLayout * bottom = new QHBoxLayout(this);
|
||||
bottom->addStretch();
|
||||
bottom->addWidget(new QLabel(tr("Page : "),this));
|
||||
bottom->addWidget(edit = new QLineEdit(this));
|
||||
v = new QIntValidator(this);
|
||||
v->setBottom(1);
|
||||
edit->setValidator(v);
|
||||
edit->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||
edit->setFixedWidth(40);
|
||||
edit->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Minimum));
|
||||
|
||||
centerButton = new QPushButton(this);
|
||||
centerButton->setIcon(QIcon(":/images/center.png"));
|
||||
connect(centerButton,SIGNAL(clicked()),this,SLOT(centerSlide()));
|
||||
bottom->addWidget(centerButton);
|
||||
|
||||
goToButton = new QPushButton(this);
|
||||
goToButton->setIcon(QIcon(":/images/goto.png"));
|
||||
connect(goToButton,SIGNAL(clicked()),this,SLOT(goTo()));
|
||||
bottom->addWidget(goToButton);
|
||||
|
||||
bottom->addStretch();
|
||||
|
||||
layout->addWidget(flow);
|
||||
layout->addLayout(bottom);
|
||||
layout->setStretchFactor(flow,1);
|
||||
layout->setStretchFactor(bottom,0);
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
setLayout(layout);
|
||||
this->setAutoFillBackground(true);
|
||||
resize(static_cast<int>(5*imageSize.width()),static_cast<int>(imageSize.height()*1.7));
|
||||
|
||||
//install eventFilter
|
||||
//flow->installEventFilter(this);
|
||||
edit->installEventFilter(this);
|
||||
centerButton->installEventFilter(this);
|
||||
goToButton->installEventFilter(this);
|
||||
|
||||
connect(edit,SIGNAL(returnPressed()),goToButton,SIGNAL(clicked()));
|
||||
|
||||
this->setCursor(QCursor(Qt::ArrowCursor));
|
||||
}
|
||||
|
||||
void GoToFlow::goTo()
|
||||
{
|
||||
//emit(goToPage(flow->centerIndex()+1));
|
||||
emit(goToPage(edit->text().toInt()));
|
||||
}
|
||||
|
||||
void GoToFlow::setPageNumber(int page)
|
||||
{
|
||||
edit->setText(QString::number(page+1));
|
||||
}
|
||||
|
||||
void GoToFlow::centerSlide()
|
||||
{
|
||||
int page = edit->text().toInt()-1;
|
||||
int distance = flow->centerIndex()-page;
|
||||
|
||||
if(abs(distance)>10)
|
||||
{
|
||||
if(distance<0)
|
||||
flow->setCenterIndex(flow->centerIndex()+(-distance)-10);
|
||||
else
|
||||
flow->setCenterIndex(flow->centerIndex()-distance+10);
|
||||
}
|
||||
|
||||
flow->showSlide(page);
|
||||
}
|
||||
|
||||
void GoToFlow::centerSlide(int slide)
|
||||
{
|
||||
if(flow->centerIndex()!=slide)
|
||||
{
|
||||
flow->setCenterIndex(slide);
|
||||
if(ready)// load images if pages are loaded.
|
||||
{
|
||||
//worker->reset(); //BUG FIXED : image didn't load if worker was working
|
||||
preload();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GoToFlow::setNumSlides(unsigned int slides)
|
||||
{
|
||||
// numPagesLabel->setText(tr("Total pages : ")+QString::number(slides));
|
||||
// numPagesLabel->adjustSize();
|
||||
imagesReady.clear();
|
||||
imagesReady.fill(false,slides);
|
||||
|
||||
rawImages.clear();
|
||||
rawImages.resize(slides);
|
||||
|
||||
v->setTop(slides);
|
||||
|
||||
SlideInitializer * si = new SlideInitializer(flow,slides);
|
||||
|
||||
imagesLoaded.clear();
|
||||
imagesLoaded.fill(false,slides);
|
||||
|
||||
imagesSetted.clear();
|
||||
imagesSetted.fill(false,slides);
|
||||
|
||||
numImagesLoaded = 0;
|
||||
|
||||
connect(flow, SIGNAL(centerIndexChanged(int)), this, SLOT(preload()));
|
||||
|
||||
ready = true;
|
||||
worker->reset();
|
||||
|
||||
si->start();
|
||||
}
|
||||
|
||||
void GoToFlow::reset()
|
||||
{
|
||||
updateTimer->stop();
|
||||
/*imagesLoaded.clear();
|
||||
numImagesLoaded = 0;
|
||||
imagesReady.clear();
|
||||
rawImages.clear();*/
|
||||
ready = false;
|
||||
}
|
||||
|
||||
void GoToFlow::setImageReady(int index,const QByteArray & image)
|
||||
{
|
||||
rawImages[index]=image;
|
||||
imagesReady[index]=true;
|
||||
preload();
|
||||
}
|
||||
|
||||
void GoToFlow::preload()
|
||||
{
|
||||
if(numImagesLoaded < imagesLoaded.size())
|
||||
updateTimer->start(70);
|
||||
}
|
||||
|
||||
void GoToFlow::updateImageData()
|
||||
{
|
||||
// can't do anything, wait for the next possibility
|
||||
if(worker->busy())
|
||||
return;
|
||||
|
||||
// set image of last one
|
||||
int idx = worker->index();
|
||||
if( idx >= 0 && !worker->result().isNull())
|
||||
{
|
||||
if(!imagesSetted[idx])
|
||||
{
|
||||
flow->setSlide(idx, worker->result());
|
||||
imagesSetted[idx] = true;
|
||||
numImagesLoaded++;
|
||||
rawImages[idx].clear();; //release memory
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// try to load only few images on the left and right side
|
||||
// i.e. all visible ones plus some extra
|
||||
#define COUNT 8
|
||||
int indexes[2*COUNT+1];
|
||||
int center = flow->centerIndex();
|
||||
indexes[0] = center;
|
||||
for(int j = 0; j < COUNT; j++)
|
||||
{
|
||||
indexes[j*2+1] = center+j+1;
|
||||
indexes[j*2+2] = center-j-1;
|
||||
}
|
||||
for(int c = 0; c < 2*COUNT+1; c++)
|
||||
{
|
||||
int i = indexes[c];
|
||||
if((i >= 0) && (i < flow->slideCount()))
|
||||
if(!imagesLoaded[i]&&imagesReady[i])//slide(i).isNull())
|
||||
{
|
||||
// schedule thumbnail generation
|
||||
imagesLoaded[i]=true;
|
||||
worker->generate(i, flow->slideSize(),rawImages[i]);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// no need to generate anything? stop polling...
|
||||
updateTimer->stop();
|
||||
}
|
||||
|
||||
bool GoToFlow::eventFilter(QObject *target, QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::KeyPress)
|
||||
{
|
||||
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
||||
int key = keyEvent->key();
|
||||
if((key==Qt::Key_Return)||
|
||||
(key==Qt::Key_Enter)||
|
||||
(key==Qt::Key_Space)||
|
||||
(key==Qt::Key_Left)||
|
||||
(key==Qt::Key_Right)||
|
||||
(key==Qt::Key_S))
|
||||
this->keyPressEvent(keyEvent);
|
||||
}
|
||||
return QWidget::eventFilter(target, event);
|
||||
}
|
||||
|
||||
|
||||
void GoToFlow::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
switch (event->key())
|
||||
{
|
||||
case Qt::Key_Return: case Qt::Key_Enter:
|
||||
goTo();
|
||||
centerSlide();
|
||||
break;
|
||||
case Qt::Key_Space:
|
||||
centerSlide();
|
||||
break;
|
||||
case Qt::Key_S:
|
||||
QCoreApplication::sendEvent(this->parent(),event);
|
||||
break;
|
||||
case Qt::Key_Left: case Qt::Key_Right:
|
||||
QCoreApplication::sendEvent(flow,event);
|
||||
}
|
||||
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void GoToFlow::wheelEvent(QWheelEvent * event)
|
||||
{
|
||||
if(event->delta()<0)
|
||||
flow->showNext();
|
||||
else
|
||||
flow->showPrevious();
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void GoToFlow::setFlowType(PictureFlow::FlowType flowType)
|
||||
{
|
||||
flow->setFlowType(flowType);
|
||||
}
|
||||
|
||||
void GoToFlow::updateSize() //TODO : fix. it doesn't work.
|
||||
{
|
||||
imageSize = Configuration::getConfiguration().getGotoSlideSize();
|
||||
flow->setSlideSize(imageSize);
|
||||
resize(static_cast<int>(5*imageSize.width()),static_cast<int>(imageSize.height()*1.7));
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
//SlideInitializer
|
||||
//-----------------------------------------------------------------------------
|
||||
SlideInitializer::SlideInitializer(PictureFlow * flow,int slides)
|
||||
:QThread(),_flow(flow),_slides(slides)
|
||||
{
|
||||
|
||||
}
|
||||
void SlideInitializer::run()
|
||||
{
|
||||
mutexGoToFlow.lock();
|
||||
|
||||
_flow->clear();
|
||||
for(int i=0;i<_slides;i++)
|
||||
_flow->addSlide(QImage());
|
||||
_flow->setCenterIndex(0);
|
||||
|
||||
mutexGoToFlow.unlock();
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
//PageLoader
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
PageLoader::PageLoader():
|
||||
QThread(), restart(false), working(false), idx(-1)
|
||||
{
|
||||
}
|
||||
|
||||
PageLoader::~PageLoader()
|
||||
{
|
||||
mutexGoToFlow.lock();
|
||||
condition.wakeOne();
|
||||
mutexGoToFlow.unlock();
|
||||
wait();
|
||||
}
|
||||
|
||||
bool PageLoader::busy() const
|
||||
{
|
||||
return isRunning() ? working : false;
|
||||
}
|
||||
|
||||
void PageLoader::generate(int index, QSize size,const QByteArray & rImage)
|
||||
{
|
||||
mutexGoToFlow.lock();
|
||||
this->idx = index;
|
||||
//this->img = QImage();
|
||||
this->size = size;
|
||||
this->rawImage = rImage;
|
||||
mutexGoToFlow.unlock();
|
||||
|
||||
if (!isRunning())
|
||||
start();
|
||||
else
|
||||
{
|
||||
// already running, wake up whenever ready
|
||||
restart = true;
|
||||
condition.wakeOne();
|
||||
}
|
||||
}
|
||||
|
||||
void PageLoader::run()
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
// copy necessary data
|
||||
mutexGoToFlow.lock();
|
||||
this->working = true;
|
||||
//int idx = this->idx;
|
||||
|
||||
|
||||
QImage image;
|
||||
image.loadFromData(this->rawImage);
|
||||
// let everyone knows it is ready
|
||||
image = image.scaled(this->size,Qt::KeepAspectRatio,Qt::SmoothTransformation);
|
||||
|
||||
mutexGoToFlow.unlock();
|
||||
|
||||
mutexGoToFlow.lock();
|
||||
this->working = false;
|
||||
this->img = image;
|
||||
mutexGoToFlow.unlock();
|
||||
|
||||
// put to sleep
|
||||
mutexGoToFlow.lock();
|
||||
if (!this->restart)
|
||||
condition.wait(&mutexGoToFlow);
|
||||
restart = false;
|
||||
mutexGoToFlow.unlock();
|
||||
}
|
||||
}
|
105
YACReader/goto_flow.h
Normal file
@ -0,0 +1,105 @@
|
||||
#ifndef __GOTO_FLOW_H
|
||||
#define __GOTO_FLOW_H
|
||||
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QPixmap>
|
||||
#include <QThread>
|
||||
#include <QSize>
|
||||
#include <QIntValidator>
|
||||
#include <QWaitCondition>
|
||||
#include <QObject>
|
||||
#include <QEvent>
|
||||
#include <QLabel>
|
||||
#include "custom_widgets.h"
|
||||
class Comic;
|
||||
|
||||
class SlideInitializer;
|
||||
class PageLoader;
|
||||
|
||||
class GoToFlow : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GoToFlow(QWidget* parent = 0,PictureFlow::FlowType flowType = PictureFlow::CoverFlowLike);
|
||||
bool ready; //comic is ready for read.
|
||||
void keyPressEvent(QKeyEvent* event);
|
||||
bool eventFilter(QObject *target, QEvent *event);
|
||||
private:
|
||||
YACReaderFlow * flow;
|
||||
QLineEdit * edit;
|
||||
QIntValidator * v;
|
||||
QPushButton * centerButton;
|
||||
QPushButton * goToButton;
|
||||
Comic * comic;
|
||||
QSize imageSize;
|
||||
|
||||
QVector<bool> imagesLoaded;
|
||||
QVector<bool> imagesSetted;
|
||||
uint numImagesLoaded;
|
||||
QVector<bool> imagesReady;
|
||||
QVector<QByteArray> rawImages;
|
||||
QTimer* updateTimer;
|
||||
PageLoader* worker;
|
||||
virtual void wheelEvent(QWheelEvent * event);
|
||||
|
||||
private slots:
|
||||
void preload();
|
||||
void updateImageData();
|
||||
|
||||
public slots:
|
||||
void goTo();
|
||||
void setPageNumber(int page);
|
||||
void centerSlide();
|
||||
void centerSlide(int slide);
|
||||
void reset();
|
||||
void setNumSlides(unsigned int slides);
|
||||
void setImageReady(int index,const QByteArray & image);
|
||||
void setFlowType(PictureFlow::FlowType flowType);
|
||||
void updateSize();
|
||||
signals:
|
||||
void goToPage(unsigned int page);
|
||||
|
||||
|
||||
};
|
||||
//-----------------------------------------------------------------------------
|
||||
//SlideInitializer
|
||||
//-----------------------------------------------------------------------------
|
||||
class SlideInitializer : public QThread
|
||||
{
|
||||
public:
|
||||
SlideInitializer(PictureFlow * flow,int slides);
|
||||
private:
|
||||
PictureFlow * _flow;
|
||||
int _slides;
|
||||
void run();
|
||||
};
|
||||
//-----------------------------------------------------------------------------
|
||||
//PageLoader
|
||||
//-----------------------------------------------------------------------------
|
||||
class PageLoader : public QThread
|
||||
{
|
||||
public:
|
||||
PageLoader();
|
||||
~PageLoader();
|
||||
// returns FALSE if worker is still busy and can't take the task
|
||||
bool busy() const;
|
||||
void generate(int index, QSize size,const QByteArray & rImage);
|
||||
void reset(){idx = -1;};
|
||||
int index() const { return idx; }
|
||||
QImage result() const { return img; }
|
||||
protected:
|
||||
void run();
|
||||
private:
|
||||
QWaitCondition condition;
|
||||
|
||||
bool restart;
|
||||
bool working;
|
||||
int idx;
|
||||
|
||||
QSize size;
|
||||
QImage img;
|
||||
QByteArray rawImage;
|
||||
};
|
||||
|
||||
#endif
|
BIN
YACReader/icon.ico
Normal file
After Width: | Height: | Size: 97 KiB |
1
YACReader/icon.rc
Normal file
@ -0,0 +1 @@
|
||||
IDI_ICON1 ICON DISCARDABLE "icon.ico"
|
67
YACReader/images.qrc
Normal file
@ -0,0 +1,67 @@
|
||||
<RCC>
|
||||
<qresource>
|
||||
<file>../images/open.png</file>
|
||||
<file>../images/openFolder.png</file>
|
||||
<file>../images/next.png</file>
|
||||
<file>../images/prev.png</file>
|
||||
<file>../images/icon.png</file>
|
||||
<file>../images/zoom.png</file>
|
||||
<file>../images/fit.png</file>
|
||||
<file>../images/goto.png</file>
|
||||
<file>../images/help.png</file>
|
||||
<file>../images/center.png</file>
|
||||
<file>../images/options.png</file>
|
||||
<file>../images/comicFolder.png</file>
|
||||
<file>../images/save.png</file>
|
||||
<file>../images/rotateL.png</file>
|
||||
<file>../images/rotateR.png</file>
|
||||
<file>../images/flow1.png</file>
|
||||
<file>../images/flow2.png</file>
|
||||
<file>../images/flow3.png</file>
|
||||
<file>../images/bookmark.png</file>
|
||||
<file>../images/setBookmark.png</file>
|
||||
<file>../images/notCover.png</file>
|
||||
<file>../images/previousComic.png</file>
|
||||
<file>../images/nextComic.png</file>
|
||||
<file>../images/deleteLibrary.png</file>
|
||||
<file>../images/properties.png</file>
|
||||
<file>../images/doublePage.png</file>
|
||||
<file>../images/shortcuts.png</file>
|
||||
<file>../images/close.png</file>
|
||||
<file>../images/up.png</file>
|
||||
<file>../images/down.png</file>
|
||||
<file>../images/dictionary.png</file>
|
||||
<file>../images/alwaysOnTop.png</file>
|
||||
<file>../images/adjustToFullSize.png</file>
|
||||
<file>../images/helpImages/open.png</file>
|
||||
<file>../images/helpImages/openFolder.png</file>
|
||||
<file>../images/helpImages/next.png</file>
|
||||
<file>../images/helpImages/prev.png</file>
|
||||
<file>../images/helpImages/icon.png</file>
|
||||
<file>../images/helpImages/zoom.png</file>
|
||||
<file>../images/helpImages/fit.png</file>
|
||||
<file>../images/helpImages/goto.png</file>
|
||||
<file>../images/helpImages/help.png</file>
|
||||
<file>../images/helpImages/center.png</file>
|
||||
<file>../images/helpImages/options.png</file>
|
||||
<file>../images/helpImages/comicFolder.png</file>
|
||||
<file>../images/helpImages/save.png</file>
|
||||
<file>../images/helpImages/rotateL.png</file>
|
||||
<file>../images/helpImages/rotateR.png</file>
|
||||
<file>../images/helpImages/flow1.png</file>
|
||||
<file>../images/helpImages/flow2.png</file>
|
||||
<file>../images/helpImages/flow3.png</file>
|
||||
<file>../images/helpImages/bookmark.png</file>
|
||||
<file>../images/helpImages/setBookmark.png</file>
|
||||
<file>../images/helpImages/notCover.png</file>
|
||||
<file>../images/helpImages/previousComic.png</file>
|
||||
<file>../images/helpImages/nextComic.png</file>
|
||||
<file>../images/helpImages/deleteLibrary.png</file>
|
||||
<file>../images/helpImages/properties.png</file>
|
||||
<file>../images/helpImages/doublePage.png</file>
|
||||
<file>../images/helpImages/shortcuts.png</file>
|
||||
<file>../images/helpImages/keyboard.png</file>
|
||||
<file>../images/helpImages/mouse.png</file>
|
||||
<file>../images/helpImages/speaker.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
267
YACReader/magnifying_glass.cpp
Normal file
@ -0,0 +1,267 @@
|
||||
#include "magnifying_glass.h"
|
||||
#include "viewer.h"
|
||||
|
||||
|
||||
|
||||
MagnifyingGlass::MagnifyingGlass(int w, int h, QWidget * parent)
|
||||
:QLabel(parent),zoomLevel(0.5)
|
||||
{
|
||||
setup(QSize(w,h));
|
||||
}
|
||||
|
||||
MagnifyingGlass::MagnifyingGlass(const QSize & size, QWidget * parent)
|
||||
:QLabel(parent),zoomLevel(0.5)
|
||||
{
|
||||
setup(size);
|
||||
}
|
||||
|
||||
void MagnifyingGlass::setup(const QSize & size)
|
||||
{
|
||||
resize(size);
|
||||
setScaledContents(true);
|
||||
setMouseTracking(true);
|
||||
setCursor(QCursor(Qt::BlankCursor));
|
||||
}
|
||||
|
||||
void MagnifyingGlass::mouseMoveEvent(QMouseEvent * event)
|
||||
{
|
||||
updateImage();
|
||||
}
|
||||
|
||||
void MagnifyingGlass::updateImage(int x, int y)
|
||||
{
|
||||
//image section augmented
|
||||
int zoomWidth = static_cast<int>(width() * zoomLevel);
|
||||
int zoomHeight = static_cast<int>(height() * zoomLevel);
|
||||
Viewer * p = (Viewer *)parent();
|
||||
int currentPos = p->verticalScrollBar()->sliderPosition();
|
||||
const QPixmap * image = p->pixmap();
|
||||
int iWidth = image->width();
|
||||
int iHeight = image->height();
|
||||
float wFactor = static_cast<float>(iWidth) / p->widget()->width();
|
||||
float hFactor = static_cast<float>(iHeight) / p->widget()->height();
|
||||
zoomWidth *= wFactor;
|
||||
zoomHeight *= hFactor;
|
||||
if(p->verticalScrollBar()->minimum()==p->verticalScrollBar()->maximum())
|
||||
{
|
||||
int xp = static_cast<int>(((x-p->widget()->pos().x())*wFactor)-zoomWidth/2);
|
||||
int yp = static_cast<int>((y-p->widget()->pos().y()+currentPos)*hFactor-zoomHeight/2);
|
||||
int xOffset=0;
|
||||
int yOffset=0;
|
||||
int zw=zoomWidth;
|
||||
int zh=zoomHeight;
|
||||
//int wOffset,hOffset=0;
|
||||
bool outImage = false;
|
||||
if(xp<0)
|
||||
{
|
||||
xOffset = -xp;
|
||||
xp=0;
|
||||
zw = zw - xOffset;
|
||||
outImage = true;
|
||||
}
|
||||
if(yp<0)
|
||||
{
|
||||
yOffset = -yp;
|
||||
yp=0;
|
||||
zh = zh - yOffset;
|
||||
outImage = true;
|
||||
}
|
||||
|
||||
if(xp+zoomWidth >= image->width())
|
||||
{
|
||||
zw -= xp+zw - image->width();
|
||||
outImage = true;
|
||||
}
|
||||
if(yp+zoomHeight >= image->height())
|
||||
{
|
||||
zh -= yp+zh - image->height();
|
||||
outImage = true;
|
||||
}
|
||||
if(outImage)
|
||||
{
|
||||
QImage img(zoomWidth,zoomHeight,QImage::Format_RGB32);
|
||||
img.fill(0);
|
||||
if(zw>0&&zh>0)
|
||||
{
|
||||
QPainter painter(&img);
|
||||
painter.drawPixmap(xOffset,yOffset,p->pixmap()->copy(xp,yp,zw,zh));
|
||||
}
|
||||
setPixmap(QPixmap().fromImage(img));
|
||||
}
|
||||
else
|
||||
setPixmap(p->pixmap()->copy(xp,yp,zoomWidth,zoomHeight));
|
||||
}
|
||||
else
|
||||
{
|
||||
int xp = static_cast<int>(((x-p->widget()->pos().x())*wFactor)-zoomWidth/2);
|
||||
int yp = static_cast<int>((y+currentPos)*hFactor-zoomHeight/2);
|
||||
int xOffset=0;
|
||||
int yOffset=0;
|
||||
int zw=zoomWidth;
|
||||
int zh=zoomHeight;
|
||||
//int wOffset,hOffset=0;
|
||||
bool outImage = false;
|
||||
if(xp<0)
|
||||
{
|
||||
xOffset = -xp;
|
||||
xp=0;
|
||||
zw = zw - xOffset;
|
||||
outImage = true;
|
||||
}
|
||||
if(yp<0)
|
||||
{
|
||||
yOffset = -yp;
|
||||
yp=0;
|
||||
zh = zh - yOffset;
|
||||
outImage = true;
|
||||
}
|
||||
|
||||
if(xp+zoomWidth >= image->width())
|
||||
{
|
||||
zw -= xp+zw - image->width();
|
||||
outImage = true;
|
||||
}
|
||||
if(yp+zoomHeight >= image->height())
|
||||
{
|
||||
zh -= yp+zh - image->height();
|
||||
outImage = true;
|
||||
}
|
||||
if(outImage)
|
||||
{
|
||||
QImage img(zoomWidth,zoomHeight,QImage::Format_RGB32);
|
||||
img.fill(0);
|
||||
if(zw>0&&zh>0)
|
||||
{
|
||||
QPainter painter(&img);
|
||||
painter.drawPixmap(xOffset,yOffset,p->pixmap()->copy(xp,yp,zw,zh));
|
||||
}
|
||||
setPixmap(QPixmap().fromImage(img));
|
||||
}
|
||||
else
|
||||
setPixmap(p->pixmap()->copy(xp,yp,zoomWidth,zoomHeight));
|
||||
}
|
||||
move(static_cast<int>(x-float(width())/2),static_cast<int>(y-float(height())/2));
|
||||
}
|
||||
|
||||
void MagnifyingGlass::updateImage()
|
||||
{
|
||||
if(isVisible())
|
||||
{
|
||||
QPoint p = QPoint(cursor().pos().x(),cursor().pos().y());
|
||||
p = this->parentWidget()->mapFromGlobal(p);
|
||||
updateImage(p.x(),p.y());
|
||||
}
|
||||
}
|
||||
void MagnifyingGlass::wheelEvent(QWheelEvent * event)
|
||||
{
|
||||
switch(event->modifiers())
|
||||
{
|
||||
//size
|
||||
case Qt::NoModifier:
|
||||
if(event->delta()<0)
|
||||
sizeUp();
|
||||
else
|
||||
sizeDown();
|
||||
break;
|
||||
//size height
|
||||
case Qt::ControlModifier:
|
||||
if(event->delta()<0)
|
||||
heightUp();
|
||||
else
|
||||
heightDown();
|
||||
break;
|
||||
//size width
|
||||
case Qt::AltModifier:
|
||||
if(event->delta()<0)
|
||||
widthUp();
|
||||
else
|
||||
widthDown();
|
||||
break;
|
||||
//zoom level
|
||||
case Qt::ShiftModifier:
|
||||
if(event->delta()<0)
|
||||
zoomIn();
|
||||
else
|
||||
zoomOut();
|
||||
break;
|
||||
}
|
||||
updateImage();
|
||||
event->setAccepted(true);
|
||||
}
|
||||
void MagnifyingGlass::zoomIn()
|
||||
{
|
||||
if(zoomLevel>0.2)
|
||||
zoomLevel -= 0.025;
|
||||
}
|
||||
|
||||
void MagnifyingGlass::zoomOut()
|
||||
{
|
||||
if(zoomLevel<0.9)
|
||||
zoomLevel += 0.025;
|
||||
}
|
||||
|
||||
void MagnifyingGlass::sizeUp()
|
||||
{
|
||||
Viewer * p = (Viewer *)parent();
|
||||
if(width()<(p->width()*0.90))
|
||||
resize(width()+30,height()+15);
|
||||
}
|
||||
|
||||
void MagnifyingGlass::sizeDown()
|
||||
{
|
||||
if(width()>175)
|
||||
resize(width()-30,height()-15);
|
||||
}
|
||||
|
||||
void MagnifyingGlass::heightUp()
|
||||
{
|
||||
Viewer * p = (Viewer *)parent();
|
||||
if(height()<(p->height()*0.90))
|
||||
resize(width(),height()+15);
|
||||
}
|
||||
|
||||
void MagnifyingGlass::heightDown()
|
||||
{
|
||||
if(height()>80)
|
||||
resize(width(),height()-15);
|
||||
}
|
||||
|
||||
void MagnifyingGlass::widthUp()
|
||||
{
|
||||
Viewer * p = (Viewer *)parent();
|
||||
if(width()<(p->width()*0.90))
|
||||
resize(width()+30,height());
|
||||
}
|
||||
|
||||
void MagnifyingGlass::widthDown()
|
||||
{
|
||||
if(width()>175)
|
||||
resize(width()-30,height());
|
||||
}
|
||||
|
||||
void MagnifyingGlass::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
bool validKey = false;
|
||||
switch (event->key())
|
||||
{
|
||||
case Qt::Key_Plus:
|
||||
sizeUp();
|
||||
validKey = true;
|
||||
break;
|
||||
case Qt::Key_Minus:
|
||||
sizeDown();
|
||||
validKey = true;
|
||||
break;
|
||||
case Qt::Key_Underscore:
|
||||
zoomOut();
|
||||
validKey = true;
|
||||
break;
|
||||
case Qt::Key_Asterisk:
|
||||
zoomIn();
|
||||
validKey = true;
|
||||
break;
|
||||
}
|
||||
updateImage();
|
||||
if(validKey)
|
||||
event->setAccepted(true);
|
||||
}
|
34
YACReader/magnifying_glass.h
Normal file
@ -0,0 +1,34 @@
|
||||
#ifndef __MAGNIFYING_GLASS
|
||||
#define __MAGNIFYING_GLASS
|
||||
|
||||
#include <QLabel>
|
||||
#include <QtGui>
|
||||
#include <QMouseEvent>
|
||||
#include <QWidget>
|
||||
|
||||
class MagnifyingGlass : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
float zoomLevel;
|
||||
void setup(const QSize & size);
|
||||
void keyPressEvent(QKeyEvent * event);
|
||||
public:
|
||||
MagnifyingGlass(int width,int height,QWidget * parent);
|
||||
MagnifyingGlass(const QSize & size, QWidget * parent);
|
||||
void mouseMoveEvent(QMouseEvent * event);
|
||||
public slots:
|
||||
void updateImage(int x, int y);
|
||||
void updateImage();
|
||||
void wheelEvent(QWheelEvent * event);
|
||||
void zoomIn();
|
||||
void zoomOut();
|
||||
void sizeUp();
|
||||
void sizeDown();
|
||||
void heightUp();
|
||||
void heightDown();
|
||||
void widthUp();
|
||||
void widthDown();
|
||||
};
|
||||
|
||||
#endif
|
34
YACReader/main.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
#include <QApplication>
|
||||
#include <QPixmap>
|
||||
#include <QLabel>
|
||||
//#include <QMetaObject>
|
||||
#include <QPushButton>
|
||||
#include <QMainWindow>
|
||||
#include <QtCore>
|
||||
#include <QThread>
|
||||
#include <QFile>
|
||||
#include <QDataStream>
|
||||
#include <QTranslator>
|
||||
#include "main_window_viewer.h"
|
||||
#include "configuration.h"
|
||||
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
QTranslator translator;
|
||||
QString sufix = QLocale::system().name();
|
||||
translator.load(":/yacreader_"+sufix);
|
||||
app.installTranslator(&translator);
|
||||
app.setApplicationName("YACReader");
|
||||
|
||||
MainWindowViewer mwv;
|
||||
mwv.show();
|
||||
|
||||
int ret = app.exec();
|
||||
|
||||
Configuration::getConfiguration().save();
|
||||
|
||||
return ret;
|
||||
}
|
680
YACReader/main_window_viewer.cpp
Normal file
@ -0,0 +1,680 @@
|
||||
#include "main_window_viewer.h"
|
||||
#include "configuration.h"
|
||||
#include "viewer.h"
|
||||
#include "goto_dialog.h"
|
||||
#include "custom_widgets.h"
|
||||
#include "options_dialog.h"
|
||||
#include "check_new_version.h"
|
||||
#include "comic.h"
|
||||
#include "bookmarks_dialog.h"
|
||||
#include "shortcuts_dialog.h"
|
||||
|
||||
|
||||
MainWindowViewer::MainWindowViewer()
|
||||
:QMainWindow(),fullscreen(false),toolbars(true),alwaysOnTop(false),currentDirectory("."),currentDirectoryImgDest(".")
|
||||
{
|
||||
loadConfiguration();
|
||||
setupUI();
|
||||
}
|
||||
|
||||
void MainWindowViewer::loadConfiguration()
|
||||
{
|
||||
Configuration & config = Configuration::getConfiguration();
|
||||
currentDirectory = config.getDefaultPath();
|
||||
fullscreen = config.getFullScreen();
|
||||
}
|
||||
|
||||
void MainWindowViewer::setupUI()
|
||||
{
|
||||
|
||||
setWindowIcon(QIcon(":/images/icon.png"));
|
||||
|
||||
viewer = new Viewer(this);
|
||||
connect(viewer,SIGNAL(reset()),this,SLOT(disableActions()));
|
||||
|
||||
setCentralWidget(viewer);
|
||||
int heightDesktopResolution = QApplication::desktop()->screenGeometry().height();
|
||||
int widthDesktopResolution = QApplication::desktop()->screenGeometry().width();
|
||||
int height,width;
|
||||
height = static_cast<int>(heightDesktopResolution*0.84);
|
||||
width = static_cast<int>(height*0.70);
|
||||
Configuration & conf = Configuration::getConfiguration();
|
||||
QPoint p = conf.getPos();
|
||||
QSize s = conf.getSize();
|
||||
if(s.width()!=0)
|
||||
{
|
||||
move(p);
|
||||
resize(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
move(QPoint((widthDesktopResolution-width)/2,((heightDesktopResolution-height)-40)/2));
|
||||
resize(QSize(width,height));
|
||||
}
|
||||
|
||||
had = new HelpAboutDialog(this); //TODO load data
|
||||
|
||||
had->loadAboutInformation(":/files/about.html");
|
||||
had->loadHelp(":/files/helpYACReader.html");
|
||||
|
||||
optionsDialog = new OptionsDialog(this);
|
||||
connect(optionsDialog,SIGNAL(accepted()),viewer,SLOT(updateOptions()));
|
||||
|
||||
shortcutsDialog = new ShortcutsDialog(this);
|
||||
|
||||
createActions();
|
||||
createToolBars();
|
||||
if(QCoreApplication::argc()>1)
|
||||
{
|
||||
//TODO: new method open(QString)
|
||||
QString pathFile = QCoreApplication::arguments().at(1);
|
||||
currentDirectory = pathFile;
|
||||
QFileInfo fi(pathFile);
|
||||
getSiblingComics(fi.absolutePath(),fi.fileName());
|
||||
viewer->open(pathFile);
|
||||
enableActions();
|
||||
}
|
||||
|
||||
versionChecker = new HttpVersionChecker();
|
||||
|
||||
connect(versionChecker,SIGNAL(newVersionDetected()),
|
||||
this,SLOT(newVersion()));
|
||||
|
||||
versionChecker->get();
|
||||
|
||||
viewer->setFocusPolicy(Qt::StrongFocus);
|
||||
|
||||
setWindowTitle("YACReader");
|
||||
|
||||
if(Configuration::getConfiguration().getAlwaysOnTop())
|
||||
{
|
||||
setWindowFlags(this->windowFlags() | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint);
|
||||
}
|
||||
|
||||
if(fullscreen)
|
||||
toFullScreen();
|
||||
if(conf.getMaximized())
|
||||
showMaximized();
|
||||
|
||||
setAcceptDrops(true);
|
||||
}
|
||||
|
||||
void MainWindowViewer::createActions()
|
||||
{
|
||||
openAction = new QAction(tr("&Open"),this);
|
||||
openAction->setShortcut(tr("O"));
|
||||
openAction->setIcon(QIcon(":/images/open.png"));
|
||||
openAction->setToolTip(tr("Open a comic"));
|
||||
connect(openAction, SIGNAL(triggered()), this, SLOT(open()));
|
||||
|
||||
openFolderAction = new QAction(tr("Open Folder"),this);
|
||||
openFolderAction->setShortcut(tr("Ctrl+O"));
|
||||
openFolderAction->setIcon(QIcon(":/images/openFolder.png"));
|
||||
openFolderAction->setToolTip(tr("Open image folder"));
|
||||
connect(openFolderAction, SIGNAL(triggered()), this, SLOT(openFolder()));
|
||||
|
||||
saveImageAction = new QAction(tr("Save"),this);
|
||||
saveImageAction->setIcon(QIcon(":/images/save.png"));
|
||||
saveImageAction->setToolTip(tr("Save current page"));
|
||||
saveImageAction->setDisabled(true);
|
||||
connect(saveImageAction,SIGNAL(triggered()),this,SLOT(saveImage()));
|
||||
|
||||
openPreviousComicAction = new QAction(tr("Previous Comic"),this);
|
||||
openPreviousComicAction->setIcon(QIcon(":/images/previousComic.png"));
|
||||
openPreviousComicAction->setShortcut(Qt::CTRL + Qt::Key_Left);
|
||||
openPreviousComicAction->setToolTip(tr("Open previous comic"));
|
||||
openPreviousComicAction->setDisabled(true);
|
||||
connect(openPreviousComicAction,SIGNAL(triggered()),this,SLOT(openPreviousComic()));
|
||||
|
||||
openNextComicAction = new QAction(tr("Next Comic"),this);
|
||||
openNextComicAction->setIcon(QIcon(":/images/nextComic.png"));
|
||||
openNextComicAction->setShortcut(Qt::CTRL + Qt::Key_Right);
|
||||
openNextComicAction->setToolTip(tr("Open next comic"));
|
||||
openNextComicAction->setDisabled(true);
|
||||
connect(openNextComicAction,SIGNAL(triggered()),this,SLOT(openNextComic()));
|
||||
|
||||
prevAction = new QAction(tr("&Previous"),this);
|
||||
prevAction->setIcon(QIcon(":/images/prev.png"));
|
||||
prevAction->setShortcut(Qt::Key_Left);
|
||||
prevAction->setToolTip(tr("Go to previous page"));
|
||||
prevAction->setDisabled(true);
|
||||
connect(prevAction, SIGNAL(triggered()),viewer,SLOT(prev()));
|
||||
|
||||
nextAction = new QAction(tr("&Next"),this);
|
||||
nextAction->setIcon(QIcon(":/images/next.png"));
|
||||
nextAction->setShortcut(Qt::Key_Right);
|
||||
nextAction->setToolTip(tr("Go to next page"));
|
||||
nextAction->setDisabled(true);
|
||||
connect(nextAction, SIGNAL(triggered()),viewer,SLOT(next()));
|
||||
|
||||
adjustWidth = new QAction(tr("Fit Width"),this);
|
||||
adjustWidth->setShortcut(tr("A"));
|
||||
adjustWidth->setIcon(QIcon(":/images/fit.png"));
|
||||
adjustWidth->setCheckable(true);
|
||||
adjustWidth->setDisabled(true);
|
||||
adjustWidth->setChecked(Configuration::getConfiguration().getAdjustToWidth());
|
||||
adjustWidth->setToolTip(tr("Fit image to ..."));
|
||||
//adjustWidth->setIcon(QIcon(":/images/fitWidth.png"));
|
||||
connect(adjustWidth, SIGNAL(triggered()),this,SLOT(changeFit()));
|
||||
|
||||
leftRotationAction = new QAction(tr("Rotate image to the left"),this);
|
||||
leftRotationAction->setShortcut(tr("L"));
|
||||
leftRotationAction->setIcon(QIcon(":/images/rotateL.png"));
|
||||
leftRotationAction->setDisabled(true);
|
||||
connect(leftRotationAction, SIGNAL(triggered()),viewer,SLOT(rotateLeft()));
|
||||
|
||||
rightRotationAction = new QAction(tr("Rotate image to the right"),this);
|
||||
rightRotationAction->setShortcut(tr("R"));
|
||||
rightRotationAction->setIcon(QIcon(":/images/rotateR.png"));
|
||||
rightRotationAction->setDisabled(true);
|
||||
connect(rightRotationAction, SIGNAL(triggered()),viewer,SLOT(rotateRight()));
|
||||
|
||||
doublePageAction = new QAction(tr("Double page mode"),this);
|
||||
doublePageAction->setToolTip(tr("Switch to double page mode"));
|
||||
doublePageAction->setShortcut(tr("D"));
|
||||
doublePageAction->setIcon(QIcon(":/images/doublePage.png"));
|
||||
doublePageAction->setDisabled(true);
|
||||
doublePageAction->setCheckable(true);
|
||||
doublePageAction->setChecked(Configuration::getConfiguration().getDoublePage());
|
||||
connect(doublePageAction, SIGNAL(triggered()),viewer,SLOT(doublePageSwitch()));
|
||||
|
||||
goToPage = new QAction(tr("Go To"),this);
|
||||
goToPage->setShortcut(tr("G"));
|
||||
goToPage->setIcon(QIcon(":/images/goto.png"));
|
||||
goToPage->setDisabled(true);
|
||||
goToPage->setToolTip(tr("Go to page ..."));
|
||||
connect(goToPage, SIGNAL(triggered()),viewer,SLOT(showGoToDialog()));
|
||||
|
||||
optionsAction = new QAction(tr("Options"),this);
|
||||
optionsAction->setShortcut(tr("C"));
|
||||
optionsAction->setToolTip(tr("YACReader options"));
|
||||
optionsAction->setIcon(QIcon(":/images/options.png"));
|
||||
|
||||
connect(optionsAction, SIGNAL(triggered()),optionsDialog,SLOT(show()));
|
||||
|
||||
helpAboutAction = new QAction(tr("Help"),this);
|
||||
helpAboutAction->setToolTip(tr("Help, About YACReader"));
|
||||
helpAboutAction->setShortcut(Qt::Key_F1);
|
||||
helpAboutAction->setIcon(QIcon(":/images/help.png"));
|
||||
connect(helpAboutAction, SIGNAL(triggered()),had,SLOT(show()));
|
||||
|
||||
showMagnifyingGlass = new QAction(tr("Magnifying glass"),this);
|
||||
showMagnifyingGlass->setToolTip(tr("Switch Magnifying glass"));
|
||||
showMagnifyingGlass->setShortcut(tr("Z"));
|
||||
showMagnifyingGlass->setIcon(QIcon(":/images/zoom.png"));
|
||||
showMagnifyingGlass->setDisabled(true);
|
||||
showMagnifyingGlass->setCheckable(true);
|
||||
connect(showMagnifyingGlass, SIGNAL(triggered()),viewer,SLOT(magnifyingGlassSwitch()));
|
||||
|
||||
setBookmark = new QAction(tr("Set bookmark"),this);
|
||||
setBookmark->setToolTip(tr("Set a bookmark on the current page"));
|
||||
setBookmark->setShortcut(Qt::CTRL+Qt::Key_M);
|
||||
setBookmark->setIcon(QIcon(":/images/setBookmark.png"));
|
||||
setBookmark->setDisabled(true);
|
||||
setBookmark->setCheckable(true);
|
||||
connect(setBookmark,SIGNAL(triggered (bool)),viewer,SLOT(setBookmark(bool)));
|
||||
connect(viewer,SIGNAL(pageAvailable(bool)),setBookmark,SLOT(setEnabled(bool)));
|
||||
connect(viewer,SIGNAL(pageIsBookmark(bool)),setBookmark,SLOT(setChecked(bool)));
|
||||
|
||||
showBookmarks = new QAction(tr("Show bookmarks"),this);
|
||||
showBookmarks->setToolTip(tr("Show the bookmarks of the current comic"));
|
||||
showBookmarks->setShortcut(tr("M"));
|
||||
showBookmarks->setIcon(QIcon(":/images/bookmark.png"));
|
||||
showBookmarks->setDisabled(true);
|
||||
connect(showBookmarks, SIGNAL(triggered()),viewer->getBookmarksDialog(),SLOT(show()));
|
||||
|
||||
showShorcutsAction = new QAction(tr("Show keyboard shortcuts"), this );
|
||||
showShorcutsAction->setIcon(QIcon(":/images/shortcuts.png"));
|
||||
connect(showShorcutsAction, SIGNAL(triggered()),shortcutsDialog,SLOT(show()));
|
||||
|
||||
showInfo = new QAction(tr("Show Info"),this);
|
||||
showInfo->setShortcut(tr("I"));
|
||||
showInfo->setIcon(QIcon(":/images/properties.png"));
|
||||
showInfo->setDisabled(true);
|
||||
connect(showInfo, SIGNAL(triggered()),viewer,SLOT(informationSwitch()));
|
||||
|
||||
closeAction = new QAction(tr("Close"),this);
|
||||
closeAction->setShortcut(Qt::Key_Escape);
|
||||
closeAction->setIcon(QIcon(":/images/deleteLibrary.png"));
|
||||
connect(closeAction,SIGNAL(triggered()),this,SLOT(close()));
|
||||
|
||||
showDictionaryAction = new QAction(tr("Show Dictionary"),this);
|
||||
showDictionaryAction->setShortcut(Qt::Key_T);
|
||||
showDictionaryAction->setIcon(QIcon(":/images/dictionary.png"));
|
||||
showDictionaryAction->setCheckable(true);
|
||||
showDictionaryAction->setDisabled(true);
|
||||
connect(showDictionaryAction,SIGNAL(triggered()),viewer,SLOT(translatorSwitch()));
|
||||
|
||||
alwaysOnTopAction = new QAction(tr("Always on top"),this);
|
||||
alwaysOnTopAction->setShortcut(Qt::Key_Q);
|
||||
alwaysOnTopAction->setIcon(QIcon(":/images/alwaysOnTop.png"));
|
||||
alwaysOnTopAction->setCheckable(true);
|
||||
alwaysOnTopAction->setDisabled(true);
|
||||
alwaysOnTopAction->setChecked(Configuration::getConfiguration().getAlwaysOnTop());
|
||||
connect(alwaysOnTopAction,SIGNAL(triggered()),this,SLOT(alwaysOnTopSwitch()));
|
||||
|
||||
adjustToFullSizeAction = new QAction(tr("Show full size"),this);
|
||||
adjustToFullSizeAction->setShortcut(Qt::Key_W);
|
||||
adjustToFullSizeAction->setIcon(QIcon(":/images/adjustToFullSize.png"));
|
||||
adjustToFullSizeAction->setCheckable(true);
|
||||
adjustToFullSizeAction->setDisabled(true);
|
||||
adjustToFullSizeAction->setChecked(Configuration::getConfiguration().getAdjustToFullSize());
|
||||
connect(adjustToFullSizeAction,SIGNAL(triggered()),this,SLOT(adjustToFullSizeSwitch()));
|
||||
}
|
||||
|
||||
void MainWindowViewer::createToolBars()
|
||||
{
|
||||
comicToolBar = addToolBar(tr("&File"));
|
||||
|
||||
QToolButton * tb = new QToolButton();
|
||||
tb->addAction(openAction);
|
||||
tb->addAction(openFolderAction);
|
||||
tb->setPopupMode(QToolButton::MenuButtonPopup);
|
||||
tb->setDefaultAction(openAction);
|
||||
|
||||
comicToolBar->addWidget(tb);
|
||||
comicToolBar->addAction(saveImageAction);
|
||||
comicToolBar->addAction(openPreviousComicAction);
|
||||
comicToolBar->addAction(openNextComicAction);
|
||||
|
||||
comicToolBar->addSeparator();
|
||||
comicToolBar->addAction(prevAction);
|
||||
comicToolBar->addAction(nextAction);
|
||||
comicToolBar->addAction(goToPage);
|
||||
|
||||
comicToolBar->addSeparator();
|
||||
comicToolBar->addAction(alwaysOnTopAction);
|
||||
|
||||
comicToolBar->addSeparator();
|
||||
comicToolBar->addAction(adjustWidth);
|
||||
comicToolBar->addAction(adjustToFullSizeAction);
|
||||
comicToolBar->addAction(leftRotationAction);
|
||||
comicToolBar->addAction(rightRotationAction);
|
||||
comicToolBar->addAction(doublePageAction);
|
||||
|
||||
comicToolBar->addSeparator();
|
||||
comicToolBar->addAction(showMagnifyingGlass);
|
||||
|
||||
comicToolBar->addSeparator();
|
||||
comicToolBar->addAction(setBookmark);
|
||||
comicToolBar->addAction(showBookmarks);
|
||||
|
||||
comicToolBar->addSeparator();
|
||||
comicToolBar->addAction(showDictionaryAction);
|
||||
|
||||
comicToolBar->addWidget(new QToolBarStretch());
|
||||
|
||||
comicToolBar->addAction(showShorcutsAction);
|
||||
comicToolBar->addAction(optionsAction);
|
||||
comicToolBar->addAction(helpAboutAction);
|
||||
comicToolBar->addAction(closeAction);
|
||||
|
||||
comicToolBar->setMovable(false);
|
||||
|
||||
|
||||
viewer->addAction(openAction);
|
||||
viewer->addAction(openFolderAction);
|
||||
viewer->addAction(saveImageAction);
|
||||
viewer->addAction(openPreviousComicAction);
|
||||
viewer->addAction(openNextComicAction);
|
||||
QAction * separator = new QAction("",this);
|
||||
separator->setSeparator(true);
|
||||
viewer->addAction(separator);
|
||||
viewer->addAction(prevAction);
|
||||
viewer->addAction(nextAction);
|
||||
viewer->addAction(goToPage);
|
||||
viewer->addAction(adjustWidth);
|
||||
viewer->addAction(adjustToFullSizeAction);
|
||||
viewer->addAction(leftRotationAction);
|
||||
viewer->addAction(rightRotationAction);
|
||||
viewer->addAction(doublePageAction);
|
||||
separator = new QAction("",this);
|
||||
separator->setSeparator(true);
|
||||
viewer->addAction(separator);
|
||||
|
||||
viewer->addAction(setBookmark);
|
||||
viewer->addAction(showBookmarks);
|
||||
separator = new QAction("",this);
|
||||
separator->setSeparator(true);
|
||||
viewer->addAction(separator);
|
||||
|
||||
viewer->addAction(showDictionaryAction);
|
||||
separator = new QAction("",this);
|
||||
separator->setSeparator(true);
|
||||
viewer->addAction(separator);
|
||||
|
||||
viewer->addAction(showMagnifyingGlass);
|
||||
viewer->addAction(optionsAction);
|
||||
viewer->addAction(helpAboutAction);
|
||||
viewer->addAction(showInfo);
|
||||
viewer->addAction(showShorcutsAction);
|
||||
separator = new QAction("",this);
|
||||
separator->setSeparator(true);
|
||||
viewer->addAction(separator);
|
||||
viewer->addAction(closeAction);
|
||||
|
||||
viewer->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
}
|
||||
|
||||
void MainWindowViewer::open()
|
||||
{
|
||||
QFileDialog openDialog;
|
||||
QString pathFile = openDialog.getOpenFileName(this,tr("Open Comic"),currentDirectory,tr("Comic files (*.cbr *.cbz *.rar *.zip *.tar *.arj)"));
|
||||
if (!pathFile.isEmpty())
|
||||
{
|
||||
openComicFromPath(pathFile);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindowViewer::openComicFromPath(QString pathFile)
|
||||
{
|
||||
currentDirectory = pathFile;
|
||||
QFileInfo fi(pathFile);
|
||||
getSiblingComics(fi.absolutePath(),fi.fileName());
|
||||
viewer->open(pathFile);
|
||||
enableActions();
|
||||
}
|
||||
|
||||
void MainWindowViewer::openFolder()
|
||||
{
|
||||
QFileDialog openDialog;
|
||||
QString pathDir = openDialog.getExistingDirectory(this,tr("Open folder"),currentDirectory);
|
||||
if (!pathDir.isEmpty())
|
||||
{
|
||||
openFolderFromPath(pathDir);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindowViewer::openFolderFromPath(QString pathDir)
|
||||
{
|
||||
currentDirectory = pathDir; //TODO ??
|
||||
QFileInfo fi(pathDir);
|
||||
getSiblingComics(fi.absolutePath(),fi.fileName());
|
||||
viewer->open(pathDir);
|
||||
enableActions();
|
||||
}
|
||||
|
||||
void MainWindowViewer::saveImage()
|
||||
{
|
||||
QFileDialog saveDialog;
|
||||
QString pathFile = saveDialog.getSaveFileName(this,tr("Save current page"),currentDirectoryImgDest,tr("Image files (*.jpg)"));
|
||||
if (!pathFile.isEmpty())
|
||||
{
|
||||
currentDirectoryImgDest = pathFile;
|
||||
const QPixmap * p = viewer->pixmap();
|
||||
if(p!=NULL)
|
||||
p->save(pathFile);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindowViewer::enableActions()
|
||||
{
|
||||
saveImageAction->setDisabled(false);
|
||||
prevAction->setDisabled(false);
|
||||
nextAction->setDisabled(false);
|
||||
adjustWidth->setDisabled(false);
|
||||
goToPage->setDisabled(false);
|
||||
alwaysOnTopAction->setDisabled(false);
|
||||
leftRotationAction->setDisabled(false);
|
||||
rightRotationAction->setDisabled(false);
|
||||
showMagnifyingGlass->setDisabled(false);
|
||||
doublePageAction->setDisabled(false);
|
||||
adjustToFullSizeAction->setDisabled(false);
|
||||
//setBookmark->setDisabled(false);
|
||||
showBookmarks->setDisabled(false);
|
||||
showInfo->setDisabled(false); //TODO enable goTo and showInfo (or update) when numPages emited
|
||||
showDictionaryAction->setDisabled(false);
|
||||
}
|
||||
void MainWindowViewer::disableActions()
|
||||
{
|
||||
saveImageAction->setDisabled(true);
|
||||
prevAction->setDisabled(true);
|
||||
nextAction->setDisabled(true);
|
||||
adjustWidth->setDisabled(true);
|
||||
goToPage->setDisabled(true);
|
||||
alwaysOnTopAction->setDisabled(true);
|
||||
leftRotationAction->setDisabled(true);
|
||||
rightRotationAction->setDisabled(true);
|
||||
showMagnifyingGlass->setDisabled(true);
|
||||
doublePageAction->setDisabled(true);
|
||||
adjustToFullSizeAction->setDisabled(true);
|
||||
setBookmark->setDisabled(true);
|
||||
showBookmarks->setDisabled(true);
|
||||
showInfo->setDisabled(true); //TODO enable goTo and showInfo (or update) when numPages emited
|
||||
openPreviousComicAction->setDisabled(true);
|
||||
openNextComicAction->setDisabled(true);
|
||||
showDictionaryAction->setDisabled(true);
|
||||
}
|
||||
|
||||
void MainWindowViewer::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
switch (event->key())
|
||||
{
|
||||
case Qt::Key_Escape:
|
||||
this->close();
|
||||
break;
|
||||
case Qt::Key_F:
|
||||
toggleFullScreen();
|
||||
break;
|
||||
case Qt::Key_H:
|
||||
toggleToolBars();
|
||||
break;
|
||||
case Qt::Key_O:
|
||||
open();
|
||||
break;
|
||||
default:
|
||||
QWidget::keyPressEvent(event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindowViewer::mouseDoubleClickEvent ( QMouseEvent * event )
|
||||
{
|
||||
toggleFullScreen();
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void MainWindowViewer::toggleFullScreen()
|
||||
{
|
||||
fullscreen?toNormal():toFullScreen();
|
||||
Configuration::getConfiguration().setFullScreen(fullscreen = !fullscreen);
|
||||
}
|
||||
|
||||
void MainWindowViewer::toFullScreen()
|
||||
{
|
||||
hideToolBars();
|
||||
viewer->hide();
|
||||
viewer->fullscreen = true;//TODO, change by the right use of windowState();
|
||||
showFullScreen();
|
||||
viewer->show();
|
||||
if(viewer->magnifyingGlassIsVisible())
|
||||
viewer->showMagnifyingGlass();
|
||||
}
|
||||
|
||||
void MainWindowViewer::toNormal()
|
||||
{
|
||||
//show all
|
||||
viewer->hide();
|
||||
viewer->fullscreen = false;//TODO, change by the right use of windowState();
|
||||
//viewer->hideMagnifyingGlass();
|
||||
showNormal();
|
||||
showToolBars();
|
||||
viewer->show();
|
||||
if(viewer->magnifyingGlassIsVisible())
|
||||
viewer->showMagnifyingGlass();
|
||||
}
|
||||
void MainWindowViewer::toggleToolBars()
|
||||
{
|
||||
toolbars?hideToolBars():showToolBars();
|
||||
}
|
||||
void MainWindowViewer::hideToolBars()
|
||||
{
|
||||
//hide all
|
||||
this->comicToolBar->hide();
|
||||
toolbars = false;
|
||||
}
|
||||
|
||||
void MainWindowViewer::showToolBars()
|
||||
{
|
||||
this->comicToolBar->show();
|
||||
toolbars = true;
|
||||
}
|
||||
|
||||
void MainWindowViewer::changeFit()
|
||||
{
|
||||
Configuration & conf = Configuration::getConfiguration();
|
||||
conf.setAdjustToWidth(!conf.getAdjustToWidth());
|
||||
viewer->updatePage();
|
||||
}
|
||||
|
||||
void MainWindowViewer::newVersion()
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(tr("There is a new version avaliable"));
|
||||
msgBox.setInformativeText(tr("Do you want to download the new version?"));
|
||||
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||
msgBox.setDefaultButton(QMessageBox::Yes);
|
||||
int ret = msgBox.exec();
|
||||
|
||||
if(ret==QMessageBox::Yes){
|
||||
QDesktopServices::openUrl(QUrl("http://code.google.com/p/yacreader/"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void MainWindowViewer::closeEvent ( QCloseEvent * event )
|
||||
{
|
||||
viewer->save();
|
||||
Configuration & conf = Configuration::getConfiguration();
|
||||
if(!fullscreen && !isMaximized())
|
||||
{
|
||||
conf.setPos(pos());
|
||||
conf.setSize(size());
|
||||
}
|
||||
conf.setMaximized(isMaximized());
|
||||
}
|
||||
|
||||
void MainWindowViewer::openPreviousComic()
|
||||
{
|
||||
if(!previousComicPath.isEmpty())
|
||||
{
|
||||
viewer->open(previousComicPath);
|
||||
QFileInfo fi(previousComicPath);
|
||||
getSiblingComics(fi.absolutePath(),fi.fileName());
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindowViewer::openNextComic()
|
||||
{
|
||||
if(!nextComicPath.isEmpty())
|
||||
{
|
||||
viewer->open(nextComicPath);
|
||||
QFileInfo fi(nextComicPath);
|
||||
getSiblingComics(fi.absolutePath(),fi.fileName());
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindowViewer::getSiblingComics(QString path,QString currentComic)
|
||||
{
|
||||
QDir d(path);
|
||||
d.setFilter(QDir::Files|QDir::NoDotAndDotDot);
|
||||
d.setNameFilters(QStringList() << "*.cbr" << "*.cbz" << "*.rar" << "*.zip" << "*.tar");
|
||||
d.setSorting(QDir::Name|QDir::IgnoreCase|QDir::LocaleAware);
|
||||
QStringList list = d.entryList();
|
||||
int index = list.indexOf(currentComic);
|
||||
if(index == -1) //comic not found
|
||||
{
|
||||
QFile f(QCoreApplication::applicationDirPath()+"/errorLog.txt");
|
||||
if(!f.open(QIODevice::WriteOnly))
|
||||
{
|
||||
QMessageBox::critical(NULL,tr("Saving error log file...."),tr("There was a problem saving YACReader error log file. Please, check if you have enough permissions in the YACReader root folder."));
|
||||
}
|
||||
else
|
||||
{
|
||||
QTextStream txtS(&f);
|
||||
txtS << "METHOD : MainWindowViewer::getSiblingComics" << '\n';
|
||||
txtS << "ERROR : current comic not found in its own path" << '\n';
|
||||
txtS << path << '\n';
|
||||
txtS << currentComic << '\n';
|
||||
txtS << "Comic list count : " + list.count() << '\n';
|
||||
foreach(QString s, list){
|
||||
txtS << s << '\n';
|
||||
}
|
||||
f.close();
|
||||
}
|
||||
}
|
||||
|
||||
previousComicPath = nextComicPath = "";
|
||||
if(index>0)
|
||||
{
|
||||
previousComicPath = path+"/"+list.at(index-1);
|
||||
openPreviousComicAction->setDisabled(false);
|
||||
}
|
||||
else
|
||||
openPreviousComicAction->setDisabled(true);
|
||||
|
||||
if(index+1<list.count())
|
||||
{
|
||||
nextComicPath = path+"/"+list.at(index+1);
|
||||
openNextComicAction->setDisabled(false);
|
||||
}
|
||||
else
|
||||
openNextComicAction->setDisabled(true);
|
||||
}
|
||||
|
||||
void MainWindowViewer::dropEvent(QDropEvent *event)
|
||||
{
|
||||
QList<QUrl> urlList;
|
||||
QString fName;
|
||||
QFileInfo info;
|
||||
|
||||
if (event->mimeData()->hasUrls())
|
||||
{
|
||||
urlList = event->mimeData()->urls();
|
||||
|
||||
if ( urlList.size() > 0)
|
||||
{
|
||||
fName = urlList[0].toLocalFile(); // convert first QUrl to local path
|
||||
info.setFile( fName ); // information about file
|
||||
if (info.isFile())
|
||||
openComicFromPath(fName); // if is file, setText
|
||||
else
|
||||
if(info.isDir())
|
||||
openFolderFromPath(fName);
|
||||
}
|
||||
}
|
||||
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
void MainWindowViewer::dragEnterEvent(QDragEnterEvent *event)
|
||||
{
|
||||
// accept just text/uri-list mime format
|
||||
if (event->mimeData()->hasFormat("text/uri-list"))
|
||||
{
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindowViewer::alwaysOnTopSwitch()
|
||||
{
|
||||
if(!Configuration::getConfiguration().getAlwaysOnTop())
|
||||
{
|
||||
setWindowFlags(this->windowFlags() | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint); //always on top
|
||||
show();
|
||||
}
|
||||
else
|
||||
{
|
||||
setWindowFlags(this->windowFlags() ^ (Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint));
|
||||
show();
|
||||
}
|
||||
Configuration::getConfiguration().setAlwaysOnTop(!Configuration::getConfiguration().getAlwaysOnTop());
|
||||
}
|
||||
|
||||
void MainWindowViewer::adjustToFullSizeSwitch()
|
||||
{
|
||||
Configuration::getConfiguration().setAdjustToFullSize(!Configuration::getConfiguration().getAdjustToFullSize());
|
||||
viewer->updatePage();
|
||||
}
|
115
YACReader/main_window_viewer.h
Normal file
@ -0,0 +1,115 @@
|
||||
#ifndef __MAIN_WINDOW_VIEWER_H
|
||||
#define __MAIN_WINDOW_VIEWER_H
|
||||
#include <QMainWindow>
|
||||
#include <QScrollArea>
|
||||
#include <QToolBar>
|
||||
#include <QAction>
|
||||
#include <QKeyEvent>
|
||||
#include <QMouseEvent>
|
||||
#include <QCloseEvent>
|
||||
|
||||
class Comic;
|
||||
class Viewer;
|
||||
class OptionsDialog;
|
||||
class HelpAboutDialog;
|
||||
class HttpVersionChecker;
|
||||
class ShortcutsDialog;
|
||||
|
||||
|
||||
class MainWindowViewer : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public slots:
|
||||
void open();
|
||||
void openFolder();
|
||||
void saveImage();
|
||||
void toggleToolBars();
|
||||
void hideToolBars();
|
||||
void showToolBars();
|
||||
void changeFit();
|
||||
void enableActions();
|
||||
void disableActions();
|
||||
void toggleFullScreen();
|
||||
void toFullScreen();
|
||||
void toNormal();
|
||||
void loadConfiguration();
|
||||
void newVersion();
|
||||
void openPreviousComic();
|
||||
void openNextComic();
|
||||
void openComicFromPath(QString pathFile);
|
||||
void openFolderFromPath(QString pathDir);
|
||||
void alwaysOnTopSwitch();
|
||||
void adjustToFullSizeSwitch();
|
||||
/*void viewComic();
|
||||
void prev();
|
||||
void next();
|
||||
void updatePage();*/
|
||||
|
||||
private:
|
||||
//!State
|
||||
bool fullscreen;
|
||||
bool toolbars;
|
||||
bool alwaysOnTop;
|
||||
|
||||
QString currentDirectory;
|
||||
QString currentDirectoryImgDest;
|
||||
//!Widgets
|
||||
Viewer * viewer;
|
||||
//GoToDialog * goToDialog;
|
||||
OptionsDialog * optionsDialog;
|
||||
HelpAboutDialog * had;
|
||||
ShortcutsDialog * shortcutsDialog;
|
||||
|
||||
//! ToolBars
|
||||
QToolBar *comicToolBar;
|
||||
|
||||
//! Actions
|
||||
QAction *openAction;
|
||||
QAction *openFolderAction;
|
||||
QAction *saveImageAction;
|
||||
QAction *openPreviousComicAction;
|
||||
QAction *openNextComicAction;
|
||||
QAction *nextAction;
|
||||
QAction *prevAction;
|
||||
QAction *adjustWidth;
|
||||
QAction *adjustHeight;
|
||||
QAction *goToPage;
|
||||
QAction *optionsAction;
|
||||
QAction *helpAboutAction;
|
||||
QAction *showMagnifyingGlass;
|
||||
QAction *setBookmark;
|
||||
QAction *showBookmarks;
|
||||
QAction *leftRotationAction;
|
||||
QAction *rightRotationAction;
|
||||
QAction *showInfo;
|
||||
QAction *closeAction;
|
||||
QAction *doublePageAction;
|
||||
QAction *showShorcutsAction;
|
||||
QAction *showDictionaryAction;
|
||||
QAction *alwaysOnTopAction;
|
||||
QAction *adjustToFullSizeAction;
|
||||
|
||||
HttpVersionChecker * versionChecker;
|
||||
QString previousComicPath;
|
||||
QString nextComicPath;
|
||||
//! M<>todo que inicializa el interfaz.
|
||||
void setupUI();
|
||||
void createActions();
|
||||
void createToolBars();
|
||||
void getSiblingComics(QString path,QString currentComic);
|
||||
|
||||
//! Manejadores de evento:
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
//void resizeEvent(QResizeEvent * event);
|
||||
void mouseDoubleClickEvent ( QMouseEvent * event );
|
||||
void dropEvent(QDropEvent *event);
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
|
||||
protected:
|
||||
virtual void closeEvent ( QCloseEvent * event );
|
||||
public:
|
||||
MainWindowViewer();
|
||||
|
||||
};
|
||||
#endif
|
188
YACReader/options_dialog.cpp
Normal file
@ -0,0 +1,188 @@
|
||||
#include "options_dialog.h"
|
||||
#include "configuration.h"
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QFileDialog>
|
||||
#include <QGroupBox>
|
||||
#include <QRadioButton>
|
||||
|
||||
|
||||
OptionsDialog::OptionsDialog(QWidget * parent)
|
||||
:QDialog(parent)
|
||||
{
|
||||
QVBoxLayout * layout = new QVBoxLayout(this);
|
||||
|
||||
QGroupBox *slideSizeBox = new QGroupBox(tr("\"Go to flow\" size"));
|
||||
//slideSizeLabel = new QLabel(,this);
|
||||
slideSize = new QSlider(this);
|
||||
slideSize->setMinimum(125);
|
||||
slideSize->setMaximum(350);
|
||||
slideSize->setPageStep(5);
|
||||
slideSize->setOrientation(Qt::Horizontal);
|
||||
QHBoxLayout * slideLayout = new QHBoxLayout();
|
||||
slideLayout->addWidget(slideSize);
|
||||
slideSizeBox->setLayout(slideLayout);
|
||||
|
||||
QGroupBox *pathBox = new QGroupBox(tr("My comics path"));
|
||||
|
||||
QHBoxLayout * path = new QHBoxLayout();
|
||||
path->addWidget(pathEdit = new QLineEdit());
|
||||
path->addWidget(pathFindButton = new QPushButton(QIcon(":/images/comicFolder.png"),""));
|
||||
pathBox->setLayout(path);
|
||||
|
||||
connect(pathFindButton,SIGNAL(clicked()),this,SLOT(findFolder()));
|
||||
|
||||
accept = new QPushButton(tr("Save"));
|
||||
cancel = new QPushButton(tr("Cancel"));
|
||||
connect(accept,SIGNAL(clicked()),this,SLOT(saveOptions()));
|
||||
connect(cancel,SIGNAL(clicked()),this,SLOT(restoreOptions()));
|
||||
connect(cancel,SIGNAL(clicked()),this,SLOT(close()));
|
||||
|
||||
QGroupBox *groupBox = new QGroupBox(tr("How to show pages in GoToFlow:"));
|
||||
|
||||
radio1 = new QRadioButton(tr("CoverFlow look"));
|
||||
radio2 = new QRadioButton(tr("Stripe look"));
|
||||
radio3 = new QRadioButton(tr("Overlapped Stripe look"));
|
||||
|
||||
|
||||
QVBoxLayout *vbox = new QVBoxLayout;
|
||||
QHBoxLayout * opt1 = new QHBoxLayout;
|
||||
opt1->addWidget(radio1);
|
||||
QLabel * lOpt1 = new QLabel();
|
||||
lOpt1->setPixmap(QPixmap(":/images/flow1.png"));
|
||||
opt1->addStretch();
|
||||
opt1->addWidget(lOpt1);
|
||||
vbox->addLayout(opt1);
|
||||
|
||||
QHBoxLayout * opt2 = new QHBoxLayout;
|
||||
opt2->addWidget(radio2);
|
||||
QLabel * lOpt2 = new QLabel();
|
||||
lOpt2->setPixmap(QPixmap(":/images/flow2.png"));
|
||||
opt2->addStretch();
|
||||
opt2->addWidget(lOpt2);
|
||||
vbox->addLayout(opt2);
|
||||
|
||||
QHBoxLayout * opt3 = new QHBoxLayout;
|
||||
opt3->addWidget(radio3);
|
||||
QLabel * lOpt3 = new QLabel();
|
||||
lOpt3->setPixmap(QPixmap(":/images/flow3.png"));
|
||||
opt3->addStretch();
|
||||
opt3->addWidget(lOpt3);
|
||||
vbox->addLayout(opt3);
|
||||
|
||||
|
||||
//vbox->addStretch(1);
|
||||
groupBox->setLayout(vbox);
|
||||
|
||||
//fitToWidthRatioLabel = new QLabel(tr("Page width stretch"),this);
|
||||
QGroupBox *fitBox = new QGroupBox(tr("Page width stretch"));
|
||||
fitToWidthRatioS = new QSlider(this);
|
||||
fitToWidthRatioS->setMinimum(50);
|
||||
fitToWidthRatioS->setMaximum(100);
|
||||
fitToWidthRatioS->setPageStep(5);
|
||||
fitToWidthRatioS->setOrientation(Qt::Horizontal);
|
||||
QHBoxLayout * fitLayout = new QHBoxLayout;
|
||||
fitLayout->addWidget(fitToWidthRatioS);
|
||||
fitBox->setLayout(fitLayout);
|
||||
|
||||
QHBoxLayout * colorSelection = new QHBoxLayout;
|
||||
backgroundColor = new QLabel();
|
||||
QPalette pal = backgroundColor->palette();
|
||||
pal.setColor(backgroundColor->backgroundRole(), Qt::black);
|
||||
backgroundColor->setPalette(pal);
|
||||
backgroundColor->setAutoFillBackground(true);
|
||||
|
||||
colorDialog = new QColorDialog(Qt::red,this);
|
||||
connect(colorDialog,SIGNAL(colorSelected(QColor)),this,SLOT(updateColor(QColor)));
|
||||
|
||||
QGroupBox *colorBox = new QGroupBox(tr("Background color"));
|
||||
//backgroundColor->setMinimumWidth(100);
|
||||
colorSelection->addWidget(backgroundColor);
|
||||
colorSelection->addWidget(selectBackgroundColorButton = new QPushButton(tr("Choose")));
|
||||
//colorSelection->addStretch();
|
||||
connect(selectBackgroundColorButton, SIGNAL(clicked()), colorDialog, SLOT(show()));
|
||||
colorBox->setLayout(colorSelection);
|
||||
|
||||
QHBoxLayout * buttons = new QHBoxLayout();
|
||||
buttons->addStretch();
|
||||
buttons->addWidget(new QLabel(tr("Restart is needed")));
|
||||
buttons->addWidget(accept);
|
||||
buttons->addWidget(cancel);
|
||||
|
||||
layout->addWidget(pathBox);
|
||||
//layout->addLayout(path);
|
||||
layout->addWidget(slideSizeBox);
|
||||
//layout->addWidget(slideSize);
|
||||
layout->addWidget(groupBox);
|
||||
//layout->addWidget(fitToWidthRatioLabel);
|
||||
layout->addWidget(fitBox);
|
||||
layout->addWidget(colorBox);
|
||||
//layout->addLayout(colorSelection);
|
||||
layout->addLayout(buttons);
|
||||
|
||||
|
||||
setLayout(layout);
|
||||
|
||||
restoreOptions(); //load options
|
||||
resize(400,0);
|
||||
setModal (true);
|
||||
setWindowTitle("Options");
|
||||
}
|
||||
|
||||
void OptionsDialog::findFolder()
|
||||
{
|
||||
QString s = QFileDialog::getExistingDirectory(0,tr("Comics directory"),".");
|
||||
if(!s.isEmpty())
|
||||
{
|
||||
pathEdit->setText(s);
|
||||
}
|
||||
}
|
||||
|
||||
void OptionsDialog::saveOptions()
|
||||
{
|
||||
Configuration & conf = Configuration::getConfiguration();
|
||||
conf.setDefaultPath(pathEdit->text());
|
||||
conf.setGotoSlideSize(QSize(static_cast<int>(slideSize->sliderPosition()*SLIDE_ASPECT_RATIO),slideSize->sliderPosition()));
|
||||
if(radio1->isChecked())
|
||||
conf.setFlowType(PictureFlow::CoverFlowLike);
|
||||
if(radio2->isChecked())
|
||||
conf.setFlowType(PictureFlow::Strip);
|
||||
if(radio3->isChecked())
|
||||
conf.setFlowType(PictureFlow::StripOverlapped);
|
||||
conf.setFitToWidthRatio(fitToWidthRatioS->sliderPosition()/100.0);
|
||||
conf.setBackgroundColor(colorDialog->currentColor());
|
||||
conf.save();
|
||||
close();
|
||||
emit(accepted());
|
||||
}
|
||||
|
||||
void OptionsDialog::restoreOptions()
|
||||
{
|
||||
Configuration & conf = Configuration::getConfiguration();
|
||||
|
||||
slideSize->setSliderPosition(conf.getGotoSlideSize().height());
|
||||
fitToWidthRatioS->setSliderPosition(conf.getFitToWidthRatio()*100);
|
||||
pathEdit->setText(conf.getDefaultPath());
|
||||
updateColor(Configuration::getConfiguration().getBackgroundColor());
|
||||
switch(conf.getFlowType()){
|
||||
case PictureFlow::CoverFlowLike:
|
||||
radio1->setChecked(true);
|
||||
break;
|
||||
case PictureFlow::Strip:
|
||||
radio2->setChecked(true);
|
||||
break;
|
||||
case PictureFlow::StripOverlapped:
|
||||
radio3->setChecked(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void OptionsDialog::updateColor(const QColor & color)
|
||||
{
|
||||
QPalette pal = backgroundColor->palette();
|
||||
pal.setColor(backgroundColor->backgroundRole(), color);
|
||||
backgroundColor->setPalette(pal);
|
||||
backgroundColor->setAutoFillBackground(true);
|
||||
colorDialog->setCurrentColor(color);
|
||||
}
|
57
YACReader/options_dialog.h
Normal file
@ -0,0 +1,57 @@
|
||||
#ifndef __OPTIONS_DIALOG_H
|
||||
#define __OPTIONS_DIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QSlider>
|
||||
#include <QPushButton>
|
||||
#include <QRadioButton>
|
||||
#include <QColorDialog>
|
||||
|
||||
class OptionsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
OptionsDialog(QWidget * parent = 0);
|
||||
private:
|
||||
//QLabel * pathLabel;
|
||||
QLineEdit * pathEdit;
|
||||
QPushButton * pathFindButton;
|
||||
|
||||
QLabel * magGlassSizeLabel;
|
||||
|
||||
QLabel * zoomLevel;
|
||||
|
||||
//QLabel * slideSizeLabel;
|
||||
QSlider * slideSize;
|
||||
|
||||
QPushButton * accept;
|
||||
QPushButton * cancel;
|
||||
|
||||
QRadioButton *radio1;
|
||||
QRadioButton *radio2;
|
||||
QRadioButton *radio3;
|
||||
|
||||
//QLabel * fitToWidthRatioLabel;
|
||||
QSlider * fitToWidthRatioS;
|
||||
|
||||
QLabel * backgroundColor;
|
||||
QPushButton * selectBackgroundColorButton;
|
||||
|
||||
QColorDialog * colorDialog;
|
||||
|
||||
public slots:
|
||||
void saveOptions();
|
||||
void restoreOptions();
|
||||
void findFolder();
|
||||
void updateColor(const QColor & color);
|
||||
|
||||
signals:
|
||||
void changedOptions();
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
746
YACReader/render.cpp
Normal file
@ -0,0 +1,746 @@
|
||||
#include "render.h"
|
||||
#include <cmath>
|
||||
#include <QList>
|
||||
#include <algorithm>
|
||||
#include <QByteArray>
|
||||
#include <QPixmap>
|
||||
|
||||
#define NL 2
|
||||
#define NR 2
|
||||
|
||||
QMutex mutex;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// MeanNoiseReductionFilter
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
MeanNoiseReductionFilter::MeanNoiseReductionFilter(enum NeighborghoodSize ns)
|
||||
:neighborghoodSize(ns)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QImage MeanNoiseReductionFilter::setFilter(const QImage & image)
|
||||
{
|
||||
int width = image.width();
|
||||
int height = image.height();
|
||||
QImage result(width,height,image.format());
|
||||
int filterSize = sqrt((float)neighborghoodSize);
|
||||
int bound = filterSize/2;
|
||||
QRgb pix;
|
||||
int r,g,b;
|
||||
for(int j=bound;j<height-bound;j++){
|
||||
for(int i=bound;i<width-bound;i++){
|
||||
r=g=b=0;
|
||||
for(int y=j-bound;y<=j+bound;y++)
|
||||
{
|
||||
for(int x=i-bound;x<=i+bound;x++)
|
||||
{
|
||||
pix = image.pixel(x,y);
|
||||
r += qRed(pix);
|
||||
g += qGreen(pix);
|
||||
b += qBlue(pix);
|
||||
}
|
||||
}
|
||||
result.setPixel(i,j,QColor(r/neighborghoodSize,g/neighborghoodSize,b/neighborghoodSize).rgb());
|
||||
//qDebug((QString::number(redChannel.at(4))+" "+QString::number(greenChannel.at(4))+" "+QString::number(blueChannel.at(4))).toAscii());
|
||||
//qDebug((QString::number(redChannel.size())+" "+QString::number(greenChannel.size())+" "+QString::number(blueChannel.size())).toAscii());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// MedianNoiseReductionFilter
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
MedianNoiseReductionFilter::MedianNoiseReductionFilter(enum NeighborghoodSize ns)
|
||||
:neighborghoodSize(ns)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QImage MedianNoiseReductionFilter::setFilter(const QImage & image)
|
||||
{
|
||||
int width = image.width();
|
||||
int height = image.height();
|
||||
QImage result(width,height,image.format());
|
||||
int filterSize = sqrt((float)neighborghoodSize);
|
||||
int bound = filterSize/2;
|
||||
QRgb pix;
|
||||
QList<int> redChannel;
|
||||
QList<int> greenChannel;
|
||||
QList<int> blueChannel;
|
||||
for(int j=bound;j<height-bound;j++){
|
||||
for(int i=bound;i<width-bound;i++){
|
||||
redChannel.clear();
|
||||
greenChannel.clear();
|
||||
blueChannel.clear();
|
||||
for(int y=j-bound;y<=j+bound;y++)
|
||||
{
|
||||
for(int x=i-bound;x<=i+bound;x++)
|
||||
{
|
||||
pix = image.pixel(x,y);
|
||||
redChannel.push_back(qRed(pix));
|
||||
greenChannel.push_back(qGreen(pix));
|
||||
blueChannel.push_back(qBlue(pix));
|
||||
}
|
||||
}
|
||||
|
||||
std::sort(redChannel.begin(),redChannel.end());
|
||||
std::sort(greenChannel.begin(),greenChannel.end());
|
||||
std::sort(blueChannel.begin(),blueChannel.end());
|
||||
result.setPixel(i,j,QColor(redChannel.at(4),greenChannel.at(4),blueChannel.at(4)).rgb());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// BrightnessFilter
|
||||
//-----------------------------------------------------------------------------
|
||||
BrightnessFilter::BrightnessFilter(int l)
|
||||
:level(l)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QImage BrightnessFilter::setFilter(const QImage & image)
|
||||
{
|
||||
int width = image.width();
|
||||
int height = image.height();
|
||||
QImage result(width,height,image.format());
|
||||
|
||||
for(int j=0;j<height;j++){
|
||||
for(int i=0;i<width;i++){
|
||||
result.setPixel(i,j,QColor(image.pixel(i,j)).light(level).rgb());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// ContrastFilter
|
||||
//-----------------------------------------------------------------------------
|
||||
ContrastFilter::ContrastFilter()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QImage ContrastFilter::setFilter(const QImage & image)
|
||||
{
|
||||
int width = image.width();
|
||||
int height = image.height();
|
||||
QImage result(width,height,image.format());
|
||||
|
||||
int min,max,v;
|
||||
min = 0;
|
||||
max = 255;
|
||||
int sum = 0;
|
||||
|
||||
QVector<int> hist(256,0);
|
||||
|
||||
for(int j=0;j<height;j++){
|
||||
for(int i=0;i<width;i++){
|
||||
hist[QColor(image.pixel(i,j)).lightness()]++;
|
||||
sum++;
|
||||
}
|
||||
}
|
||||
|
||||
long double count = sum;
|
||||
long double new_count = 0.0;
|
||||
long double percentage,next_percentage;
|
||||
|
||||
for (int i = 0; i < 254; i++)
|
||||
{
|
||||
new_count += hist[i];
|
||||
percentage = new_count/count;
|
||||
next_percentage = (new_count+hist[i+1])/count;
|
||||
if(fabs (percentage - 0.006) < fabs (next_percentage - 0.006))
|
||||
{
|
||||
min = i+1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
new_count=0.0;
|
||||
for (int i = 255; i > 1; i--)
|
||||
{
|
||||
new_count += hist[i];
|
||||
percentage = new_count/count;
|
||||
next_percentage = (new_count+hist[i-1])/count;
|
||||
if(fabs (percentage - 0.006) < fabs (next_percentage - 0.006))
|
||||
{
|
||||
max = i-1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
QColor c;
|
||||
int range = max - min;
|
||||
for(int j=0;j<height;j++){
|
||||
for(int i=0;i<width;i++){
|
||||
c = QColor(image.pixel(i,j));
|
||||
result.setPixel(i,j,c.light(((c.lightness()-min)/range*1.0)*255).rgb());
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// PageRender
|
||||
//-----------------------------------------------------------------------------
|
||||
PageRender::PageRender()
|
||||
:QThread()
|
||||
{
|
||||
|
||||
}
|
||||
PageRender::PageRender(int np, const QByteArray & rd, QImage * p,unsigned int d, QVector<ImageFilter *> f)
|
||||
:QThread(),
|
||||
numPage(np),
|
||||
data(rd),
|
||||
page(p),
|
||||
degrees(d),
|
||||
filters(f)
|
||||
{
|
||||
}
|
||||
|
||||
void PageRender::run()
|
||||
{
|
||||
//QMutexLocker locker(&mutex);
|
||||
|
||||
QImage img;
|
||||
img.loadFromData(data);
|
||||
if(degrees > 0)
|
||||
{
|
||||
QMatrix m;
|
||||
m.rotate(degrees);
|
||||
img = img.transformed(m,Qt::SmoothTransformation);
|
||||
}
|
||||
for(int i=0;i<filters.size();i++)
|
||||
{
|
||||
img = filters[i]->setFilter(img);
|
||||
}
|
||||
|
||||
|
||||
*page = img;
|
||||
|
||||
emit pageReady(numPage);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// DoublePageRender
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DoublePageRender::DoublePageRender(int np, const QByteArray & rd, const QByteArray & rd2, QImage * p,unsigned int d, QVector<ImageFilter *> f)
|
||||
:PageRender(),
|
||||
numPage(np),
|
||||
data(rd),
|
||||
data2(rd2),
|
||||
page(p),
|
||||
degrees(d),
|
||||
filters(f)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DoublePageRender::run()
|
||||
{
|
||||
//QImage result;
|
||||
//QMutexLocker locker(&mutex);
|
||||
QImage img, img2;
|
||||
if(!data.isEmpty())
|
||||
img.loadFromData(data);
|
||||
if(!data2.isEmpty())
|
||||
img2.loadFromData(data2);
|
||||
/*if(img.isNull())
|
||||
img = QPixmap(img2.width(),img2.height());
|
||||
if(img2.isNull())
|
||||
img2 = QPixmap(img.width(),img.height());*/
|
||||
|
||||
int x,y;
|
||||
x = img.width()+img2.width();
|
||||
y = qMax(img.height(),img2.height());
|
||||
|
||||
|
||||
QImage auxImg(x,y,QImage::Format_RGB32);
|
||||
QPainter painter(&auxImg);
|
||||
painter.drawImage(0,0,img);
|
||||
painter.drawImage(img.width(),0,img2);
|
||||
painter.end();
|
||||
|
||||
if(degrees > 0)
|
||||
{
|
||||
QMatrix m;
|
||||
m.rotate(degrees);
|
||||
auxImg = auxImg.transformed(m,Qt::SmoothTransformation);
|
||||
}
|
||||
for(int i=0;i<filters.size();i++)
|
||||
{
|
||||
auxImg = filters[i]->setFilter(auxImg);
|
||||
}
|
||||
|
||||
*page = auxImg;
|
||||
|
||||
emit pageReady(numPage);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Render
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
Render::Render()
|
||||
:currentIndex(0),doublePage(false),comic(0),loadedComic(false),imageRotation(0),numLeftPages(NL),numRightPages(NR)
|
||||
{
|
||||
int size = numLeftPages+numRightPages+1;
|
||||
currentPageBufferedIndex = numLeftPages;
|
||||
for(int i = 0; i<size; i++)
|
||||
{
|
||||
buffer.push_back(new QImage());
|
||||
pageRenders.push_back(0);
|
||||
}
|
||||
|
||||
//filters.push_back(new ContrastFilter());
|
||||
}
|
||||
|
||||
//Este m<>todo se encarga de forzar el renderizado de las p<>ginas.
|
||||
//Actualiza el buffer seg<65>n es necesario.
|
||||
//si la pagina actual no est<73> renderizada, se lanza un hilo que la renderize (double or single page mode) y se emite una se<73>al que indica que se est<73> renderizando.
|
||||
void Render::render()
|
||||
{
|
||||
updateBuffer();
|
||||
if(buffer[currentPageBufferedIndex]->isNull())
|
||||
{
|
||||
if(pagesReady.size()>0)
|
||||
{
|
||||
if(doublePage)
|
||||
{
|
||||
if(pagesReady[currentIndex] && pagesReady[qMin(currentIndex+1,(int)comic->numPages()-1)])
|
||||
if(currentIndex+1 > comic->numPages()-1)
|
||||
pageRenders[currentPageBufferedIndex] = new DoublePageRender(currentIndex,comic->getRawData()->at(currentIndex),QByteArray(),buffer[currentPageBufferedIndex],imageRotation,filters);
|
||||
else
|
||||
pageRenders[currentPageBufferedIndex] = new DoublePageRender(currentIndex,comic->getRawData()->at(currentIndex),comic->getRawData()->at(currentIndex+1),buffer[currentPageBufferedIndex],imageRotation,filters);
|
||||
else
|
||||
//las p<>ginas no est<73>n listas, y se est<73>n cargando en el c<>mic
|
||||
emit processingPage(); //para evitar confusiones esta se<73>al deber<65>a llamarse de otra forma
|
||||
}
|
||||
else
|
||||
if(pagesReady[currentIndex])
|
||||
pageRenders[currentPageBufferedIndex] = new PageRender(currentIndex,comic->getRawData()->at(currentIndex),buffer[currentPageBufferedIndex],imageRotation,filters);
|
||||
else
|
||||
//las p<>ginas no est<73>n listas, y se est<73>n cargando en el c<>mic
|
||||
emit processingPage(); //para evitar confusiones esta se<73>al deber<65>a llamarse de otra forma
|
||||
|
||||
//si se ha creado un hilo para renderizar la p<>gina actual, se arranca
|
||||
if(pageRenders[currentPageBufferedIndex]!=0)
|
||||
{
|
||||
//se conecta la se<73>al pageReady del hilo, con el SLOT prepareAvailablePage
|
||||
connect(pageRenders[currentPageBufferedIndex],SIGNAL(pageReady(int)),this,SLOT(prepareAvailablePage(int)));
|
||||
//se emite la se<73>al de procesando, debido a que los hilos se arrancan aqu<71>
|
||||
if(doublePage || filters.size()>0)
|
||||
emit processingPage();
|
||||
pageRenders[currentPageBufferedIndex]->start();
|
||||
pageRenders[currentPageBufferedIndex]->setPriority(QThread::TimeCriticalPriority);
|
||||
}
|
||||
else
|
||||
//en qu<71> caso ser<65>a necesario hacer esto??? //TODO: IMPORTANTE, puede que no sea necesario.
|
||||
emit processingPage();
|
||||
}
|
||||
else
|
||||
//no hay ninguna p<>gina lista para ser renderizada, es necesario esperar.
|
||||
emit processingPage();
|
||||
}
|
||||
else
|
||||
// la p<>gina actual est<73> lista
|
||||
emit currentPageReady();
|
||||
|
||||
//se renderizan las p<>ginas restantes para llenar el buffer.
|
||||
if(doublePage)
|
||||
fillBufferDoublePage();
|
||||
else
|
||||
fillBuffer();
|
||||
}
|
||||
|
||||
QPixmap * Render::getCurrentPage()
|
||||
{
|
||||
QPixmap * page = new QPixmap();
|
||||
*page = page->fromImage(*buffer[currentPageBufferedIndex]);
|
||||
return page;
|
||||
}
|
||||
|
||||
void Render::setRotation(int degrees)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Render::setComic(Comic * c)
|
||||
{
|
||||
if(comic !=0)
|
||||
delete comic;
|
||||
comic = c;
|
||||
}
|
||||
|
||||
void Render::prepareAvailablePage(int page)
|
||||
{
|
||||
if(currentIndex == page)
|
||||
emit currentPageReady();
|
||||
}
|
||||
|
||||
void Render::update()
|
||||
{
|
||||
render();
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
// Comic interface
|
||||
//-----------------------------------------------------------------------------
|
||||
void Render::load(const QString & path)
|
||||
{
|
||||
if(comic!=0)
|
||||
delete comic;
|
||||
comic = new Comic();
|
||||
previousIndex = currentIndex = 0;
|
||||
|
||||
connect(comic,SIGNAL(errorOpening()),this,SIGNAL(errorOpening()));
|
||||
connect(comic,SIGNAL(imageLoaded(int)),this,SIGNAL(imageLoaded(int)));
|
||||
connect(comic,SIGNAL(imageLoaded(int)),this,SLOT(pageRawDataReady(int)));
|
||||
//connect(comic,SIGNAL(pageChanged(int)),this,SIGNAL(pageChanged(int)));
|
||||
connect(comic,SIGNAL(numPages(unsigned int)),this,SIGNAL(numPages(unsigned int)));
|
||||
connect(comic,SIGNAL(numPages(unsigned int)),this,SLOT(setNumPages(unsigned int)));
|
||||
connect(comic,SIGNAL(imageLoaded(int,QByteArray)),this,SIGNAL(imageLoaded(int,QByteArray)));
|
||||
connect(comic,SIGNAL(isBookmark(bool)),this,SIGNAL(currentPageIsBookmark(bool)));
|
||||
connect(comic,SIGNAL(bookmarksLoaded(const Bookmarks &)),this,SIGNAL(bookmarksLoaded(const Bookmarks &)));
|
||||
pagesReady.clear();
|
||||
comic->load(path);
|
||||
invalidate();
|
||||
loadedComic = true; //TODO reset if an error occurs while opening
|
||||
}
|
||||
//si se solicita la siguiente p<>gina, se calcula cu<63>l debe ser en funci<63>n de si se lee en modo a doble p<>gina o no.
|
||||
//la p<>gina s<>lo se renderiza, si realmente ha cambiado.
|
||||
void Render::nextPage()
|
||||
{
|
||||
int nextPage; //indica cu<63>l ser<65> la pr<70>xima p<>gina
|
||||
if(doublePage)
|
||||
{
|
||||
nextPage = currentIndex;
|
||||
if(currentIndex+2<comic->numPages())
|
||||
{
|
||||
nextPage = currentIndex+2;
|
||||
if(currentIndex != nextPage)
|
||||
comic->setIndex(nextPage);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nextPage = comic->nextPage();
|
||||
}
|
||||
|
||||
//se fuerza renderizado si la p<>gina ha cambiado
|
||||
if(currentIndex != nextPage)
|
||||
{
|
||||
previousIndex = currentIndex;
|
||||
currentIndex = nextPage;
|
||||
update();
|
||||
}
|
||||
}
|
||||
//si se solicita la p<>gina anterior, se calcula cu<63>l debe ser en funci<63>n de si se lee en modo a doble p<>gina o no.
|
||||
//la p<>gina s<>lo se renderiza, si realmente ha cambiado.
|
||||
void Render::previousPage()
|
||||
{
|
||||
int previousPage; //indica cu<63>l ser<65> la pr<70>xima p<>gina
|
||||
if(doublePage)
|
||||
{
|
||||
if(currentIndex == 1)
|
||||
invalidate();
|
||||
previousPage = qMax(currentIndex-2,0);
|
||||
if(currentIndex != previousPage)
|
||||
{
|
||||
comic->setIndex(previousPage);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
previousPage = comic->previousPage();
|
||||
}
|
||||
|
||||
//se fuerza renderizado si la p<>gina ha cambiado
|
||||
if(currentIndex != previousPage)
|
||||
{
|
||||
previousIndex = currentIndex;
|
||||
currentIndex = previousPage;
|
||||
update();
|
||||
}
|
||||
}
|
||||
unsigned int Render::getIndex()
|
||||
{
|
||||
return comic->getIndex();
|
||||
}
|
||||
unsigned int Render::numPages()
|
||||
{
|
||||
return comic->numPages();
|
||||
}
|
||||
|
||||
bool Render::hasLoadedComic()
|
||||
{
|
||||
if(comic!=0)
|
||||
return comic->loaded();
|
||||
return false;
|
||||
}
|
||||
|
||||
void Render::setNumPages(unsigned int numPages)
|
||||
{
|
||||
pagesReady.fill(false,numPages);
|
||||
}
|
||||
|
||||
void Render::pageRawDataReady(int page)
|
||||
{
|
||||
pagesEmited.push_back(page);
|
||||
if(pageRenders.size()>0)
|
||||
{
|
||||
for(int i=0;i<pagesEmited.size();i++)
|
||||
{
|
||||
pagesReady[pagesEmited.at(i)] = true;
|
||||
if(pagesEmited.at(i) == currentIndex)
|
||||
update();
|
||||
|
||||
if(doublePage)
|
||||
{
|
||||
if(pagesEmited.at(i)==currentIndex+1)
|
||||
update();
|
||||
|
||||
if ( ((pagesEmited.at(i) < currentIndex) && (pagesEmited.at(i) > currentIndex-2*numLeftPages)) ||
|
||||
((pagesEmited.at(i) > currentIndex+1) && (pagesEmited.at(i) < currentIndex+1+2*numRightPages)) )
|
||||
{
|
||||
fillBufferDoublePage();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ((pagesEmited.at(i) < currentIndex) && (pagesEmited.at(i) > currentIndex-numLeftPages)) ||
|
||||
((pagesEmited.at(i) > currentIndex) && (pagesEmited.at(i) < currentIndex+numRightPages)) )
|
||||
{
|
||||
fillBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
pagesEmited.clear();
|
||||
}
|
||||
}
|
||||
|
||||
//s<>lo se renderiza la p<>gina, si ha habido un cambio de p<>gina
|
||||
void Render::goTo(int index)
|
||||
{
|
||||
|
||||
if(currentIndex != index)
|
||||
{
|
||||
comic->setIndex(index);
|
||||
previousIndex = currentIndex;
|
||||
currentIndex = index;
|
||||
|
||||
//si cambia la paridad de las p<>gina en modo a doble p<>gina, se rellena el buffer.
|
||||
//esto solo deber<65>a orcurrir al llegar al principio o al final
|
||||
if(doublePage && ((previousIndex - index) % 2)!=0)
|
||||
invalidate();
|
||||
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void Render::rotateRight()
|
||||
{
|
||||
imageRotation = (imageRotation+90) % 360;
|
||||
invalidate();
|
||||
update();
|
||||
}
|
||||
void Render::rotateLeft()
|
||||
{
|
||||
if(imageRotation == 0)
|
||||
imageRotation = 270;
|
||||
else
|
||||
imageRotation = imageRotation - 90;
|
||||
invalidate();
|
||||
update();
|
||||
}
|
||||
|
||||
//Actualiza el buffer, a<>adiendo las im<69>genes (vac<61>as) necesarias para su posterior renderizado y
|
||||
//eliminado aquellas que ya no sean necesarias. Tambi<62>n libera los hilos (no estoy seguro de que sea responsabilidad suya)
|
||||
//Calcula el n<>mero de nuevas p<>ginas que hay que buferear y si debe hacerlo por la izquierda o la derecha (seg<65>n sea el sentido de la lectura)
|
||||
void Render::updateBuffer()
|
||||
{
|
||||
//QMutexLocker locker(&mutex);
|
||||
int windowSize = currentIndex - previousIndex;
|
||||
if(doublePage)
|
||||
{
|
||||
windowSize = windowSize/2;
|
||||
if(currentIndex == 0 && windowSize == 0 && previousIndex == 1)
|
||||
windowSize = -1;
|
||||
|
||||
}
|
||||
if(windowSize > 0)//add pages to right pages and remove on the left
|
||||
{
|
||||
windowSize = qMin(windowSize,buffer.size());
|
||||
for(int i = 0; i < windowSize; i++)
|
||||
{
|
||||
//renders
|
||||
PageRender * pr = pageRenders.front();
|
||||
pageRenders.pop_front();
|
||||
if(pr !=0)
|
||||
{
|
||||
if(pr->wait())
|
||||
delete pr;
|
||||
}
|
||||
pageRenders.push_back(0);
|
||||
|
||||
//images
|
||||
|
||||
if(buffer.front()!=0)
|
||||
delete buffer.front();
|
||||
buffer.pop_front();
|
||||
buffer.push_back(new QImage());
|
||||
}
|
||||
}
|
||||
else //add pages to left pages and remove on the right
|
||||
if(windowSize<0)
|
||||
{
|
||||
windowSize = -windowSize;
|
||||
windowSize = qMin(windowSize,buffer.size());
|
||||
for(int i = 0; i < windowSize; i++)
|
||||
{
|
||||
//renders
|
||||
PageRender * pr = pageRenders.back();
|
||||
pageRenders.pop_back();
|
||||
if(pr !=0)
|
||||
{
|
||||
if(pr->wait())
|
||||
delete pr;
|
||||
}
|
||||
pageRenders.push_front(0);
|
||||
|
||||
//images
|
||||
buffer.push_front(new QImage());
|
||||
QImage * p = buffer.back();
|
||||
if(p!=0)
|
||||
delete p;
|
||||
buffer.pop_back();
|
||||
}
|
||||
}
|
||||
previousIndex = currentIndex;
|
||||
}
|
||||
|
||||
void Render::fillBuffer()
|
||||
{
|
||||
for(int i = 1; i <= qMax(numLeftPages,numRightPages); i++)
|
||||
{
|
||||
if ((currentIndex+i < comic->numPages()) &&
|
||||
buffer[currentPageBufferedIndex+i]->isNull() &&
|
||||
i <= numRightPages &&
|
||||
pageRenders[currentPageBufferedIndex+i]==0 &&
|
||||
pagesReady[currentIndex+1]) //preload next pages
|
||||
{
|
||||
pageRenders[currentPageBufferedIndex+i] = new PageRender(currentIndex+i,comic->getRawData()->at(currentIndex+i),buffer[currentPageBufferedIndex+i],imageRotation);
|
||||
connect(pageRenders[currentPageBufferedIndex],SIGNAL(pageReady(int)),this,SLOT(prepareAvailablePage(int)));
|
||||
pageRenders[currentPageBufferedIndex+i]->start();
|
||||
}
|
||||
|
||||
if ((currentIndex-i > 0) &&
|
||||
buffer[currentPageBufferedIndex-i]->isNull() &&
|
||||
i <= numLeftPages &&
|
||||
pageRenders[currentPageBufferedIndex-i]==0 &&
|
||||
pagesReady[currentIndex-1]) //preload previous pages
|
||||
{
|
||||
pageRenders[currentPageBufferedIndex-i] = new PageRender(currentIndex-i,comic->getRawData()->at(currentIndex-i),buffer[currentPageBufferedIndex-i],imageRotation);
|
||||
connect(pageRenders[currentPageBufferedIndex],SIGNAL(pageReady(int)),this,SLOT(prepareAvailablePage(int)));
|
||||
pageRenders[currentPageBufferedIndex-i]->start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Render::fillBufferDoublePage()
|
||||
{
|
||||
for(int i = 1; i <= qMax(numLeftPages,numRightPages); i++)
|
||||
{
|
||||
if ((currentIndex+2*i < comic->numPages()) &&
|
||||
buffer[currentPageBufferedIndex+i]->isNull() &&
|
||||
i <= numRightPages &&
|
||||
pageRenders[currentPageBufferedIndex+i]==0 &&
|
||||
(pagesReady[currentIndex+2*i] && pagesReady[qMin(currentIndex+(2*i)+1,(int)comic->numPages()-1)])) //preload next pages
|
||||
{
|
||||
if(currentIndex+(2*i)+1 > comic->numPages()-1)
|
||||
pageRenders[currentPageBufferedIndex+i] = new DoublePageRender(currentIndex+2*i,comic->getRawData()->at(currentIndex+(2*i)),QByteArray(),buffer[currentPageBufferedIndex+i],imageRotation);
|
||||
else
|
||||
pageRenders[currentPageBufferedIndex+i] = new DoublePageRender(currentIndex+2*i,comic->getRawData()->at(currentIndex+(2*i)),comic->getRawData()->at(currentIndex+(2*i)+1),buffer[currentPageBufferedIndex+i],imageRotation);
|
||||
connect(pageRenders[currentPageBufferedIndex],SIGNAL(pageReady(int)),this,SLOT(prepareAvailablePage(int)));
|
||||
pageRenders[currentPageBufferedIndex+i]->start();
|
||||
}
|
||||
|
||||
if ((currentIndex-2*i >= -1) &&
|
||||
buffer[currentPageBufferedIndex-i]->isNull() &&
|
||||
i <= numLeftPages &&
|
||||
pageRenders[currentPageBufferedIndex-i]==0 &&
|
||||
(pagesReady[qMax(currentIndex-2*i,0)] && pagesReady[qMin(currentIndex-(2*i)+1,(int)comic->numPages()-1)])) //preload previous pages
|
||||
{
|
||||
if(currentIndex-2*i == -1)
|
||||
pageRenders[currentPageBufferedIndex-i] = new DoublePageRender(0,QByteArray(),comic->getRawData()->at(0),buffer[currentPageBufferedIndex-i],imageRotation);
|
||||
else
|
||||
pageRenders[currentPageBufferedIndex-i] = new DoublePageRender(currentIndex-2*i,comic->getRawData()->at(currentIndex-(2*i)),comic->getRawData()->at(currentIndex-(2*i)+1),buffer[currentPageBufferedIndex-i],imageRotation);
|
||||
connect(pageRenders[currentPageBufferedIndex],SIGNAL(pageReady(int)),this,SLOT(prepareAvailablePage(int)));
|
||||
pageRenders[currentPageBufferedIndex-i]->start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//M<>todo que debe ser llamado cada vez que la estructura del buffer se vuelve inconsistente con el modo de lectura actual.
|
||||
//se terminan todos los hilos en ejecuci<63>n y se libera la memoria (de hilos e im<69>genes)
|
||||
void Render::invalidate()
|
||||
{
|
||||
for(int i=0;i<pageRenders.size();i++)
|
||||
{
|
||||
if(pageRenders[i]!=0)
|
||||
{
|
||||
pageRenders[i]->terminate();
|
||||
delete pageRenders[i];
|
||||
pageRenders[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0;i<buffer.size();i++)
|
||||
{
|
||||
delete buffer[i];
|
||||
buffer[i] = new QImage();
|
||||
}
|
||||
}
|
||||
|
||||
void Render::doublePageSwitch()
|
||||
{
|
||||
doublePage = !doublePage;
|
||||
if(comic)
|
||||
{
|
||||
invalidate();
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
QString Render::getCurrentPagesInformation()
|
||||
{
|
||||
QString s = QString::number(currentIndex+1);
|
||||
if (doublePage && (currentIndex+1 < comic->numPages()))
|
||||
s += "-"+QString::number(currentIndex+2);
|
||||
s += "/"+QString::number(comic->numPages());
|
||||
return s;
|
||||
}
|
||||
|
||||
void Render::setBookmark()
|
||||
{
|
||||
comic->setBookmark();
|
||||
}
|
||||
|
||||
void Render::removeBookmark()
|
||||
{
|
||||
comic->removeBookmark();
|
||||
}
|
||||
|
||||
void Render::save()
|
||||
{
|
||||
comic->saveBookmarks();
|
||||
}
|
177
YACReader/render.h
Normal file
@ -0,0 +1,177 @@
|
||||
#ifndef RENDER_H
|
||||
#define RENDER_H
|
||||
|
||||
#include <QImage>
|
||||
#include <QPixmap>
|
||||
#include <QPainter>
|
||||
#include <QThread>
|
||||
#include <QByteArray>
|
||||
#include <QVector>
|
||||
#include "comic.h"
|
||||
//-----------------------------------------------------------------------------
|
||||
// FILTERS
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <QThread>
|
||||
|
||||
class Comic;
|
||||
|
||||
class ImageFilter {
|
||||
public:
|
||||
ImageFilter(){};
|
||||
virtual QImage setFilter(const QImage & image) = 0;
|
||||
};
|
||||
|
||||
class MeanNoiseReductionFilter : public ImageFilter {
|
||||
public:
|
||||
enum NeighborghoodSize{SMALL=9, LARGE=25 };
|
||||
MeanNoiseReductionFilter(enum NeighborghoodSize ns = SMALL);
|
||||
virtual QImage setFilter(const QImage & image);
|
||||
private:
|
||||
enum NeighborghoodSize neighborghoodSize;
|
||||
};
|
||||
|
||||
class MedianNoiseReductionFilter : public ImageFilter {
|
||||
public:
|
||||
enum NeighborghoodSize{SMALL=9, LARGE=25 };
|
||||
MedianNoiseReductionFilter(enum NeighborghoodSize ns = SMALL);
|
||||
virtual QImage setFilter(const QImage & image);
|
||||
private:
|
||||
enum NeighborghoodSize neighborghoodSize;
|
||||
};
|
||||
|
||||
class BrightnessFilter : public ImageFilter {
|
||||
public:
|
||||
BrightnessFilter(int l=150);
|
||||
virtual QImage setFilter(const QImage & image);
|
||||
private:
|
||||
int level;
|
||||
};
|
||||
|
||||
class ContrastFilter : public ImageFilter {
|
||||
public:
|
||||
ContrastFilter();
|
||||
virtual QImage setFilter(const QImage & image);
|
||||
private:
|
||||
int level;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// RENDER
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class PageRender : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PageRender();
|
||||
PageRender(int numPage, const QByteArray & rawData, QImage * page,unsigned int degrees=0, QVector<ImageFilter *> filters = QVector<ImageFilter *>());
|
||||
int getNumPage(){return numPage;};
|
||||
void setData(const QByteArray & rawData){data = rawData;};
|
||||
void setPage(QImage * p){page = p;};
|
||||
void setRotation(unsigned int d){degrees = d;};
|
||||
void setFilters(QVector<ImageFilter *> f){filters = f;};
|
||||
private:
|
||||
int numPage;
|
||||
QByteArray data;
|
||||
QImage * page;
|
||||
unsigned int degrees;
|
||||
QVector<ImageFilter *> filters;
|
||||
void run();
|
||||
signals:
|
||||
void pageReady(int);
|
||||
|
||||
};
|
||||
//-----------------------------------------------------------------------------
|
||||
// RENDER
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class DoublePageRender : public PageRender
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DoublePageRender(int firstPage, const QByteArray & firstPageData,const QByteArray & secondPageData, QImage * page,unsigned int degrees=0, QVector<ImageFilter *> filters = QVector<ImageFilter *>());
|
||||
private:
|
||||
int numPage;
|
||||
QByteArray data;
|
||||
QByteArray data2;
|
||||
QImage * page;
|
||||
unsigned int degrees;
|
||||
QVector<ImageFilter *> filters;
|
||||
void run();
|
||||
signals:
|
||||
void pageReady(int);
|
||||
|
||||
};
|
||||
|
||||
|
||||
class Render : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Render();
|
||||
|
||||
public slots:
|
||||
void render();
|
||||
QPixmap * getCurrentPage();
|
||||
void goTo(int index);
|
||||
void doublePageSwitch();
|
||||
void setRotation(int degrees);
|
||||
void setComic(Comic * c);
|
||||
void prepareAvailablePage(int page);
|
||||
void update();
|
||||
void setNumPages(unsigned int numPages);
|
||||
void pageRawDataReady(int page);
|
||||
//--comic interface
|
||||
void nextPage();
|
||||
void previousPage();
|
||||
void load(const QString & path);
|
||||
void rotateRight();
|
||||
void rotateLeft();
|
||||
unsigned int getIndex();
|
||||
unsigned int numPages();
|
||||
bool hasLoadedComic();
|
||||
void updateBuffer();
|
||||
void fillBuffer();
|
||||
void fillBufferDoublePage();
|
||||
void invalidate();
|
||||
QString getCurrentPagesInformation();
|
||||
void setBookmark();
|
||||
void removeBookmark();
|
||||
void save();
|
||||
|
||||
signals:
|
||||
void currentPageReady();
|
||||
void processingPage();
|
||||
void imagesLoaded();
|
||||
void imageLoaded(int index);
|
||||
void imageLoaded(int index,const QByteArray & image);
|
||||
void pageChanged(int index);
|
||||
void numPages(unsigned int numPages);
|
||||
void errorOpening();
|
||||
void currentPageIsBookmark(bool);
|
||||
void bookmarksLoaded(const Bookmarks &);
|
||||
|
||||
private:
|
||||
Comic * comic;
|
||||
bool doublePage;
|
||||
int previousIndex;
|
||||
int currentIndex;
|
||||
//QPixmap * currentPage;
|
||||
int currentPageBufferedIndex;
|
||||
int numLeftPages;
|
||||
int numRightPages;
|
||||
QList<PageRender *> pageRenders;
|
||||
QList<QImage *> buffer;
|
||||
void loadAll();
|
||||
void updateRightPages();
|
||||
void updateLeftPages();
|
||||
bool loadedComic;
|
||||
QList<int> pagesEmited;
|
||||
QVector<bool> pagesReady;
|
||||
int imageRotation;
|
||||
QVector<ImageFilter *> filters;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // RENDER_H
|
74
YACReader/shortcuts_dialog.cpp
Normal file
@ -0,0 +1,74 @@
|
||||
#include "shortcuts_dialog.h"
|
||||
#include <QVBoxLayout>
|
||||
#include <QPushButton>
|
||||
#include <QTextEdit>
|
||||
#include <QLabel>
|
||||
#include <QPixmap>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
|
||||
ShortcutsDialog::ShortcutsDialog(QWidget * parent)
|
||||
:QDialog(parent)//,Qt::FramelessWindowHint)
|
||||
{
|
||||
setModal(true);
|
||||
setWindowIcon(QIcon(":/images/shortcuts.png"));
|
||||
setWindowTitle(tr("YACReader keyboard shortcuts"));
|
||||
|
||||
QVBoxLayout * mainLayout = new QVBoxLayout;
|
||||
|
||||
close = new QPushButton(tr("Close"));
|
||||
connect(close,SIGNAL(clicked()),this,SLOT(close()));
|
||||
|
||||
QHBoxLayout *bottomLayout = new QHBoxLayout;
|
||||
bottomLayout->addStretch();
|
||||
bottomLayout->addWidget(close);
|
||||
|
||||
QHBoxLayout * shortcutsLayout = new QHBoxLayout;
|
||||
|
||||
shortcuts = new QTextEdit();
|
||||
QTextEdit * shortcuts2 = new QTextEdit();
|
||||
shortcuts->setFrameStyle(QFrame::NoFrame);
|
||||
shortcuts2->setFrameStyle(QFrame::NoFrame);
|
||||
//"<p><b>General functions:</b><hr/><b>O</b> : Open comic<br/><b>Esc</b> : Exit</p>"
|
||||
shortcuts->setReadOnly(true);
|
||||
shortcuts2->setReadOnly(true);
|
||||
shortcutsLayout->addWidget(shortcuts);
|
||||
shortcutsLayout->addWidget(shortcuts2);
|
||||
shortcutsLayout->setSpacing(0);
|
||||
mainLayout->addLayout(shortcutsLayout);
|
||||
mainLayout->addLayout(bottomLayout);
|
||||
|
||||
QHBoxLayout *imgMainLayout = new QHBoxLayout;
|
||||
QLabel * imgLabel = new QLabel();
|
||||
QPixmap p(":/images/shortcuts.png");
|
||||
imgLabel->setPixmap(p);
|
||||
|
||||
QVBoxLayout * imgLayout = new QVBoxLayout;
|
||||
imgLayout->addWidget(imgLabel);
|
||||
imgLayout->addStretch();
|
||||
|
||||
imgMainLayout->addLayout(imgLayout);
|
||||
imgMainLayout->addLayout(mainLayout);
|
||||
|
||||
setLayout(imgMainLayout);
|
||||
|
||||
setFixedSize(QSize(700,500));
|
||||
|
||||
QFile f(":/files/shortcuts.html");
|
||||
f.open(QIODevice::ReadOnly);
|
||||
QTextStream txtS(&f);
|
||||
QString content = txtS.readAll();
|
||||
f.close();
|
||||
|
||||
shortcuts->setHtml(content);
|
||||
|
||||
QFile f2(":/files/shortcuts2.html");
|
||||
f2.open(QIODevice::ReadOnly);
|
||||
QTextStream txtS2(&f2);
|
||||
content = txtS2.readAll();
|
||||
f2.close();
|
||||
|
||||
shortcuts2->setHtml(content);
|
||||
|
||||
setWindowTitle(tr("Keyboard Shortcuts"));
|
||||
}
|
19
YACReader/shortcuts_dialog.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef SHORTCUTS_DIALOG_H
|
||||
#define SHORTCUTS_DIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QTextEdit>
|
||||
#include <QPushButton>
|
||||
|
||||
class ShortcutsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ShortcutsDialog(QWidget * parent = 0);
|
||||
private:
|
||||
QTextEdit * shortcuts;
|
||||
QPushButton * close;
|
||||
public slots:
|
||||
};
|
||||
|
||||
#endif // SHORTCUTS_DIALOG_H
|
88
YACReader/translator.cpp
Normal file
@ -0,0 +1,88 @@
|
||||
#include <QUrl>
|
||||
#include <Phonon/MediaObject>
|
||||
#include <Phonon/MediaSource>
|
||||
#include <QPushButton>
|
||||
#include <QPalette>
|
||||
#include <QMouseEvent>
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWebView>
|
||||
#include <QFile>
|
||||
#include <QPoint>
|
||||
#include <QWidget>
|
||||
|
||||
#include "translator.h"
|
||||
|
||||
YACReaderTranslator::YACReaderTranslator(QWidget * parent)
|
||||
:QWidget(parent)
|
||||
{
|
||||
this->setCursor(QCursor(Qt::ArrowCursor));
|
||||
this->setAutoFillBackground(true);
|
||||
this->setBackgroundRole(QPalette::Window);
|
||||
QPalette p(this->palette());
|
||||
p.setColor(QPalette::Window, QColor(96,96,96));
|
||||
this->setPalette(p);
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
QWebView * view = new QWebView();
|
||||
QFile f(":/files/translator.html");
|
||||
f.open(QIODevice::ReadOnly);
|
||||
QTextStream txtS(&f);
|
||||
QString contentHTML = txtS.readAll();
|
||||
view->setHtml(contentHTML);
|
||||
view->page()->setLinkDelegationPolicy(QWebPage::DelegateExternalLinks);
|
||||
connect(view->page(),SIGNAL(linkClicked(QUrl)),this,SLOT(play(QUrl)));
|
||||
|
||||
QHBoxLayout * buttonBar = new QHBoxLayout();
|
||||
QPushButton * close = new QPushButton(QIcon(QPixmap(":/images/close.png")),"");
|
||||
close->setFlat(true);
|
||||
buttonBar->addStretch();
|
||||
close->resize(18,18);
|
||||
buttonBar->addWidget(close);
|
||||
buttonBar->setMargin(0);
|
||||
connect(close,SIGNAL(clicked()),this->parent(),SLOT(animateHideTranslator()));
|
||||
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
|
||||
layout->addLayout(buttonBar);
|
||||
layout->addWidget(view);
|
||||
|
||||
resize(view->size().width()/1.60,view->size().height());
|
||||
|
||||
music = createPlayer(MusicCategory);
|
||||
|
||||
show();
|
||||
}
|
||||
|
||||
void YACReaderTranslator::play(const QUrl & url)
|
||||
{
|
||||
MediaSource src(url);
|
||||
src.setAutoDelete(true);
|
||||
music->setCurrentSource(src);
|
||||
music->play();
|
||||
}
|
||||
|
||||
YACReaderTranslator::~YACReaderTranslator()
|
||||
{
|
||||
delete music;
|
||||
}
|
||||
|
||||
void YACReaderTranslator::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
drag = true;
|
||||
click = event->pos();
|
||||
}
|
||||
|
||||
void YACReaderTranslator::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
drag = false;
|
||||
}
|
||||
|
||||
void YACReaderTranslator::mouseMoveEvent(QMouseEvent * event)
|
||||
{
|
||||
if(drag)
|
||||
this->move(QPoint(mapToParent(event->pos())-click));
|
||||
|
||||
}
|
||||
|
32
YACReader/translator.h
Normal file
@ -0,0 +1,32 @@
|
||||
#ifndef __TRANSLATOR_H
|
||||
#define __TRANSLATOR_H
|
||||
|
||||
class QUrl;
|
||||
class QMouseEvent;
|
||||
class QPoint;
|
||||
#include<QWidget>
|
||||
#include<Phonon/MediaObject>
|
||||
|
||||
using namespace Phonon;
|
||||
|
||||
class YACReaderTranslator : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
YACReaderTranslator(QWidget * parent = 0);
|
||||
~YACReaderTranslator();
|
||||
|
||||
public slots:
|
||||
void play(const QUrl & url);
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
void mouseMoveEvent ( QMouseEvent * event );
|
||||
bool drag;
|
||||
QPoint click;
|
||||
private:
|
||||
MediaObject * music;
|
||||
};
|
||||
|
||||
#endif
|
671
YACReader/viewer.cpp
Normal file
@ -0,0 +1,671 @@
|
||||
#include "viewer.h"
|
||||
#include "magnifying_glass.h"
|
||||
#include "configuration.h"
|
||||
#include "magnifying_glass.h"
|
||||
#include "goto_flow.h"
|
||||
#include "bookmarks_dialog.h"
|
||||
#include "render.h"
|
||||
#include "goto_dialog.h"
|
||||
#include "translator.h"
|
||||
|
||||
#include <QWebView>
|
||||
#include <QFile>
|
||||
#define STEPS 22
|
||||
|
||||
|
||||
|
||||
Viewer::Viewer(QWidget * parent)
|
||||
:QScrollArea(parent),
|
||||
currentPage(0),
|
||||
magnifyingGlassShowed(false),
|
||||
fullscreen(false),
|
||||
information(false),
|
||||
adjustToWidthRatio(1),
|
||||
doublePage(false),
|
||||
wheelStop(false),
|
||||
direction(1),
|
||||
restoreMagnifyingGlass(false),
|
||||
drag(false)
|
||||
|
||||
{
|
||||
translator = new YACReaderTranslator(this);
|
||||
translator->hide();
|
||||
translatorAnimation = new QPropertyAnimation(translator,"pos");
|
||||
translatorAnimation->setDuration(150);
|
||||
translatorXPos = -10000;
|
||||
translator->move(-translator->width(),10);
|
||||
//current comic page
|
||||
content = new QLabel(this);
|
||||
configureContent(tr("Press 'O' to open comic."));
|
||||
//scroll area configuration
|
||||
setBackgroundRole(QPalette::Dark);
|
||||
setWidget(content);
|
||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setFrameStyle(QFrame::NoFrame);
|
||||
setAlignment(Qt::AlignCenter);
|
||||
|
||||
QPalette palette;
|
||||
palette.setColor(backgroundRole(), Configuration::getConfiguration().getBackgroundColor());
|
||||
setPalette(palette);
|
||||
//---------------------------------------
|
||||
mglass = new MagnifyingGlass(Configuration::getConfiguration().getMagnifyingGlassSize(),this);
|
||||
mglass->hide();
|
||||
content->setMouseTracking(true);
|
||||
setMouseTracking(true);
|
||||
|
||||
informationLabel = new QLabel(this);
|
||||
informationLabel->setAlignment(Qt::AlignVCenter|Qt::AlignHCenter);
|
||||
informationLabel->setAutoFillBackground(true);
|
||||
informationLabel->setFont(QFont("courier new", 12));
|
||||
informationLabel->hide();
|
||||
informationLabel->resize(100,25);
|
||||
|
||||
showCursor();
|
||||
|
||||
goToDialog = new GoToDialog(this);
|
||||
|
||||
goToFlow = new GoToFlow(this,Configuration::getConfiguration().getFlowType());
|
||||
goToFlow->hide();
|
||||
showGoToFlowAnimation = new QPropertyAnimation(goToFlow,"pos");
|
||||
showGoToFlowAnimation->setDuration(150);
|
||||
|
||||
bd = new BookmarksDialog(this->parentWidget());
|
||||
|
||||
render = new Render();
|
||||
|
||||
scroller = new QTimer(this);
|
||||
|
||||
hideCursorTimer = new QTimer();
|
||||
hideCursorTimer->setSingleShot(true);
|
||||
|
||||
if(Configuration::getConfiguration().getDoublePage())
|
||||
doublePageSwitch();
|
||||
|
||||
createConnections();
|
||||
|
||||
hideCursorTimer->start(2500);
|
||||
|
||||
setMouseTracking(true);
|
||||
}
|
||||
|
||||
void Viewer::createConnections()
|
||||
{
|
||||
//magnifyingGlass (update mg after a background change
|
||||
connect(this,SIGNAL(backgroundChanges()),mglass,SLOT(updateImage()));
|
||||
|
||||
//goToDialog
|
||||
connect(goToDialog,SIGNAL(goToPage(unsigned int)),this,SLOT(goTo(unsigned int)));
|
||||
|
||||
//goToFlow goTo
|
||||
connect(goToFlow,SIGNAL(goToPage(unsigned int)),this,SLOT(goTo(unsigned int)));
|
||||
|
||||
//current time
|
||||
QTimer * t = new QTimer();
|
||||
connect(t,SIGNAL(timeout()),this,SLOT(updateInformation()));
|
||||
t->start(1000);
|
||||
|
||||
//hide cursor
|
||||
connect(hideCursorTimer,SIGNAL(timeout()),this,SLOT(hideCursor()));
|
||||
|
||||
//bookmarks
|
||||
connect(bd,SIGNAL(goToPage(unsigned int)),this,SLOT(goTo(unsigned int)));
|
||||
|
||||
//render
|
||||
connect(render,SIGNAL(errorOpening()),this,SLOT(resetContent()));
|
||||
connect(render,SIGNAL(numPages(unsigned int)),goToFlow,SLOT(setNumSlides(unsigned int)));
|
||||
connect(render,SIGNAL(numPages(unsigned int)),goToDialog,SLOT(setNumPages(unsigned int)));
|
||||
connect(render,SIGNAL(imageLoaded(int,QByteArray)),goToFlow,SLOT(setImageReady(int,QByteArray)));
|
||||
connect(render,SIGNAL(currentPageReady()),this,SLOT(updatePage()));
|
||||
connect(render,SIGNAL(processingPage()),this,SLOT(setLoadingMessage()));
|
||||
connect(render,SIGNAL(currentPageIsBookmark(bool)),this,SIGNAL(pageIsBookmark(bool)));
|
||||
connect(render,SIGNAL(bookmarksLoaded(const Bookmarks &)),bd,SLOT(setBookmarks(const Bookmarks &)));
|
||||
}
|
||||
|
||||
void Viewer::open(QString pathFile)
|
||||
{
|
||||
if(render->hasLoadedComic())
|
||||
save();
|
||||
//bd->setBookmarks(*bm);
|
||||
|
||||
goToFlow->reset();
|
||||
render->load(pathFile);
|
||||
render->update();
|
||||
|
||||
verticalScrollBar()->setSliderPosition(verticalScrollBar()->minimum());
|
||||
}
|
||||
|
||||
void Viewer::next()
|
||||
{
|
||||
direction = 1;
|
||||
render->nextPage();
|
||||
}
|
||||
|
||||
void Viewer::prev()
|
||||
{
|
||||
direction = -1;
|
||||
render->previousPage();
|
||||
}
|
||||
void Viewer::showGoToDialog()
|
||||
{
|
||||
goToDialog->show();
|
||||
}
|
||||
void Viewer::goTo(unsigned int page)
|
||||
{
|
||||
direction = 1; //in "go to" direction is always fordward
|
||||
render->goTo(page-1);
|
||||
}
|
||||
|
||||
void Viewer::updatePage()
|
||||
{
|
||||
QPixmap * previousPage = currentPage;
|
||||
currentPage = render->getCurrentPage();
|
||||
content->setPixmap(*currentPage);
|
||||
updateContentSize();
|
||||
updateVerticalScrollBar();
|
||||
emit backgroundChanges();
|
||||
emit(pageAvailable(true));
|
||||
//TODO -> update bookmark action
|
||||
setFocus(Qt::ShortcutFocusReason);
|
||||
delete previousPage;
|
||||
if(restoreMagnifyingGlass)
|
||||
{
|
||||
restoreMagnifyingGlass = false;
|
||||
showMagnifyingGlass();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Viewer::updateContentSize()
|
||||
{
|
||||
//there is an image to resize
|
||||
if(currentPage !=0 && !currentPage->isNull())
|
||||
{
|
||||
if(Configuration::getConfiguration().getAdjustToFullSize())
|
||||
{
|
||||
content->resize(currentPage->width(),currentPage->height());
|
||||
}
|
||||
else
|
||||
{
|
||||
float aspectRatio = (float)currentPage->width()/currentPage->height();
|
||||
//Fit to width
|
||||
if(Configuration::getConfiguration().getAdjustToWidth())
|
||||
{
|
||||
adjustToWidthRatio = Configuration::getConfiguration().getFitToWidthRatio();
|
||||
if(static_cast<int>(width()*adjustToWidthRatio/aspectRatio)<height())
|
||||
if(static_cast<int>(height()*aspectRatio)>width())
|
||||
content->resize(width(),static_cast<int>(width()/aspectRatio));
|
||||
else
|
||||
content->resize(static_cast<int>(height()*aspectRatio),height());
|
||||
else
|
||||
content->resize(width()*adjustToWidthRatio,static_cast<int>(width()*adjustToWidthRatio/aspectRatio));
|
||||
}
|
||||
//Fit to height or fullsize/custom size
|
||||
else
|
||||
{
|
||||
if(static_cast<int>(height()*aspectRatio)>width()) //page width exceeds window width
|
||||
content->resize(width(),static_cast<int>(width()/aspectRatio));
|
||||
else
|
||||
content->resize(static_cast<int>(height()*aspectRatio),height());
|
||||
}
|
||||
}
|
||||
emit backgroundChanges();
|
||||
}
|
||||
content->update(); //TODO, it shouldn't be neccesary
|
||||
}
|
||||
|
||||
void Viewer::updateVerticalScrollBar()
|
||||
{
|
||||
if(direction > 0)
|
||||
verticalScrollBar()->setSliderPosition(verticalScrollBar()->minimum());
|
||||
else
|
||||
verticalScrollBar()->setSliderPosition(verticalScrollBar()->maximum());
|
||||
}
|
||||
|
||||
void Viewer::scrollDown()
|
||||
{
|
||||
if(verticalScrollBar()->sliderPosition()==verticalScrollBar()->maximum())
|
||||
{
|
||||
next();
|
||||
scroller->stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
int currentPos = verticalScrollBar()->sliderPosition();
|
||||
verticalScrollBar()->setSliderPosition(currentPos=currentPos+posByStep);
|
||||
if((verticalScrollBar()->sliderPosition()==verticalScrollBar()->maximum())
|
||||
||(verticalScrollBar()->sliderPosition()>=nextPos))
|
||||
scroller->stop();
|
||||
emit backgroundChanges();
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::scrollUp()
|
||||
{
|
||||
if(verticalScrollBar()->sliderPosition()==verticalScrollBar()->minimum())
|
||||
{
|
||||
prev();
|
||||
scroller->stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
int currentPos = verticalScrollBar()->sliderPosition();
|
||||
verticalScrollBar()->setSliderPosition(currentPos=currentPos-posByStep);
|
||||
if((verticalScrollBar()->sliderPosition()==verticalScrollBar()->minimum())
|
||||
||(verticalScrollBar()->sliderPosition()<=nextPos))
|
||||
scroller->stop();
|
||||
emit backgroundChanges();
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
if(render->hasLoadedComic())
|
||||
{
|
||||
if(goToFlow->isVisible() && event->key()!=Qt::Key_S)
|
||||
QCoreApplication::sendEvent(goToFlow,event);
|
||||
else
|
||||
switch (event->key())
|
||||
{
|
||||
case Qt::Key_Space:
|
||||
disconnect(scroller,SIGNAL(timeout()),this,0);
|
||||
connect(scroller,SIGNAL(timeout()),this,SLOT(scrollDown()));
|
||||
posByStep = height()/STEPS;
|
||||
nextPos=verticalScrollBar()->sliderPosition()+static_cast<int>((height()*0.80));
|
||||
scroller->start(20);
|
||||
break;
|
||||
case Qt::Key_B:
|
||||
disconnect(scroller,SIGNAL(timeout()),this,0);
|
||||
connect(scroller,SIGNAL(timeout()),this,SLOT(scrollUp()));
|
||||
posByStep = height()/STEPS;
|
||||
nextPos=verticalScrollBar()->sliderPosition()-static_cast<int>((height()*0.80));
|
||||
scroller->start(20);
|
||||
break;
|
||||
case Qt::Key_S:
|
||||
goToFlowSwitch();
|
||||
break;
|
||||
case Qt::Key_T:
|
||||
translatorSwitch();
|
||||
break;
|
||||
case Qt::Key_Down:
|
||||
/*if(verticalScrollBar()->sliderPosition()==verticalScrollBar()->maximum())
|
||||
next();
|
||||
else*/
|
||||
QAbstractScrollArea::keyPressEvent(event);
|
||||
emit backgroundChanges();
|
||||
break;
|
||||
case Qt::Key_Up:
|
||||
/*if(verticalScrollBar()->sliderPosition()==verticalScrollBar()->minimum())
|
||||
prev();
|
||||
else*/
|
||||
QAbstractScrollArea::keyPressEvent(event);
|
||||
emit backgroundChanges();
|
||||
break;
|
||||
case Qt::Key_Home:
|
||||
goTo(1);
|
||||
break;
|
||||
case Qt::Key_End:
|
||||
goTo(this->render->numPages());
|
||||
break;
|
||||
default:
|
||||
QAbstractScrollArea::keyPressEvent(event);
|
||||
break;
|
||||
}
|
||||
if(mglass->isVisible())
|
||||
switch(event->key())
|
||||
{
|
||||
case Qt::Key_Plus: case Qt::Key_Minus: case Qt::Key_Underscore: case Qt::Key_Asterisk:
|
||||
QCoreApplication::sendEvent(mglass,event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::wheelEvent(QWheelEvent * event)
|
||||
{
|
||||
if(render->hasLoadedComic())
|
||||
{
|
||||
if((event->delta()<0)&&(verticalScrollBar()->sliderPosition()==verticalScrollBar()->maximum()))
|
||||
{
|
||||
if(wheelStop)
|
||||
{
|
||||
next();
|
||||
event->accept();
|
||||
wheelStop = false;
|
||||
return;
|
||||
}
|
||||
else
|
||||
wheelStop = true;
|
||||
}
|
||||
else
|
||||
if((event->delta()>0)&&(verticalScrollBar()->sliderPosition()==verticalScrollBar()->minimum()))
|
||||
{
|
||||
if(wheelStop)
|
||||
{
|
||||
prev();
|
||||
event->accept();
|
||||
wheelStop = false;
|
||||
return;
|
||||
}
|
||||
else
|
||||
wheelStop = true;
|
||||
}
|
||||
|
||||
QAbstractScrollArea::wheelEvent(event);
|
||||
emit backgroundChanges();
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::resizeEvent(QResizeEvent * event)
|
||||
{
|
||||
updateContentSize();
|
||||
goToFlow->move(QPoint((width()-goToFlow->width())/2,height()-goToFlow->height()));
|
||||
informationLabel->move(QPoint((width()-informationLabel->width())/2,0));
|
||||
QScrollArea::resizeEvent(event);
|
||||
}
|
||||
|
||||
void Viewer::mouseMoveEvent(QMouseEvent * event)
|
||||
{
|
||||
showCursor();
|
||||
hideCursorTimer->start(2500);
|
||||
|
||||
if(magnifyingGlassShowed)
|
||||
mglass->move(static_cast<int>(event->x()-float(mglass->width())/2),static_cast<int>(event->y()-float(mglass->height())/2));
|
||||
|
||||
if(render->hasLoadedComic())
|
||||
{
|
||||
if(showGoToFlowAnimation->state()!=QPropertyAnimation::Running)
|
||||
{
|
||||
if(goToFlow->isVisible())
|
||||
{
|
||||
animateHideGoToFlow();
|
||||
//goToFlow->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
int umbral = (width()-goToFlow->width())/2;
|
||||
if((event->y()>height()-15)&&(event->x()>umbral)&&(event->x()<width()-umbral))
|
||||
{
|
||||
|
||||
animateShowGoToFlow();
|
||||
hideCursorTimer->stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(drag)
|
||||
{
|
||||
int currentPosY = verticalScrollBar()->sliderPosition();
|
||||
int currentPosX = horizontalScrollBar()->sliderPosition();
|
||||
verticalScrollBar()->setSliderPosition(currentPosY=currentPosY+(yDragOrigin-event->y()));
|
||||
horizontalScrollBar()->setSliderPosition(currentPosX=currentPosX+(xDragOrigin-event->x()));
|
||||
yDragOrigin = event->y();
|
||||
xDragOrigin = event->x();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
const QPixmap * Viewer::pixmap()
|
||||
{
|
||||
return content->pixmap();
|
||||
}
|
||||
|
||||
void Viewer::magnifyingGlassSwitch()
|
||||
{
|
||||
magnifyingGlassShowed?hideMagnifyingGlass():showMagnifyingGlass();
|
||||
}
|
||||
|
||||
void Viewer::showMagnifyingGlass()
|
||||
{
|
||||
if(render->hasLoadedComic())
|
||||
{
|
||||
QPoint p = QPoint(cursor().pos().x(),cursor().pos().y());
|
||||
p = this->parentWidget()->mapFromGlobal(p);
|
||||
mglass->move(static_cast<int>(p.x()-float(mglass->width())/2)
|
||||
,static_cast<int>(p.y()-float(mglass->height())/2));
|
||||
mglass->show();
|
||||
mglass->updateImage(mglass->x()+mglass->width()/2,mglass->y()+mglass->height()/2);
|
||||
magnifyingGlassShowed = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::hideMagnifyingGlass()
|
||||
{
|
||||
mglass->hide();
|
||||
magnifyingGlassShowed = false;
|
||||
}
|
||||
|
||||
void Viewer::informationSwitch()
|
||||
{
|
||||
information?informationLabel->hide():informationLabel->show();
|
||||
informationLabel->move(QPoint((width()-informationLabel->width())/2,0));
|
||||
information=!information;
|
||||
//TODO it shouldn't be neccesary
|
||||
informationLabel->adjustSize();
|
||||
informationLabel->update();
|
||||
}
|
||||
|
||||
void Viewer::updateInformation()
|
||||
{
|
||||
if(render->hasLoadedComic())
|
||||
{
|
||||
informationLabel->setText(render->getCurrentPagesInformation()+" - "+QTime::currentTime().toString("HH:mm"));
|
||||
informationLabel->adjustSize();
|
||||
informationLabel->update(); //TODO it shouldn't be neccesary
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::goToFlowSwitch()
|
||||
{
|
||||
goToFlow->isVisible()?animateHideGoToFlow():showGoToFlow();
|
||||
}
|
||||
|
||||
void Viewer::translatorSwitch()
|
||||
{
|
||||
translator->isVisible()?animateHideTranslator():animateShowTranslator();
|
||||
}
|
||||
|
||||
void Viewer::showGoToFlow()
|
||||
{
|
||||
if(render->hasLoadedComic())
|
||||
{
|
||||
animateShowGoToFlow();
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::animateShowGoToFlow()
|
||||
{
|
||||
if(goToFlow->isHidden() && showGoToFlowAnimation->state()!=QPropertyAnimation::Running)
|
||||
{
|
||||
disconnect(showGoToFlowAnimation,SIGNAL(finished()),goToFlow,SLOT(hide()));
|
||||
connect(showGoToFlowAnimation,SIGNAL(finished()),this,SLOT(moveCursoToGoToFlow()));
|
||||
showGoToFlowAnimation->setStartValue(QPoint((width()-goToFlow->width())/2,height()-10));
|
||||
showGoToFlowAnimation->setEndValue(QPoint((width()-goToFlow->width())/2,height()-goToFlow->height()));
|
||||
showGoToFlowAnimation->start();
|
||||
goToFlow->centerSlide(render->getIndex());
|
||||
goToFlow->setPageNumber(render->getIndex());
|
||||
goToFlow->show();
|
||||
goToFlow->setFocus(Qt::OtherFocusReason);
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::animateHideGoToFlow()
|
||||
{
|
||||
if(goToFlow->isVisible() && showGoToFlowAnimation->state()!=QPropertyAnimation::Running)
|
||||
{
|
||||
connect(showGoToFlowAnimation,SIGNAL(finished()),goToFlow,SLOT(hide()));
|
||||
disconnect(showGoToFlowAnimation,SIGNAL(finished()),this,SLOT(moveCursoToGoToFlow()));
|
||||
showGoToFlowAnimation->setStartValue(QPoint((width()-goToFlow->width())/2,height()-goToFlow->height()));
|
||||
showGoToFlowAnimation->setEndValue(QPoint((width()-goToFlow->width())/2,height()));
|
||||
showGoToFlowAnimation->start();
|
||||
goToFlow->centerSlide(render->getIndex());
|
||||
goToFlow->setPageNumber(render->getIndex());
|
||||
this->setFocus(Qt::OtherFocusReason);
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::moveCursoToGoToFlow()
|
||||
{
|
||||
//Move cursor to goToFlow widget on show (this avoid hide when mouse is moved)
|
||||
int y = goToFlow->pos().y();
|
||||
int x1 = goToFlow->pos().x();
|
||||
int x2 = x1 + goToFlow->width();
|
||||
QPoint cursorPos = mapFromGlobal(cursor().pos());
|
||||
int cursorX = cursorPos.x();
|
||||
int cursorY = cursorPos.y();
|
||||
|
||||
if(cursorY <= y)
|
||||
cursorY = y + 10;
|
||||
if(cursorX <= x1)
|
||||
cursorX = x1 + 10;
|
||||
if(cursorX >= x2)
|
||||
cursorX = x2 - 10;
|
||||
cursor().setPos(mapToGlobal(QPoint(cursorX,cursorY)));
|
||||
hideCursorTimer->stop();
|
||||
showCursor();
|
||||
}
|
||||
|
||||
void Viewer::rotateLeft()
|
||||
{
|
||||
render->rotateLeft();
|
||||
}
|
||||
void Viewer::rotateRight()
|
||||
{
|
||||
render->rotateRight();
|
||||
}
|
||||
|
||||
//TODO
|
||||
void Viewer::setBookmark(bool set)
|
||||
{
|
||||
render->setBookmark();
|
||||
if(set) //add bookmark
|
||||
{
|
||||
render->setBookmark();
|
||||
}
|
||||
else //remove bookmark
|
||||
{
|
||||
render->removeBookmark();
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::save ()
|
||||
{
|
||||
if(render->hasLoadedComic())
|
||||
render->save();
|
||||
}
|
||||
|
||||
void Viewer::doublePageSwitch()
|
||||
{
|
||||
doublePage = !doublePage;
|
||||
render->doublePageSwitch();
|
||||
Configuration::getConfiguration().setDoublePage(doublePage);
|
||||
}
|
||||
|
||||
void Viewer::resetContent()
|
||||
{
|
||||
configureContent(tr("Press 'O' to open comic."));
|
||||
goToFlow->reset();
|
||||
emit reset();
|
||||
}
|
||||
|
||||
void Viewer::setLoadingMessage()
|
||||
{
|
||||
if(magnifyingGlassShowed)
|
||||
{
|
||||
hideMagnifyingGlass();
|
||||
restoreMagnifyingGlass = true;
|
||||
}
|
||||
emit(pageAvailable(false));
|
||||
configureContent(tr("Loading...please wait!"));
|
||||
}
|
||||
|
||||
void Viewer::configureContent(QString msg)
|
||||
{
|
||||
content->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
|
||||
content->setScaledContents(true);
|
||||
content->setAlignment(Qt::AlignTop|Qt::AlignHCenter);
|
||||
content->setText(msg);
|
||||
content->setFont(QFont("courier new", 12));
|
||||
content->adjustSize();
|
||||
setFocus(Qt::ShortcutFocusReason);
|
||||
//emit showingText();
|
||||
}
|
||||
|
||||
void Viewer::hideCursor()
|
||||
{
|
||||
setCursor(Qt::BlankCursor);
|
||||
}
|
||||
void Viewer::showCursor()
|
||||
{
|
||||
if(drag)
|
||||
setCursor(Qt::ClosedHandCursor);
|
||||
else
|
||||
setCursor(Qt::OpenHandCursor);
|
||||
}
|
||||
|
||||
void Viewer::updateOptions()
|
||||
{
|
||||
|
||||
goToFlow->setFlowType(Configuration::getConfiguration().getFlowType());
|
||||
updateBackgroundColor(Configuration::getConfiguration().getBackgroundColor());
|
||||
updateContentSize();
|
||||
//goToFlow->updateSize();
|
||||
}
|
||||
|
||||
void Viewer::updateBackgroundColor(const QColor & color)
|
||||
{
|
||||
QPalette palette;
|
||||
palette.setColor(backgroundRole(), color);
|
||||
setPalette(palette);
|
||||
}
|
||||
|
||||
void Viewer::animateShowTranslator()
|
||||
{
|
||||
if(translator->isHidden() && translatorAnimation->state()!=QPropertyAnimation::Running)
|
||||
{
|
||||
disconnect(translatorAnimation,SIGNAL(finished()),translator,SLOT(hide()));
|
||||
if(translatorXPos == -10000)
|
||||
translatorXPos = (width()-translator->width())/2;
|
||||
int x = qMax(0,qMin(translatorXPos,width()-translator->width()));
|
||||
if(translator->pos().x()<0)
|
||||
{
|
||||
translatorAnimation->setStartValue(QPoint(-translator->width(),translator->pos().y()));
|
||||
}
|
||||
else
|
||||
{
|
||||
translatorAnimation->setStartValue(QPoint(width()+translator->width(),translator->pos().y()));
|
||||
}
|
||||
translatorAnimation->setEndValue(QPoint(x,translator->pos().y()));
|
||||
translatorAnimation->start();
|
||||
translator->show();
|
||||
translator->setFocus(Qt::OtherFocusReason);
|
||||
}
|
||||
}
|
||||
void Viewer::animateHideTranslator()
|
||||
{
|
||||
if(translator->isVisible() && translatorAnimation->state()!=QPropertyAnimation::Running)
|
||||
{
|
||||
connect(translatorAnimation,SIGNAL(finished()),translator,SLOT(hide()));
|
||||
translatorAnimation->setStartValue(QPoint(translatorXPos = translator->pos().x(),translator->pos().y()));
|
||||
if((translator->width()/2)+translator->pos().x() <= width()/2)
|
||||
translatorAnimation->setEndValue(QPoint(-translator->width(),translator->pos().y()));
|
||||
else
|
||||
translatorAnimation->setEndValue(QPoint(width()+translator->width(),translator->pos().y()));
|
||||
translatorAnimation->start();
|
||||
this->setFocus(Qt::OtherFocusReason);
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::mousePressEvent ( QMouseEvent * event )
|
||||
{
|
||||
drag = true;
|
||||
yDragOrigin = event->y();
|
||||
xDragOrigin = event->x();
|
||||
setCursor(Qt::ClosedHandCursor);
|
||||
}
|
||||
void Viewer::mouseReleaseEvent ( QMouseEvent * event )
|
||||
{
|
||||
drag = false;
|
||||
setCursor(Qt::OpenHandCursor);
|
||||
}
|
131
YACReader/viewer.h
Normal file
@ -0,0 +1,131 @@
|
||||
#ifndef __VIEWER_H
|
||||
#define __VIEWER_H
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
#include <QScrollArea>
|
||||
#include <QAction>
|
||||
#include <QTimer>
|
||||
#include <QLabel>
|
||||
#include <QPixmap>
|
||||
#include <QKeyEvent>
|
||||
#include <QResizeEvent>
|
||||
#include <QWheelEvent>
|
||||
#include <QMouseEvent>
|
||||
#include <QCloseEvent>
|
||||
#include <QPropertyAnimation>
|
||||
|
||||
|
||||
|
||||
class Comic;
|
||||
class MagnifyingGlass;
|
||||
class GoToFlow;
|
||||
class BookmarksDialog;
|
||||
class Render;
|
||||
class GoToDialog;
|
||||
class YACReaderTranslator;
|
||||
|
||||
class Viewer : public QScrollArea
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
bool fullscreen; //TODO, change by the right use of windowState();
|
||||
public slots:
|
||||
void open(QString pathFile);
|
||||
void prev();
|
||||
void next();
|
||||
void showGoToDialog();
|
||||
void goTo(unsigned int page);
|
||||
void updatePage();
|
||||
void updateContentSize();
|
||||
void updateVerticalScrollBar();
|
||||
void updateOptions();
|
||||
void scrollDown();
|
||||
void scrollUp();
|
||||
void magnifyingGlassSwitch();
|
||||
void showMagnifyingGlass();
|
||||
void hideMagnifyingGlass();
|
||||
void informationSwitch();
|
||||
void updateInformation();
|
||||
void goToFlowSwitch();
|
||||
void showGoToFlow();
|
||||
void moveCursoToGoToFlow();
|
||||
void animateShowGoToFlow();
|
||||
void animateHideGoToFlow();
|
||||
void rotateLeft();
|
||||
void rotateRight();
|
||||
bool magnifyingGlassIsVisible() {return magnifyingGlassShowed;}
|
||||
void setBookmark(bool);
|
||||
void save();
|
||||
void doublePageSwitch();
|
||||
void resetContent();
|
||||
void setLoadingMessage();
|
||||
void configureContent(QString msg);
|
||||
void hideCursor();
|
||||
void showCursor();
|
||||
void createConnections();
|
||||
void translatorSwitch();
|
||||
void animateShowTranslator();
|
||||
void animateHideTranslator();
|
||||
virtual void mousePressEvent ( QMouseEvent * event );
|
||||
virtual void mouseReleaseEvent ( QMouseEvent * event );
|
||||
void updateBackgroundColor(const QColor & color);
|
||||
|
||||
private:
|
||||
bool information;
|
||||
bool doublePage;
|
||||
QLabel * informationLabel;
|
||||
QTimer * scroller;
|
||||
int posByStep;
|
||||
int nextPos;
|
||||
GoToFlow * goToFlow;
|
||||
QPropertyAnimation * showGoToFlowAnimation;
|
||||
GoToDialog * goToDialog;
|
||||
//!Image properties
|
||||
float adjustToWidthRatio;
|
||||
//! Comic
|
||||
//Comic * comic;
|
||||
int index;
|
||||
QPixmap *currentPage;
|
||||
BookmarksDialog * bd;
|
||||
bool wheelStop;
|
||||
Render * render;
|
||||
QTimer * hideCursorTimer;
|
||||
int direction;
|
||||
bool drag;
|
||||
|
||||
//!Widgets
|
||||
QLabel *content;
|
||||
|
||||
YACReaderTranslator * translator;
|
||||
int translatorXPos;
|
||||
QPropertyAnimation * translatorAnimation;
|
||||
|
||||
int yDragOrigin;
|
||||
int xDragOrigin;
|
||||
private:
|
||||
//!Magnifying glass
|
||||
MagnifyingGlass *mglass;
|
||||
bool magnifyingGlassShowed;
|
||||
bool restoreMagnifyingGlass;
|
||||
|
||||
//! Manejadores de evento:
|
||||
void keyPressEvent(QKeyEvent * event);
|
||||
void resizeEvent(QResizeEvent * event);
|
||||
void wheelEvent(QWheelEvent * event);
|
||||
void mouseMoveEvent(QMouseEvent * event);
|
||||
|
||||
public:
|
||||
Viewer(QWidget * parent = 0);
|
||||
void toggleFullScreen();
|
||||
const QPixmap * pixmap();
|
||||
//Comic * getComic(){return comic;}
|
||||
const BookmarksDialog * getBookmarksDialog(){return bd;}
|
||||
signals:
|
||||
void backgroundChanges();
|
||||
void pageAvailable(bool);
|
||||
void pageIsBookmark(bool);
|
||||
void reset();
|
||||
};
|
||||
|
||||
#endif
|
BIN
YACReader/yacreader_es.qm
Normal file
569
YACReader/yacreader_es.ts
Normal file
@ -0,0 +1,569 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.0" language="es_ES">
|
||||
<context>
|
||||
<name>BookmarksDialog</name>
|
||||
<message>
|
||||
<location filename="bookmarks_dialog.cpp" line="25"/>
|
||||
<source>Lastest Page</source>
|
||||
<translation>Última página</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="bookmarks_dialog.cpp" line="66"/>
|
||||
<source>Close</source>
|
||||
<translation>Cerrar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="bookmarks_dialog.cpp" line="74"/>
|
||||
<source>Click on any image to go to the bookmark</source>
|
||||
<translation>Pulsa en cualquier imagen para ir al marcador</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="bookmarks_dialog.cpp" line="92"/>
|
||||
<location filename="bookmarks_dialog.cpp" line="116"/>
|
||||
<source>Loading...</source>
|
||||
<translation>Cargando...</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Comic</name>
|
||||
<message>
|
||||
<location filename="comic.cpp" line="87"/>
|
||||
<source>No images found</source>
|
||||
<translation>No se han encontrado imágenes</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="comic.cpp" line="87"/>
|
||||
<source>There are not images on the selected folder</source>
|
||||
<translation>No hay imágenes en el directorio seleccionado</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="comic.cpp" line="128"/>
|
||||
<source>File error</source>
|
||||
<translation>Error en archivo</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="comic.cpp" line="128"/>
|
||||
<source>File not found or not images in file</source>
|
||||
<translation>Archivo no encontrado o no hay imágenes en él</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="comic.cpp" line="181"/>
|
||||
<source>7z not found</source>
|
||||
<translation>7z no encontrado</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="comic.cpp" line="181"/>
|
||||
<source>7z wasn't found in your PATH.</source>
|
||||
<translation>7z no se ha encontrado en el PATH.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="comic.cpp" line="184"/>
|
||||
<source>7z crashed</source>
|
||||
<translation>7z falló</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="comic.cpp" line="184"/>
|
||||
<source>7z crashed.</source>
|
||||
<translation>7z falló.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="comic.cpp" line="187"/>
|
||||
<source>7z reading</source>
|
||||
<translation>7z leyendo</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="comic.cpp" line="187"/>
|
||||
<source>problem reading from 7z</source>
|
||||
<translation>Problema leyendo desde 7z</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="comic.cpp" line="190"/>
|
||||
<source>7z problem</source>
|
||||
<translation>7z problema</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="comic.cpp" line="190"/>
|
||||
<source>Unknown error 7z</source>
|
||||
<translation>Error desconocido 7z</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Configuration</name>
|
||||
<message>
|
||||
<location filename="configuration.cpp" line="148"/>
|
||||
<source>Saving config file....</source>
|
||||
<translation>Guardando el archivo de configuración...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="configuration.cpp" line="148"/>
|
||||
<source>There was a problem saving YACReader configuration. Please, check if you have enough permissions in the YACReader root folder.</source>
|
||||
<translation>Hubo un problema al guardar la configuración de YACReader. Por favor, comprueba si tienes suficientes permisos en el directorio raíz de YACReader.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>GoToDialog</name>
|
||||
<message>
|
||||
<location filename="goto_dialog.cpp" line="17"/>
|
||||
<source>Page : </source>
|
||||
<translation>Página :</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="goto_dialog.cpp" line="25"/>
|
||||
<source>Go To</source>
|
||||
<translation>Ir a</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="goto_dialog.cpp" line="27"/>
|
||||
<source>Cancel</source>
|
||||
<translation>Cancelar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="goto_dialog.cpp" line="41"/>
|
||||
<location filename="goto_dialog.cpp" line="69"/>
|
||||
<source>Total pages : </source>
|
||||
<translation>Páginas totales:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="goto_dialog.cpp" line="55"/>
|
||||
<source>Go to...</source>
|
||||
<translation>Ir a...</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>GoToFlow</name>
|
||||
<message>
|
||||
<location filename="goto_flow.cpp" line="40"/>
|
||||
<source>Page : </source>
|
||||
<translation>Página:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Total pages : </source>
|
||||
<translation type="obsolete">Page:</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>HelpAboutDialog</name>
|
||||
<message>
|
||||
<location filename="../common/custom_widgets.cpp" line="31"/>
|
||||
<source>About</source>
|
||||
<translation>Acerca de</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../common/custom_widgets.cpp" line="34"/>
|
||||
<source>Help</source>
|
||||
<translation>Ayuda</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MainWindowViewer</name>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="104"/>
|
||||
<source>&Open</source>
|
||||
<translation>&Abrir</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="105"/>
|
||||
<source>O</source>
|
||||
<translation>O</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="107"/>
|
||||
<source>Open a comic</source>
|
||||
<translation>Abrir cómic</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="110"/>
|
||||
<source>Open Folder</source>
|
||||
<translation>Abrir carpeta</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="111"/>
|
||||
<source>Ctrl+O</source>
|
||||
<translation>Ctrl+O</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="113"/>
|
||||
<source>Open image folder</source>
|
||||
<oldsource>Open images in a folder</oldsource>
|
||||
<translation>Abrir carpeta de imágenes</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="116"/>
|
||||
<source>Save</source>
|
||||
<translation>Guardar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="118"/>
|
||||
<location filename="main_window_viewer.cpp" line="400"/>
|
||||
<source>Save current page</source>
|
||||
<translation>Guardar la página actual</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="122"/>
|
||||
<source>Previous Comic</source>
|
||||
<translation>Cómic anterior</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="125"/>
|
||||
<source>Open previous comic</source>
|
||||
<translation>Abrir cómic anterior</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="129"/>
|
||||
<source>Next Comic</source>
|
||||
<translation>Siguiente Cómic</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="132"/>
|
||||
<source>Open next comic</source>
|
||||
<translation>Abrir siguiente cómic</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="136"/>
|
||||
<source>&Previous</source>
|
||||
<translation>A&nterior</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="139"/>
|
||||
<source>Go to previous page</source>
|
||||
<translation>Ir a la página anterior</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="143"/>
|
||||
<source>&Next</source>
|
||||
<translation>Siguie&nte</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="146"/>
|
||||
<source>Go to next page</source>
|
||||
<translation>Ir a la página siguiente</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="150"/>
|
||||
<source>Fit Width</source>
|
||||
<translation>Ajustar anchura</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="151"/>
|
||||
<source>A</source>
|
||||
<translation>A</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="156"/>
|
||||
<source>Fit image to ...</source>
|
||||
<translation>Ajustar imagen a...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="160"/>
|
||||
<source>Rotate image to the left</source>
|
||||
<translation>Rotar imagen a la izquierda</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="161"/>
|
||||
<source>L</source>
|
||||
<translation>L</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="166"/>
|
||||
<source>Rotate image to the right</source>
|
||||
<translation>Rotar imagen a la derecha</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="167"/>
|
||||
<source>R</source>
|
||||
<translation>R</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="172"/>
|
||||
<source>Double page mode</source>
|
||||
<translation>Modo a doble página</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="173"/>
|
||||
<source>Switch to double page mode</source>
|
||||
<translation>Cambiar a modo de doble página</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="174"/>
|
||||
<source>D</source>
|
||||
<translation>D</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="181"/>
|
||||
<source>Go To</source>
|
||||
<translation>Ir a</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="182"/>
|
||||
<source>G</source>
|
||||
<translation>G</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="185"/>
|
||||
<source>Go to page ...</source>
|
||||
<translation>Ir a página...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="188"/>
|
||||
<source>Options</source>
|
||||
<translation>Opciones</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="189"/>
|
||||
<source>C</source>
|
||||
<translation>C</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="190"/>
|
||||
<source>YACReader options</source>
|
||||
<translation>Opciones de YACReader</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="195"/>
|
||||
<source>Help</source>
|
||||
<translation>Ayuda</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="196"/>
|
||||
<source>Help, About YACReader</source>
|
||||
<translation>Ayuda, Sobre YACReader</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="201"/>
|
||||
<source>Magnifying glass</source>
|
||||
<translation>Lupa</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="202"/>
|
||||
<source>Switch Magnifying glass</source>
|
||||
<translation>Lupa On/Off</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="203"/>
|
||||
<source>Z</source>
|
||||
<translation>Z</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="209"/>
|
||||
<source>Set bookmark</source>
|
||||
<translation>Añadir marcador</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="210"/>
|
||||
<source>Set a bookmark on the current page</source>
|
||||
<translation>Añadir un marcador en la página actual</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="219"/>
|
||||
<source>Show bookmarks</source>
|
||||
<translation>Mostrar marcadores</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="220"/>
|
||||
<source>Show the bookmarks of the current comic</source>
|
||||
<translation>Mostrar los marcadores del cómic actual</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="221"/>
|
||||
<source>M</source>
|
||||
<translation>M</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="226"/>
|
||||
<source>Show keyboard shortcuts</source>
|
||||
<translation>Mostrar atajos de teclado</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="230"/>
|
||||
<source>Show Info</source>
|
||||
<translation>Mostrar información</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="231"/>
|
||||
<source>I</source>
|
||||
<translation>I</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="236"/>
|
||||
<source>Close</source>
|
||||
<translation>Cerrar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="241"/>
|
||||
<source>Show Dictionary</source>
|
||||
<translation>Mostrar diccionario</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="248"/>
|
||||
<source>Always on top</source>
|
||||
<translation>Siempre visible</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="256"/>
|
||||
<source>Show full size</source>
|
||||
<translation>Mostrar a tamaño original</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="267"/>
|
||||
<source>&File</source>
|
||||
<translation>&Archivo</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="362"/>
|
||||
<source>Open Comic</source>
|
||||
<translation>Abrir cómic</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="362"/>
|
||||
<source>Comic files (*.cbr *.cbz *.rar *.zip *.tar *.arj)</source>
|
||||
<translation>Archivos de cómic (*.cbr *.cbz *.rar *.zip *.tar *.arj)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="381"/>
|
||||
<source>Open folder</source>
|
||||
<translation>Abrir carpeta</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="400"/>
|
||||
<source>Image files (*.jpg)</source>
|
||||
<translation>Archivos de imagen (*.jpg)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="533"/>
|
||||
<source>There is a new version avaliable</source>
|
||||
<translation>Hay una nueva versión disponible</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="534"/>
|
||||
<source>Do you want to download the new version?</source>
|
||||
<translation>¿Desea descargar la nueva versión?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="593"/>
|
||||
<source>Saving error log file....</source>
|
||||
<translation>Guardando el archivo de log...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="593"/>
|
||||
<source>There was a problem saving YACReader error log file. Please, check if you have enough permissions in the YACReader root folder.</source>
|
||||
<translation>Hubo un problema al guardar el archivo de log de YACReader. Por favor, comprueba si tienes suficientes permisos en el directorio raíz de YACReader.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>OptionsDialog</name>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="15"/>
|
||||
<source>"Go to flow" size</source>
|
||||
<translation>Tamaño de "Go to flow"</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="26"/>
|
||||
<source>My comics path</source>
|
||||
<translation>Ruta a mis cómics</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="35"/>
|
||||
<source>Save</source>
|
||||
<translation>Guardar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="36"/>
|
||||
<source>Cancel</source>
|
||||
<translation>Cancelar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="41"/>
|
||||
<source>How to show pages in GoToFlow:</source>
|
||||
<translation>¿Cómo deseas que se muestren las páginas en "Go To Flow":</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="43"/>
|
||||
<source>CoverFlow look</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="44"/>
|
||||
<source>Stripe look</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="45"/>
|
||||
<source>Overlapped Stripe look</source>
|
||||
<oldsource>Overlaped Stripe look</oldsource>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="78"/>
|
||||
<source>Page width stretch</source>
|
||||
<translation>Ajuste en anchura de la página</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="98"/>
|
||||
<source>Background color</source>
|
||||
<translation>Color de fondo</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="101"/>
|
||||
<source>Choose</source>
|
||||
<translation>Elegir</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="108"/>
|
||||
<source>Restart is needed</source>
|
||||
<translation>Es necesario reiniciar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="134"/>
|
||||
<source>Comics directory</source>
|
||||
<translation>Directorio de cómics</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QPushButton</name>
|
||||
<message>
|
||||
<source>Hello world!</source>
|
||||
<translation type="obsolete">Hola mundo!</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ShortcutsDialog</name>
|
||||
<message>
|
||||
<location filename="shortcuts_dialog.cpp" line="15"/>
|
||||
<source>YACReader keyboard shortcuts</source>
|
||||
<translation>Atajos de teclado de YACReader</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="shortcuts_dialog.cpp" line="19"/>
|
||||
<source>Close</source>
|
||||
<translation>Cerrar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="shortcuts_dialog.cpp" line="73"/>
|
||||
<source>Keyboard Shortcuts</source>
|
||||
<translation>Atajos de teclado</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Viewer</name>
|
||||
<message>
|
||||
<location filename="viewer.cpp" line="39"/>
|
||||
<location filename="viewer.cpp" line="567"/>
|
||||
<source>Press 'O' to open comic.</source>
|
||||
<translation>Pulsa 'O' para abrir un fichero.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Info</source>
|
||||
<translation type="obsolete">Mostrar información</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>I</source>
|
||||
<translation type="obsolete">I</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="viewer.cpp" line="580"/>
|
||||
<source>Loading...please wait!</source>
|
||||
<translation>Cargando...espere, por favor!</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
548
YACReader/yacreader_fr.ts
Normal file
@ -0,0 +1,548 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.0" language="fr_FR">
|
||||
<context>
|
||||
<name>BookmarksDialog</name>
|
||||
<message>
|
||||
<location filename="bookmarks_dialog.cpp" line="25"/>
|
||||
<source>Lastest Page</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="bookmarks_dialog.cpp" line="66"/>
|
||||
<source>Close</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="bookmarks_dialog.cpp" line="74"/>
|
||||
<source>Click on any image to go to the bookmark</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="bookmarks_dialog.cpp" line="92"/>
|
||||
<location filename="bookmarks_dialog.cpp" line="116"/>
|
||||
<source>Loading...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Comic</name>
|
||||
<message>
|
||||
<location filename="comic.cpp" line="87"/>
|
||||
<source>No images found</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="comic.cpp" line="87"/>
|
||||
<source>There are not images on the selected folder</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="comic.cpp" line="128"/>
|
||||
<source>File error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="comic.cpp" line="128"/>
|
||||
<source>File not found or not images in file</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="comic.cpp" line="181"/>
|
||||
<source>7z not found</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="comic.cpp" line="181"/>
|
||||
<source>7z wasn't found in your PATH.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="comic.cpp" line="184"/>
|
||||
<source>7z crashed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="comic.cpp" line="184"/>
|
||||
<source>7z crashed.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="comic.cpp" line="187"/>
|
||||
<source>7z reading</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="comic.cpp" line="187"/>
|
||||
<source>problem reading from 7z</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="comic.cpp" line="190"/>
|
||||
<source>7z problem</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="comic.cpp" line="190"/>
|
||||
<source>Unknown error 7z</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Configuration</name>
|
||||
<message>
|
||||
<location filename="configuration.cpp" line="148"/>
|
||||
<source>Saving config file....</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="configuration.cpp" line="148"/>
|
||||
<source>There was a problem saving YACReader configuration. Please, check if you have enough permissions in the YACReader root folder.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>GoToDialog</name>
|
||||
<message>
|
||||
<location filename="goto_dialog.cpp" line="17"/>
|
||||
<source>Page : </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="goto_dialog.cpp" line="25"/>
|
||||
<source>Go To</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="goto_dialog.cpp" line="27"/>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="goto_dialog.cpp" line="41"/>
|
||||
<location filename="goto_dialog.cpp" line="69"/>
|
||||
<source>Total pages : </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="goto_dialog.cpp" line="55"/>
|
||||
<source>Go to...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>GoToFlow</name>
|
||||
<message>
|
||||
<location filename="goto_flow.cpp" line="40"/>
|
||||
<source>Page : </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>HelpAboutDialog</name>
|
||||
<message>
|
||||
<location filename="../common/custom_widgets.cpp" line="31"/>
|
||||
<source>About</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../common/custom_widgets.cpp" line="34"/>
|
||||
<source>Help</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MainWindowViewer</name>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="104"/>
|
||||
<source>&Open</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="105"/>
|
||||
<source>O</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="107"/>
|
||||
<source>Open a comic</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="110"/>
|
||||
<source>Open Folder</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="111"/>
|
||||
<source>Ctrl+O</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="113"/>
|
||||
<source>Open image folder</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="116"/>
|
||||
<source>Save</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="118"/>
|
||||
<location filename="main_window_viewer.cpp" line="400"/>
|
||||
<source>Save current page</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="122"/>
|
||||
<source>Previous Comic</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="125"/>
|
||||
<source>Open previous comic</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="129"/>
|
||||
<source>Next Comic</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="132"/>
|
||||
<source>Open next comic</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="136"/>
|
||||
<source>&Previous</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="139"/>
|
||||
<source>Go to previous page</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="143"/>
|
||||
<source>&Next</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="146"/>
|
||||
<source>Go to next page</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="150"/>
|
||||
<source>Fit Width</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="151"/>
|
||||
<source>A</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="156"/>
|
||||
<source>Fit image to ...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="160"/>
|
||||
<source>Rotate image to the left</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="161"/>
|
||||
<source>L</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="166"/>
|
||||
<source>Rotate image to the right</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="167"/>
|
||||
<source>R</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="172"/>
|
||||
<source>Double page mode</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="173"/>
|
||||
<source>Switch to double page mode</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="174"/>
|
||||
<source>D</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="181"/>
|
||||
<source>Go To</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="182"/>
|
||||
<source>G</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="185"/>
|
||||
<source>Go to page ...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="188"/>
|
||||
<source>Options</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="189"/>
|
||||
<source>C</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="190"/>
|
||||
<source>YACReader options</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="195"/>
|
||||
<source>Help</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="196"/>
|
||||
<source>Help, About YACReader</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="201"/>
|
||||
<source>Magnifying glass</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="202"/>
|
||||
<source>Switch Magnifying glass</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="203"/>
|
||||
<source>Z</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="209"/>
|
||||
<source>Set bookmark</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="210"/>
|
||||
<source>Set a bookmark on the current page</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="219"/>
|
||||
<source>Show bookmarks</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="220"/>
|
||||
<source>Show the bookmarks of the current comic</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="221"/>
|
||||
<source>M</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="226"/>
|
||||
<source>Show keyboard shortcuts</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="230"/>
|
||||
<source>Show Info</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="231"/>
|
||||
<source>I</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="236"/>
|
||||
<source>Close</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="241"/>
|
||||
<source>Show Dictionary</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="248"/>
|
||||
<source>Always on top</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="256"/>
|
||||
<source>Show full size</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="267"/>
|
||||
<source>&File</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="362"/>
|
||||
<source>Open Comic</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="362"/>
|
||||
<source>Comic files (*.cbr *.cbz *.rar *.zip *.tar *.arj)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="381"/>
|
||||
<source>Open folder</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="400"/>
|
||||
<source>Image files (*.jpg)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="533"/>
|
||||
<source>There is a new version avaliable</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="534"/>
|
||||
<source>Do you want to download the new version?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="593"/>
|
||||
<source>Saving error log file....</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="main_window_viewer.cpp" line="593"/>
|
||||
<source>There was a problem saving YACReader error log file. Please, check if you have enough permissions in the YACReader root folder.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>OptionsDialog</name>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="15"/>
|
||||
<source>"Go to flow" size</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="26"/>
|
||||
<source>My comics path</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="35"/>
|
||||
<source>Save</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="36"/>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="41"/>
|
||||
<source>How to show pages in GoToFlow:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="43"/>
|
||||
<source>CoverFlow look</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="44"/>
|
||||
<source>Stripe look</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="45"/>
|
||||
<source>Overlapped Stripe look</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="78"/>
|
||||
<source>Page width stretch</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="98"/>
|
||||
<source>Background color</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="101"/>
|
||||
<source>Choose</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="108"/>
|
||||
<source>Restart is needed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="134"/>
|
||||
<source>Comics directory</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ShortcutsDialog</name>
|
||||
<message>
|
||||
<location filename="shortcuts_dialog.cpp" line="15"/>
|
||||
<source>YACReader keyboard shortcuts</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="shortcuts_dialog.cpp" line="19"/>
|
||||
<source>Close</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="shortcuts_dialog.cpp" line="73"/>
|
||||
<source>Keyboard Shortcuts</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Viewer</name>
|
||||
<message>
|
||||
<location filename="viewer.cpp" line="39"/>
|
||||
<location filename="viewer.cpp" line="567"/>
|
||||
<source>Press 'O' to open comic.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="viewer.cpp" line="580"/>
|
||||
<source>Loading...please wait!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
54
YACReaderLibrary/YACReaderLibrary.pro
Normal file
@ -0,0 +1,54 @@
|
||||
######################################################################
|
||||
# Automatically generated by qmake (2.01a) dom 12. oct 20:47:48 2008
|
||||
######################################################################
|
||||
|
||||
TEMPLATE = app
|
||||
TARGET =
|
||||
DEPENDPATH += .
|
||||
INCLUDEPATH += .
|
||||
INCLUDEPATH += ../common
|
||||
CONFIG += release
|
||||
CONFIG -= flat
|
||||
QT += sql
|
||||
|
||||
# Input
|
||||
HEADERS += comic_flow.h \
|
||||
create_library_dialog.h \
|
||||
library_creator.h \
|
||||
library_window.h \
|
||||
../common/pictureflow.h \
|
||||
add_library_dialog.h \
|
||||
../common/custom_widgets.h \
|
||||
rename_library_dialog.h \
|
||||
properties_dialog.h \
|
||||
options_dialog.h \
|
||||
export_library_dialog.h \
|
||||
import_library_dialog.h \
|
||||
package_manager.h \
|
||||
../common/qnaturalsorting.h \
|
||||
data_base_management.h \
|
||||
bundle_creator.h
|
||||
SOURCES += comic_flow.cpp \
|
||||
create_library_dialog.cpp \
|
||||
library_creator.cpp \
|
||||
library_window.cpp \
|
||||
main.cpp \
|
||||
../common/pictureflow.cpp \
|
||||
add_library_dialog.cpp \
|
||||
../common/custom_widgets.cpp \
|
||||
rename_library_dialog.cpp \
|
||||
properties_dialog.cpp \
|
||||
options_dialog.cpp \
|
||||
export_library_dialog.cpp \
|
||||
import_library_dialog.cpp \
|
||||
package_manager.cpp \
|
||||
../common/qnaturalsorting.cpp \
|
||||
data_base_management.cpp \
|
||||
bundle_creator.cpp
|
||||
RESOURCES += images.qrc files.qrc
|
||||
RC_FILE = icon.rc
|
||||
|
||||
TRANSLATIONS = yacreaderlibrary_es.ts
|
||||
|
||||
Release:DESTDIR = ../release
|
||||
Debug:DESTDIR = ../debug
|
95
YACReaderLibrary/add_library_dialog.cpp
Normal file
@ -0,0 +1,95 @@
|
||||
#include "add_library_dialog.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QFileDialog>
|
||||
|
||||
|
||||
|
||||
AddLibraryDialog::AddLibraryDialog(QWidget * parent)
|
||||
:QDialog(parent)
|
||||
{
|
||||
setupUI();
|
||||
}
|
||||
|
||||
void AddLibraryDialog::setupUI()
|
||||
{
|
||||
textLabel = new QLabel(tr("Comics folder : "));
|
||||
path = new QLineEdit;
|
||||
textLabel->setBuddy(path);
|
||||
|
||||
nameLabel = new QLabel(tr("Library Name : "));
|
||||
nameEdit = new QLineEdit;
|
||||
nameLabel->setBuddy(nameEdit);
|
||||
|
||||
accept = new QPushButton(tr("Add"));
|
||||
accept->setDisabled(true);
|
||||
connect(accept,SIGNAL(clicked()),this,SLOT(add()));
|
||||
|
||||
cancel = new QPushButton(tr("Cancel"));
|
||||
connect(cancel,SIGNAL(clicked()),this,SLOT(close()));
|
||||
|
||||
find = new QPushButton(QIcon(":/images/comicFolder.png"),"");
|
||||
connect(find,SIGNAL(clicked()),this,SLOT(findPath()));
|
||||
|
||||
QHBoxLayout *nameLayout = new QHBoxLayout;
|
||||
|
||||
nameLayout->addWidget(nameLabel);
|
||||
nameLayout->addWidget(nameEdit);
|
||||
|
||||
QHBoxLayout *libraryLayout = new QHBoxLayout;
|
||||
|
||||
libraryLayout->addWidget(textLabel);
|
||||
libraryLayout->addWidget(path);
|
||||
libraryLayout->addWidget(find);
|
||||
libraryLayout->setStretchFactor(find,0); //TODO
|
||||
|
||||
|
||||
QHBoxLayout *bottomLayout = new QHBoxLayout;
|
||||
bottomLayout->addStretch();
|
||||
bottomLayout->addWidget(accept);
|
||||
bottomLayout->addWidget(cancel);
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
mainLayout->addLayout(nameLayout);
|
||||
mainLayout->addLayout(libraryLayout);
|
||||
mainLayout->addStretch();
|
||||
mainLayout->addLayout(bottomLayout);
|
||||
|
||||
QHBoxLayout * imgMainLayout = new QHBoxLayout;
|
||||
QLabel * imgLabel = new QLabel(this);
|
||||
QPixmap p(":/images/openLibrary.png");
|
||||
imgLabel->setPixmap(p);
|
||||
imgMainLayout->addWidget(imgLabel);
|
||||
imgMainLayout->addLayout(mainLayout);
|
||||
|
||||
setLayout(imgMainLayout);
|
||||
|
||||
setModal(true);
|
||||
setWindowTitle(tr("Add an existing library"));
|
||||
}
|
||||
|
||||
void AddLibraryDialog::add()
|
||||
{
|
||||
//accept->setEnabled(false);
|
||||
emit(addLibrary(QDir::cleanPath(path->text()),nameEdit->text()));
|
||||
close();
|
||||
}
|
||||
|
||||
void AddLibraryDialog::findPath()
|
||||
{
|
||||
QString s = QFileDialog::getExistingDirectory(0,"Comics directory",".");
|
||||
if(!s.isEmpty())
|
||||
{
|
||||
path->setText(s);
|
||||
accept->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void AddLibraryDialog::close()
|
||||
{
|
||||
path->clear();
|
||||
nameEdit->clear();
|
||||
accept->setEnabled(false);
|
||||
QDialog::close();
|
||||
}
|
33
YACReaderLibrary/add_library_dialog.h
Normal file
@ -0,0 +1,33 @@
|
||||
#ifndef __ADD_LIBRARY_DIALOG_H
|
||||
#define __ADD_LIBRARY_DIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QThread>
|
||||
|
||||
class AddLibraryDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AddLibraryDialog(QWidget * parent = 0);
|
||||
private:
|
||||
QLabel * nameLabel;
|
||||
QLabel * textLabel;
|
||||
QLineEdit * path;
|
||||
QLineEdit * nameEdit;
|
||||
QPushButton * find;
|
||||
QPushButton * accept;
|
||||
QPushButton * cancel;
|
||||
void setupUI();
|
||||
public slots:
|
||||
void add();
|
||||
void findPath();
|
||||
void close();
|
||||
signals:
|
||||
void addLibrary(QString target, QString name);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
266
YACReaderLibrary/comic_flow.cpp
Normal file
@ -0,0 +1,266 @@
|
||||
#include "comic_flow.h"
|
||||
#include "qnaturalsorting.h"
|
||||
|
||||
#include <QMutex>
|
||||
#include <QImageReader>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ComicFlow::ComicFlow(QWidget* parent,FlowType flowType)
|
||||
:YACReaderFlow(parent,flowType)
|
||||
{
|
||||
updateTimer = new QTimer;
|
||||
connect(updateTimer, SIGNAL(timeout()), this, SLOT(updateImageData()));
|
||||
|
||||
worker = new ImageLoader;
|
||||
connect(this, SIGNAL(centerIndexChanged(int)), this, SLOT(preload()));
|
||||
|
||||
setReflectionEffect(PlainReflection);
|
||||
}
|
||||
|
||||
ComicFlow::~ComicFlow()
|
||||
{
|
||||
delete worker;
|
||||
delete updateTimer;
|
||||
}
|
||||
|
||||
QString ComicFlow::getImagePath() const
|
||||
{
|
||||
return imagePath;
|
||||
}
|
||||
|
||||
QStringList ComicFlow::getImageFiles() const
|
||||
{
|
||||
return imageFiles;
|
||||
}
|
||||
|
||||
// get list of all files in a directory (will be filtered later)
|
||||
// this is usually very fast so no need to put it in a separate thread
|
||||
static QStringList findFiles(const QString& path = QString())
|
||||
{
|
||||
//list<QString> files;
|
||||
QStringList files;
|
||||
|
||||
QDir dir = QDir::current();
|
||||
if(!path.isEmpty())
|
||||
dir = QDir(path);
|
||||
|
||||
dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
|
||||
dir.setNameFilters(QStringList() << "*.jpg");
|
||||
//dir.setSorting(QDir::Name|QDir::IgnoreCase|QDir::LocaleAware);
|
||||
QFileInfoList list = dir.entryInfoList();
|
||||
|
||||
qSort(list.begin(),list.end(),naturalSortLessThanCIFileInfo);
|
||||
|
||||
for (int i = 0; i < list.size(); ++i)
|
||||
{
|
||||
QFileInfo fileInfo = list.at(i);
|
||||
files.append(dir.absoluteFilePath(fileInfo.fileName()));
|
||||
}
|
||||
|
||||
//std::sort(files.begin(), files.end(), naturalSortLessThanCI);
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
// take only files which are readable (as images)
|
||||
// also seems to be fast as it does a quick check only
|
||||
static QStringList filterImages(const QStringList& files)
|
||||
{
|
||||
QStringList imageFiles;
|
||||
|
||||
QImageReader reader;
|
||||
foreach(QString fname, files)
|
||||
{
|
||||
reader.setFileName(fname);
|
||||
if(reader.canRead())
|
||||
imageFiles += fname;
|
||||
}
|
||||
|
||||
return imageFiles;
|
||||
}
|
||||
|
||||
void ComicFlow::setImagePath(const QString& path)
|
||||
{
|
||||
clear();
|
||||
|
||||
imagePath = path;
|
||||
imageFiles = findFiles(path);
|
||||
imagesLoaded.clear();
|
||||
imagesLoaded.fill(false,imageFiles.size());
|
||||
numImagesLoaded = 0;
|
||||
|
||||
imagesSetted.clear();
|
||||
imagesSetted.fill(false,imageFiles.size());
|
||||
|
||||
// populate with empty images
|
||||
QImage img; //TODO remove
|
||||
QString s;
|
||||
for(int i = 0; i < (int)imageFiles.size(); i++)
|
||||
{
|
||||
addSlide(img);
|
||||
s = imageFiles.at(i);
|
||||
s.remove(s.size()-4,4);
|
||||
if(QFileInfo(s+".r").exists())
|
||||
markSlide(i);
|
||||
}
|
||||
|
||||
setCenterIndex(0);
|
||||
worker->reset();
|
||||
preload();
|
||||
}
|
||||
|
||||
void ComicFlow::preload()
|
||||
{
|
||||
if(numImagesLoaded < imagesLoaded.size())
|
||||
updateTimer->start(70);
|
||||
}
|
||||
|
||||
void ComicFlow::updateImageData()
|
||||
{
|
||||
// can't do anything, wait for the next possibility
|
||||
if(worker->busy())
|
||||
return;
|
||||
|
||||
// set image of last one
|
||||
int idx = worker->index();
|
||||
if( idx >= 0 && !worker->result().isNull())
|
||||
{
|
||||
if(!imagesSetted[idx])
|
||||
{
|
||||
setSlide(idx, worker->result());
|
||||
imagesSetted[idx] = true;
|
||||
numImagesLoaded++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// try to load only few images on the left and right side
|
||||
// i.e. all visible ones plus some extra
|
||||
#define COUNT 8
|
||||
int indexes[2*COUNT+1];
|
||||
int center = centerIndex();
|
||||
indexes[0] = center;
|
||||
for(int j = 0; j < COUNT; j++)
|
||||
{
|
||||
indexes[j*2+1] = center+j+1;
|
||||
indexes[j*2+2] = center-j-1;
|
||||
}
|
||||
for(int c = 0; c < 2*COUNT+1; c++)
|
||||
{
|
||||
int i = indexes[c];
|
||||
if((i >= 0) && (i < slideCount()))
|
||||
if(!imagesLoaded[i])//slide(i).isNull())
|
||||
{
|
||||
// schedule thumbnail generation
|
||||
QString fname = imageFiles[i];
|
||||
imagesLoaded[i]=true;
|
||||
|
||||
worker->generate(i, fname, slideSize());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// no need to generate anything? stop polling...
|
||||
updateTimer->stop();
|
||||
}
|
||||
|
||||
void ComicFlow::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
PictureFlow::keyPressEvent(event);
|
||||
}
|
||||
|
||||
void ComicFlow::wheelEvent(QWheelEvent * event)
|
||||
{
|
||||
if(event->delta()<0)
|
||||
showNext();
|
||||
else
|
||||
showPrevious();
|
||||
event->accept();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//ImageLoader
|
||||
//-----------------------------------------------------------------------------
|
||||
static QImage loadImage(const QString& fileName)
|
||||
{
|
||||
QImage image;
|
||||
bool result = image.load(fileName);
|
||||
|
||||
if(!result)
|
||||
return QImage();
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
ImageLoader::ImageLoader():
|
||||
QThread(), restart(false), working(false), idx(-1)
|
||||
{
|
||||
}
|
||||
|
||||
ImageLoader::~ImageLoader()
|
||||
{
|
||||
mutex.lock();
|
||||
condition.wakeOne();
|
||||
mutex.unlock();
|
||||
wait();
|
||||
}
|
||||
|
||||
bool ImageLoader::busy() const
|
||||
{
|
||||
return isRunning() ? working : false;
|
||||
}
|
||||
|
||||
void ImageLoader::generate(int index, const QString& fileName, QSize size)
|
||||
{
|
||||
mutex.lock();
|
||||
this->idx = index;
|
||||
this->fileName = fileName;
|
||||
this->size = size;
|
||||
this->img = QImage();
|
||||
mutex.unlock();
|
||||
|
||||
if (!isRunning())
|
||||
start();
|
||||
else
|
||||
{
|
||||
// already running, wake up whenever ready
|
||||
restart = true;
|
||||
condition.wakeOne();
|
||||
}
|
||||
}
|
||||
|
||||
void ImageLoader::run()
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
// copy necessary data
|
||||
mutex.lock();
|
||||
this->working = true;
|
||||
QString fileName = this->fileName;
|
||||
mutex.unlock();
|
||||
|
||||
QImage image = loadImage(fileName);
|
||||
|
||||
// let everyone knows it is ready
|
||||
mutex.lock();
|
||||
this->working = false;
|
||||
this->img = image;
|
||||
mutex.unlock();
|
||||
|
||||
// put to sleep
|
||||
mutex.lock();
|
||||
if (!this->restart)
|
||||
condition.wait(&mutex);
|
||||
restart = false;
|
||||
mutex.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
QImage ImageLoader::result()
|
||||
{
|
||||
return img;
|
||||
}
|
76
YACReaderLibrary/comic_flow.h
Normal file
@ -0,0 +1,76 @@
|
||||
#ifndef __COMICFLOW_H
|
||||
#define __COMICFLOW_H
|
||||
|
||||
#include "custom_widgets.h"
|
||||
#include <QtCore>
|
||||
#include <QObject>
|
||||
#include <QThread>
|
||||
#include <QImage>
|
||||
#include <QMutex>
|
||||
#include <QWaitCondition>
|
||||
#include <QString>
|
||||
#include <QWheelEvent>
|
||||
|
||||
class ImageLoader;
|
||||
class ComicFlow : public YACReaderFlow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ComicFlow(QWidget* parent = 0,FlowType flowType = CoverFlowLike);
|
||||
virtual ~ComicFlow();
|
||||
|
||||
//void render();
|
||||
QString getImagePath() const;
|
||||
QStringList getImageFiles() const;
|
||||
void setImagePath(const QString& path);
|
||||
//bool eventFilter(QObject *target, QEvent *event);
|
||||
void keyPressEvent(QKeyEvent* event);
|
||||
|
||||
private slots:
|
||||
void preload();
|
||||
void updateImageData();
|
||||
|
||||
private:
|
||||
QString imagePath;
|
||||
QStringList imageFiles;
|
||||
QVector<bool> imagesLoaded;
|
||||
QVector<bool> imagesSetted;
|
||||
uint numImagesLoaded;
|
||||
QTimer* updateTimer;
|
||||
ImageLoader* worker;
|
||||
virtual void wheelEvent(QWheelEvent * event);
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Source code of ImageLoader class was modified from http://code.google.com/p/photoflow/
|
||||
//------------------------------------------------------------------------------
|
||||
class ImageLoader : public QThread
|
||||
{
|
||||
public:
|
||||
ImageLoader();
|
||||
~ImageLoader();
|
||||
// returns FALSE if worker is still busy and can't take the task
|
||||
bool busy() const;
|
||||
void generate(int index, const QString& fileName, QSize size);
|
||||
void reset(){idx = -1;};
|
||||
int index() const { return idx; };
|
||||
QImage result();
|
||||
|
||||
protected:
|
||||
void run();
|
||||
|
||||
private:
|
||||
QMutex mutex;
|
||||
QWaitCondition condition;
|
||||
|
||||
bool restart;
|
||||
bool working;
|
||||
int idx;
|
||||
QString fileName;
|
||||
QSize size;
|
||||
QImage img;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
154
YACReaderLibrary/create_library_dialog.cpp
Normal file
@ -0,0 +1,154 @@
|
||||
#include "create_library_dialog.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QFileDialog>
|
||||
|
||||
|
||||
|
||||
CreateLibraryDialog::CreateLibraryDialog(QWidget * parent)
|
||||
:QDialog(parent)
|
||||
{
|
||||
setupUI();
|
||||
}
|
||||
|
||||
void CreateLibraryDialog::setupUI()
|
||||
{
|
||||
textLabel = new QLabel(tr("Comics folder : "));
|
||||
path = new QLineEdit;
|
||||
textLabel->setBuddy(path);
|
||||
|
||||
nameLabel = new QLabel(tr("Library Name : "));
|
||||
nameEdit = new QLineEdit;
|
||||
nameLabel->setBuddy(nameEdit);
|
||||
|
||||
accept = new QPushButton(tr("Create"));
|
||||
accept->setDisabled(true);
|
||||
connect(accept,SIGNAL(clicked()),this,SLOT(create()));
|
||||
|
||||
cancel = new QPushButton(tr("Cancel"));
|
||||
connect(cancel,SIGNAL(clicked()),this,SIGNAL(cancelCreate()));
|
||||
connect(cancel,SIGNAL(clicked()),this,SLOT(close()));
|
||||
|
||||
find = new QPushButton(QIcon(":/images/comicFolder.png"),"");
|
||||
connect(find,SIGNAL(clicked()),this,SLOT(findPath()));
|
||||
|
||||
QHBoxLayout *nameLayout = new QHBoxLayout;
|
||||
|
||||
nameLayout->addWidget(nameLabel);
|
||||
nameLayout->addWidget(nameEdit);
|
||||
|
||||
QHBoxLayout *libraryLayout = new QHBoxLayout;
|
||||
|
||||
libraryLayout->addWidget(textLabel);
|
||||
libraryLayout->addWidget(path);
|
||||
libraryLayout->addWidget(find);
|
||||
libraryLayout->setStretchFactor(find,0); //TODO
|
||||
|
||||
QHBoxLayout *middleLayout = new QHBoxLayout;
|
||||
|
||||
processLabel = new QLabel("Procesing : ");
|
||||
currentFileLabel = new QLabel("");
|
||||
middleLayout->addWidget(processLabel);
|
||||
middleLayout->addWidget(currentFileLabel);
|
||||
middleLayout->addStretch();
|
||||
|
||||
QHBoxLayout *bottomLayout = new QHBoxLayout;
|
||||
bottomLayout->addStretch();
|
||||
bottomLayout->addWidget(accept);
|
||||
bottomLayout->addWidget(cancel);
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
mainLayout->addLayout(nameLayout);
|
||||
mainLayout->addLayout(libraryLayout);
|
||||
mainLayout->addLayout(middleLayout);
|
||||
mainLayout->addStretch();
|
||||
mainLayout->addLayout(bottomLayout);
|
||||
|
||||
QHBoxLayout * imgMainLayout = new QHBoxLayout;
|
||||
QLabel * imgLabel = new QLabel(this);
|
||||
QPixmap p(":/images/new.png");
|
||||
imgLabel->setPixmap(p);
|
||||
imgMainLayout->addWidget(imgLabel);
|
||||
imgMainLayout->addLayout(mainLayout);
|
||||
|
||||
setLayout(imgMainLayout);
|
||||
|
||||
setModal(true);
|
||||
setWindowTitle(tr("Create new library"));
|
||||
}
|
||||
|
||||
void CreateLibraryDialog::create()
|
||||
{
|
||||
accept->setEnabled(false);
|
||||
emit(createLibrary(QDir::cleanPath(path->text()),QDir::cleanPath(path->text())+"/.yacreaderlibrary",nameEdit->text()));
|
||||
}
|
||||
|
||||
void CreateLibraryDialog::findPath()
|
||||
{
|
||||
QString s = QFileDialog::getExistingDirectory(0,"Comics directory",".");
|
||||
if(!s.isEmpty())
|
||||
{
|
||||
path->setText(s);
|
||||
accept->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void CreateLibraryDialog::showCurrentFile(QString file)
|
||||
{
|
||||
currentFileLabel->setText(file);
|
||||
currentFileLabel->update();
|
||||
this->update();
|
||||
}
|
||||
void CreateLibraryDialog::close()
|
||||
{
|
||||
path->clear();
|
||||
nameEdit->clear();
|
||||
currentFileLabel->setText("");
|
||||
accept->setEnabled(true);
|
||||
QDialog::close();
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
// UpdateLibraryDialog
|
||||
//-----------------------------------------------------------------------------
|
||||
UpdateLibraryDialog::UpdateLibraryDialog(QWidget * parent)
|
||||
:QDialog(parent)
|
||||
{
|
||||
QVBoxLayout * mainLayout = new QVBoxLayout;
|
||||
mainLayout->addWidget(message = new QLabel(tr("Updating....")));
|
||||
mainLayout->addWidget(currentFileLabel = new QLabel(""));
|
||||
|
||||
QHBoxLayout * bottom = new QHBoxLayout;
|
||||
bottom->addStretch();
|
||||
bottom->addWidget(cancel = new QPushButton(tr("Cancel")));
|
||||
|
||||
connect(cancel,SIGNAL(clicked()),this,SIGNAL(cancelUpdate()));
|
||||
connect(cancel,SIGNAL(clicked()),this,SLOT(close()));
|
||||
|
||||
mainLayout->addStretch();
|
||||
mainLayout->addLayout(bottom);
|
||||
|
||||
QHBoxLayout * imgMainLayout = new QHBoxLayout;
|
||||
QLabel * imgLabel = new QLabel(this);
|
||||
QPixmap p(":/images/updateLibrary.png");
|
||||
imgLabel->setPixmap(p);
|
||||
imgMainLayout->addWidget(imgLabel);
|
||||
imgMainLayout->addLayout(mainLayout);
|
||||
|
||||
setLayout(imgMainLayout);
|
||||
|
||||
setModal(true);
|
||||
}
|
||||
|
||||
void UpdateLibraryDialog::showCurrentFile(QString file)
|
||||
{
|
||||
currentFileLabel->setText(file);
|
||||
currentFileLabel->update();
|
||||
this->update();
|
||||
}
|
||||
|
||||
void UpdateLibraryDialog::close()
|
||||
{
|
||||
currentFileLabel->setText("");
|
||||
QDialog::close();
|
||||
}
|
52
YACReaderLibrary/create_library_dialog.h
Normal file
@ -0,0 +1,52 @@
|
||||
#ifndef __CREATE_LIBRARY_DIALOG_H
|
||||
#define __CREATE_LIBRARY_DIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QThread>
|
||||
|
||||
class CreateLibraryDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CreateLibraryDialog(QWidget * parent = 0);
|
||||
private:
|
||||
QLabel * nameLabel;
|
||||
QLabel * textLabel;
|
||||
QLabel * processLabel;
|
||||
QLabel * currentFileLabel;
|
||||
QLineEdit * path;
|
||||
QLineEdit * nameEdit;
|
||||
QPushButton * find;
|
||||
QPushButton * accept;
|
||||
QPushButton * cancel;
|
||||
void setupUI();
|
||||
public slots:
|
||||
void create();
|
||||
void findPath();
|
||||
void showCurrentFile(QString file);
|
||||
void close();
|
||||
signals:
|
||||
void createLibrary(QString source, QString target, QString name);
|
||||
void cancelCreate();
|
||||
};
|
||||
|
||||
class UpdateLibraryDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
UpdateLibraryDialog(QWidget * parent = 0);
|
||||
private:
|
||||
QLabel * message;
|
||||
QLabel * currentFileLabel;
|
||||
QPushButton * cancel;
|
||||
public slots:
|
||||
void showCurrentFile(QString file);
|
||||
void close();
|
||||
signals:
|
||||
void cancelUpdate();
|
||||
};
|
||||
|
||||
#endif
|
22
YACReaderLibrary/data_base_management.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include "data_base_management.h"
|
||||
|
||||
#include <QtCore>
|
||||
|
||||
DataBaseManagement::DataBaseManagement()
|
||||
:QObject(),dataBasesList()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool DataBaseManagement::createDataBase(QString name, QString path)
|
||||
{
|
||||
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
|
||||
db.setDatabaseName(name + ".ydb");
|
||||
if (!db.open())
|
||||
qDebug() << db.lastError();
|
||||
else {
|
||||
qDebug() << db.tables();
|
||||
db.close();
|
||||
}
|
||||
return true;
|
||||
}
|
18
YACReaderLibrary/data_base_management.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef __DATA_BASE_MANAGEMENT_H
|
||||
#define __DATA_BASE_MANAGEMENT_H
|
||||
|
||||
#include <QtCore>
|
||||
#include <QtSql>
|
||||
|
||||
class DataBaseManagement : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
QList<QString> dataBasesList;
|
||||
public:
|
||||
DataBaseManagement();
|
||||
bool createDataBase(QString name, QString path);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
100
YACReaderLibrary/export_library_dialog.cpp
Normal file
@ -0,0 +1,100 @@
|
||||
#include "export_library_dialog.h"
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QFileDialog>
|
||||
#include <QDir>
|
||||
|
||||
ExportLibraryDialog::ExportLibraryDialog(QWidget * parent)
|
||||
:QDialog(parent),progressCount(0)
|
||||
{
|
||||
textLabel = new QLabel(tr("Output folder : "));
|
||||
path = new QLineEdit;
|
||||
textLabel->setBuddy(path);
|
||||
|
||||
accept = new QPushButton(tr("Create"));
|
||||
accept->setDisabled(true);
|
||||
connect(accept,SIGNAL(clicked()),this,SLOT(exportLibrary()));
|
||||
|
||||
cancel = new QPushButton(tr("Cancel"));
|
||||
connect(cancel,SIGNAL(clicked()),this,SLOT(close()));
|
||||
connect(cancel,SIGNAL(clicked()),this,SIGNAL(rejected()));
|
||||
|
||||
find = new QPushButton(QIcon(":/images/comicFolder.png"),"");
|
||||
connect(find,SIGNAL(clicked()),this,SLOT(findPath()));
|
||||
|
||||
QHBoxLayout *libraryLayout = new QHBoxLayout;
|
||||
|
||||
libraryLayout->addWidget(textLabel);
|
||||
libraryLayout->addWidget(path);
|
||||
libraryLayout->addWidget(find);
|
||||
libraryLayout->setStretchFactor(find,0); //TODO
|
||||
|
||||
QHBoxLayout *bottomLayout = new QHBoxLayout;
|
||||
bottomLayout->addStretch();
|
||||
bottomLayout->addWidget(accept);
|
||||
bottomLayout->addWidget(cancel);
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
mainLayout->addLayout(libraryLayout);
|
||||
mainLayout->addWidget(progress=new QLabel());
|
||||
mainLayout->addStretch();
|
||||
mainLayout->addLayout(bottomLayout);
|
||||
|
||||
QHBoxLayout * imgMainLayout = new QHBoxLayout;
|
||||
QLabel * imgLabel = new QLabel(this);
|
||||
QPixmap p(":/images/exportLibrary.png");
|
||||
imgLabel->setPixmap(p);
|
||||
imgMainLayout->addWidget(imgLabel);
|
||||
imgMainLayout->addLayout(mainLayout);
|
||||
|
||||
setLayout(imgMainLayout);
|
||||
|
||||
setModal(true);
|
||||
setWindowTitle(tr("Create covers package"));
|
||||
t.setInterval(500);
|
||||
connect(&t,SIGNAL(timeout()),this,SLOT(updateProgress()));
|
||||
}
|
||||
|
||||
void ExportLibraryDialog::exportLibrary()
|
||||
{
|
||||
accept->setEnabled(false);
|
||||
emit exportPath(QDir::cleanPath(path->text()));
|
||||
t.start();
|
||||
}
|
||||
|
||||
void ExportLibraryDialog::findPath()
|
||||
{
|
||||
QString s = QFileDialog::getExistingDirectory(0,tr("Destination directory"),".");
|
||||
if(!s.isEmpty())
|
||||
{
|
||||
path->setText(s);
|
||||
accept->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void ExportLibraryDialog::close()
|
||||
{
|
||||
path->clear();
|
||||
accept->setEnabled(false);
|
||||
t.stop();
|
||||
progressCount=0;
|
||||
progress->setText("");
|
||||
QDialog::close();
|
||||
}
|
||||
|
||||
void ExportLibraryDialog::run()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ExportLibraryDialog::updateProgress()
|
||||
{
|
||||
if(progressCount == 0)
|
||||
progress->setText(tr("Creating package ."));
|
||||
else
|
||||
progress->setText(progress->text()+" .");
|
||||
progressCount++;
|
||||
if(progressCount == 15)
|
||||
progressCount = 0;
|
||||
|
||||
}
|
36
YACReaderLibrary/export_library_dialog.h
Normal file
@ -0,0 +1,36 @@
|
||||
#ifndef EXPORT_LIBRARY_DIALOG_H
|
||||
#define EXPORT_LIBRARY_DIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QString>
|
||||
#include <QThread>
|
||||
#include <QTimer>
|
||||
|
||||
class ExportLibraryDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ExportLibraryDialog(QWidget * parent = 0);
|
||||
public slots:
|
||||
void exportLibrary();
|
||||
void findPath();
|
||||
void close();
|
||||
void updateProgress();
|
||||
private:
|
||||
int progressCount;
|
||||
QLabel * progress;
|
||||
QLabel * textLabel;
|
||||
QLineEdit * path;
|
||||
QPushButton * find;
|
||||
QPushButton * accept;
|
||||
QPushButton * cancel;
|
||||
void run();
|
||||
QTimer t;
|
||||
signals:
|
||||
void exportPath(QString);
|
||||
};
|
||||
|
||||
#endif
|
13
YACReaderLibrary/files.qrc
Normal file
@ -0,0 +1,13 @@
|
||||
<RCC>
|
||||
<qresource>
|
||||
<file>../files/about.html</file>
|
||||
<file>../files/helpYACReaderLibrary.html</file>
|
||||
<file>./yacreaderlibrary_es.qm</file>
|
||||
</qresource>
|
||||
|
||||
<qresource lang="es_ES">
|
||||
<file alias="/files/about.html">../files/about_es_ES.html</file>
|
||||
<file alias="/files/helpYACReaderLibrary.html">../files/helpYACReaderLibrary_es_ES.html</file>
|
||||
</qresource>
|
||||
|
||||
</RCC>
|
BIN
YACReaderLibrary/icon.ico
Normal file
After Width: | Height: | Size: 97 KiB |
2
YACReaderLibrary/icon.rc
Normal file
@ -0,0 +1,2 @@
|
||||
IDI_ICON1 ICON DISCARDABLE "icon.ico"
|
||||
IDI_ICON2 ICON DISCARDABLE "icon2.ico"
|
BIN
YACReaderLibrary/icon2.ico
Normal file
After Width: | Height: | Size: 97 KiB |
33
YACReaderLibrary/images.qrc
Normal file
@ -0,0 +1,33 @@
|
||||
<RCC>
|
||||
<qresource prefix="/" >
|
||||
<file>../images/deleteLibrary.png</file>
|
||||
<file>../images/folder.png</file>
|
||||
<file>../images/help.png</file>
|
||||
<file>../images/icon.png</file>
|
||||
<file>../images/new.png</file>
|
||||
<file>../images/openLibrary.png</file>
|
||||
<file>../images/removeLibrary.png</file>
|
||||
<file>../images/updateLibrary.png</file>
|
||||
<file>../images/setRoot.png</file>
|
||||
<file>../images/expand.png</file>
|
||||
<file>../images/colapse.png</file>
|
||||
<file>../images/comicFolder.png</file>
|
||||
<file>../images/notCover.png</file>
|
||||
<file>../images/edit.png</file>
|
||||
<file>../images/fit.png</file>
|
||||
<file>../images/properties.png</file>
|
||||
<file>../images/options.png</file>
|
||||
<file>../images/flow1.png</file>
|
||||
<file>../images/flow2.png</file>
|
||||
<file>../images/flow3.png</file>
|
||||
<file>../images/importLibrary.png</file>
|
||||
<file>../images/exportLibrary.png</file>
|
||||
<file>../images/open.png</file>
|
||||
<file>../images/coversPackage.png</file>
|
||||
<file>../images/setRead.png</file>
|
||||
<file>../images/setAllRead.png</file>
|
||||
<file>../images/setUnread.png</file>
|
||||
<file>../images/setAllUnread.png</file>
|
||||
<file>../images/showMarks.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
164
YACReaderLibrary/import_library_dialog.cpp
Normal file
@ -0,0 +1,164 @@
|
||||
#include "import_library_dialog.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QFileDialog>
|
||||
|
||||
|
||||
|
||||
ImportLibraryDialog::ImportLibraryDialog(QWidget * parent)
|
||||
:QDialog(parent),progressCount(0)
|
||||
{
|
||||
setupUI();
|
||||
}
|
||||
|
||||
void ImportLibraryDialog::setupUI()
|
||||
{
|
||||
nameLabel = new QLabel(tr("Library Name : "));
|
||||
nameEdit = new QLineEdit;
|
||||
nameLabel->setBuddy(nameEdit);
|
||||
connect(nameEdit,SIGNAL(textChanged(QString)),this,SLOT(nameEntered()));
|
||||
|
||||
textLabel = new QLabel(tr("Package location : "));
|
||||
path = new QLineEdit;
|
||||
textLabel->setBuddy(path);
|
||||
|
||||
destLabel = new QLabel(tr("Destination folder : "));
|
||||
destPath = new QLineEdit;
|
||||
textLabel->setBuddy(destPath);
|
||||
|
||||
accept = new QPushButton(tr("Unpack"));
|
||||
accept->setDisabled(true);
|
||||
connect(accept,SIGNAL(clicked()),this,SLOT(add()));
|
||||
|
||||
cancel = new QPushButton(tr("Cancel"));
|
||||
connect(cancel,SIGNAL(clicked()),this,SLOT(close()));
|
||||
//connect(cancel,SIGNAL(clicked()),this,SIGNAL(rejected()));
|
||||
|
||||
find = new QPushButton(QIcon(":/images/coversPackage.png"),"");
|
||||
connect(find,SIGNAL(clicked()),this,SLOT(findPath()));
|
||||
|
||||
findDest = new QPushButton(QIcon(":/images/open.png"),"");
|
||||
connect(findDest,SIGNAL(clicked()),this,SLOT(findDestination()));
|
||||
|
||||
QHBoxLayout *nameLayout = new QHBoxLayout;
|
||||
|
||||
nameLayout->addWidget(nameLabel);
|
||||
nameLayout->addWidget(nameEdit);
|
||||
|
||||
QHBoxLayout *libraryLayout = new QHBoxLayout;
|
||||
|
||||
libraryLayout->addWidget(textLabel);
|
||||
libraryLayout->addWidget(path);
|
||||
libraryLayout->addWidget(find);
|
||||
libraryLayout->setStretchFactor(find,0); //TODO
|
||||
|
||||
QHBoxLayout *destLayout = new QHBoxLayout;
|
||||
|
||||
destLayout->addWidget(destLabel);
|
||||
destLayout->addWidget(destPath);
|
||||
destLayout->addWidget(findDest);
|
||||
destLayout->setStretchFactor(findDest,0); //TODO
|
||||
|
||||
|
||||
QHBoxLayout *bottomLayout = new QHBoxLayout;
|
||||
bottomLayout->addStretch();
|
||||
bottomLayout->addWidget(accept);
|
||||
bottomLayout->addWidget(cancel);
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
mainLayout->addLayout(nameLayout);
|
||||
mainLayout->addLayout(libraryLayout);
|
||||
mainLayout->addLayout(destLayout);
|
||||
mainLayout->addWidget(progress = new QLabel());
|
||||
mainLayout->addStretch();
|
||||
mainLayout->addLayout(bottomLayout);
|
||||
|
||||
QHBoxLayout * imgMainLayout = new QHBoxLayout;
|
||||
QLabel * imgLabel = new QLabel(this);
|
||||
QPixmap p(":/images/importLibrary.png");
|
||||
imgLabel->setPixmap(p);
|
||||
imgMainLayout->addWidget(imgLabel);
|
||||
imgMainLayout->addLayout(mainLayout);
|
||||
|
||||
setLayout(imgMainLayout);
|
||||
|
||||
setModal(true);
|
||||
setWindowTitle(tr("Extract a catalog"));
|
||||
|
||||
t.setInterval(500);
|
||||
t.stop();
|
||||
connect(&t,SIGNAL(timeout()),this,SLOT(updateProgress()));
|
||||
}
|
||||
|
||||
void ImportLibraryDialog::add()
|
||||
{
|
||||
accept->setEnabled(false);
|
||||
t.start();
|
||||
emit(unpackCLC(QDir::cleanPath(path->text()),QDir::cleanPath(destPath->text()),nameEdit->text()));
|
||||
}
|
||||
|
||||
void ImportLibraryDialog::findPath()
|
||||
{
|
||||
QString s = QFileDialog::getOpenFileName(0,"Covers Package",".",tr("Compresed library covers (*.clc)"));
|
||||
if(!s.isEmpty())
|
||||
{
|
||||
path->setText(s);
|
||||
if(!destPath->text().isEmpty() && !nameEdit->text().isEmpty())
|
||||
accept->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ImportLibraryDialog::findDestination()
|
||||
{
|
||||
QString s = QFileDialog::getExistingDirectory(0,"Folder",".",QFileDialog::ShowDirsOnly);
|
||||
if(!s.isEmpty())
|
||||
{
|
||||
destPath->setText(s);
|
||||
if(!path->text().isEmpty() && !nameEdit->text().isEmpty())
|
||||
accept->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void ImportLibraryDialog::nameEntered()
|
||||
{
|
||||
if(!nameEdit->text().isEmpty())
|
||||
{
|
||||
if(!path->text().isEmpty() && !destPath->text().isEmpty())
|
||||
accept->setEnabled(true);
|
||||
}
|
||||
else
|
||||
accept->setEnabled(false);
|
||||
}
|
||||
|
||||
void ImportLibraryDialog::close()
|
||||
{
|
||||
path->clear();
|
||||
destPath->clear();
|
||||
nameEdit->clear();
|
||||
accept->setEnabled(false);
|
||||
if(t.isActive())
|
||||
{
|
||||
t.stop();
|
||||
emit rejected();
|
||||
}
|
||||
progress->setText("");
|
||||
QDialog::hide();
|
||||
}
|
||||
|
||||
void ImportLibraryDialog::updateProgress()
|
||||
{
|
||||
if(progressCount == 0)
|
||||
progress->setText(tr("Importing package ."));
|
||||
else
|
||||
progress->setText(progress->text()+" .");
|
||||
progressCount++;
|
||||
if(progressCount == 15)
|
||||
progressCount = 0;
|
||||
}
|
||||
|
||||
void ImportLibraryDialog::closeEvent ( QCloseEvent * e )
|
||||
{
|
||||
close();
|
||||
}
|
45
YACReaderLibrary/import_library_dialog.h
Normal file
@ -0,0 +1,45 @@
|
||||
#ifndef IMPORT_LIBRARY_DIALOG_H
|
||||
#define IMPORT_LIBRARY_DIALOG_H
|
||||
|
||||
|
||||
#include <QDialog>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QThread>
|
||||
#include <QTimer>
|
||||
|
||||
class ImportLibraryDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ImportLibraryDialog(QWidget * parent = 0);
|
||||
private:
|
||||
QLabel * nameLabel;
|
||||
QLabel * textLabel;
|
||||
QLabel * destLabel;
|
||||
QLineEdit * path;
|
||||
QLineEdit * destPath;
|
||||
QLineEdit * nameEdit;
|
||||
QPushButton * find;
|
||||
QPushButton * findDest;
|
||||
QPushButton * accept;
|
||||
QPushButton * cancel;
|
||||
QLabel * progress;
|
||||
void setupUI();
|
||||
QTimer t;
|
||||
int progressCount;
|
||||
void closeEvent ( QCloseEvent * e );
|
||||
public slots:
|
||||
void add();
|
||||
void findPath();
|
||||
void findDestination();
|
||||
void close();
|
||||
void updateProgress();
|
||||
void nameEntered();
|
||||
|
||||
signals:
|
||||
void unpackCLC(QString clc,QString targetFolder, QString name);
|
||||
};
|
||||
|
||||
#endif
|
323
YACReaderLibrary/library_creator.cpp
Normal file
@ -0,0 +1,323 @@
|
||||
#include "library_creator.h"
|
||||
#include "custom_widgets.h"
|
||||
|
||||
#include <QMutex>
|
||||
#include <QDebug>
|
||||
|
||||
//QMutex mutex;
|
||||
|
||||
|
||||
|
||||
/*int numThreads = 0;
|
||||
QWaitCondition waitCondition;
|
||||
QMutex mutex;
|
||||
*/
|
||||
LibraryCreator::LibraryCreator()
|
||||
{
|
||||
_nameFilter << "*.cbr" << "*.cbz" << "*.rar" << "*.zip" << "*.tar";
|
||||
}
|
||||
|
||||
void LibraryCreator::createLibrary(const QString &source, const QString &target)
|
||||
{
|
||||
_source = source;
|
||||
_target = target;
|
||||
if(!QDir(target).exists())
|
||||
_mode = CREATOR;
|
||||
else
|
||||
_mode = UPDATER;
|
||||
}
|
||||
|
||||
void LibraryCreator::updateLibrary(const QString &source, const QString &target)
|
||||
{
|
||||
_source = source;
|
||||
_target = target;
|
||||
_mode = UPDATER;
|
||||
}
|
||||
|
||||
void LibraryCreator::run()
|
||||
{
|
||||
stopRunning = false;
|
||||
if(_mode == CREATOR)
|
||||
create(QDir(_source));
|
||||
else
|
||||
update(QDir(_source),QDir(_target));
|
||||
emit(finished());
|
||||
}
|
||||
|
||||
void LibraryCreator::stop()
|
||||
{
|
||||
stopRunning = true;
|
||||
}
|
||||
|
||||
void LibraryCreator::create(QDir dir)
|
||||
{
|
||||
dir.setNameFilters(_nameFilter);
|
||||
dir.setFilter(QDir::AllDirs|QDir::Files|QDir::NoDotAndDotDot);
|
||||
QFileInfoList list = dir.entryInfoList();
|
||||
for (int i = 0; i < list.size(); ++i)
|
||||
{
|
||||
if(stopRunning)
|
||||
return;
|
||||
QFileInfo fileInfo = list.at(i);
|
||||
if(fileInfo.isDir())
|
||||
{
|
||||
create(QDir(fileInfo.absoluteFilePath()));
|
||||
}
|
||||
else
|
||||
{
|
||||
dir.mkpath(_target+(QDir::cleanPath(fileInfo.absolutePath()).remove(_source)));
|
||||
emit(coverExtracted(QDir::cleanPath(fileInfo.absoluteFilePath()).remove(_source)));
|
||||
|
||||
ThumbnailCreator tc(QDir::cleanPath(fileInfo.absoluteFilePath()),_target+(QDir::cleanPath(fileInfo.absoluteFilePath()).remove(_source))+".jpg");
|
||||
tc.create();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LibraryCreator::update(QDir dirS,QDir dirD)
|
||||
{
|
||||
dirS.setNameFilters(_nameFilter);
|
||||
dirS.setFilter(QDir::AllDirs|QDir::Files|QDir::NoDotAndDotDot);
|
||||
dirS.setSorting(QDir::Name|QDir::IgnoreCase|QDir::LocaleAware|QDir::DirsFirst);
|
||||
QFileInfoList listS = dirS.entryInfoList();
|
||||
|
||||
dirD.setNameFilters(QStringList()<<"*.jpg");
|
||||
dirD.setFilter(QDir::AllDirs|QDir::Files|QDir::NoDotAndDotDot);
|
||||
dirD.setSorting(QDir::Name|QDir::IgnoreCase|QDir::LocaleAware|QDir::DirsFirst);
|
||||
QFileInfoList listD = dirD.entryInfoList();
|
||||
|
||||
int lenghtS = listS.size();
|
||||
int lenghtD = listD.size();
|
||||
int maxLenght = qMax(lenghtS,lenghtD);
|
||||
|
||||
bool updated;
|
||||
int i,j;
|
||||
for (i=0,j=0; (i < lenghtS)||(j < lenghtD);)
|
||||
{
|
||||
if(stopRunning)
|
||||
return;
|
||||
updated = false;
|
||||
if(i>=lenghtS) //finished source files/dirs
|
||||
{
|
||||
//delete listD //from j
|
||||
for(;j<lenghtD;j++)
|
||||
{
|
||||
if(stopRunning)
|
||||
return;
|
||||
QFileInfo fileInfoD = listD.at(j);
|
||||
if(fileInfoD.isDir())
|
||||
{
|
||||
delTree(QDir(fileInfoD.absoluteFilePath()));
|
||||
dirD.rmdir(fileInfoD.absoluteFilePath());
|
||||
}
|
||||
else
|
||||
dirD.remove(fileInfoD.absoluteFilePath());
|
||||
}
|
||||
updated = true;
|
||||
}
|
||||
if(j>=lenghtD) //finished library files/dirs
|
||||
{
|
||||
//create listS //from i
|
||||
for(;i<lenghtS;i++)
|
||||
{
|
||||
if(stopRunning)
|
||||
return;
|
||||
QFileInfo fileInfoS = listS.at(i);
|
||||
if(fileInfoS.isDir())
|
||||
create(QDir(fileInfoS.absoluteFilePath()));
|
||||
else
|
||||
{
|
||||
dirD.mkpath(_target+(QDir::cleanPath(fileInfoS.absolutePath()).remove(_source)));
|
||||
emit(coverExtracted(QDir::cleanPath(fileInfoS.absoluteFilePath()).remove(_source)));
|
||||
ThumbnailCreator tc(QDir::cleanPath(fileInfoS.absoluteFilePath()),_target+(QDir::cleanPath(fileInfoS.absoluteFilePath()).remove(_source))+".jpg");
|
||||
tc.create();
|
||||
}
|
||||
}
|
||||
updated = true;
|
||||
}
|
||||
if(!updated)
|
||||
{
|
||||
QFileInfo fileInfoS = listS.at(i);
|
||||
QFileInfo fileInfoD = listD.at(j);
|
||||
QString nameS = QDir::cleanPath(fileInfoS.absoluteFilePath()).remove(QDir::cleanPath(fileInfoS.absolutePath())); //remove source
|
||||
QString nameD = QDir::cleanPath(fileInfoD.absoluteFilePath()).remove(QDir::cleanPath(fileInfoD.absolutePath())); //remove target
|
||||
|
||||
int comparation = QString::localeAwareCompare(nameS,nameD);
|
||||
if(fileInfoS.isDir()&&fileInfoD.isDir())
|
||||
if(comparation == 0)//same folder, update
|
||||
{
|
||||
update(QDir(fileInfoS.absoluteFilePath()),QDir(fileInfoD.absoluteFilePath()));
|
||||
i++;
|
||||
j++;
|
||||
}
|
||||
else
|
||||
if(comparation < 0) //nameS doesn't exist on Target folder...
|
||||
{
|
||||
if(nameS!="/.yacreaderlibrary")
|
||||
create(QDir(fileInfoS.absoluteFilePath()));
|
||||
i++;
|
||||
}
|
||||
else //nameD no longer avaliable on Source folder...
|
||||
{
|
||||
if(nameS!="/.yacreaderlibrary")
|
||||
{
|
||||
delTree(QDir(fileInfoD.absoluteFilePath()));
|
||||
dirD.rmdir(fileInfoD.absoluteFilePath());
|
||||
j++;
|
||||
}
|
||||
else
|
||||
i++; //skip library directory
|
||||
}
|
||||
else // one of them(or both) is a file
|
||||
if(fileInfoS.isDir()) //this folder doesn't exist on library
|
||||
{
|
||||
if(nameS!="/.yacreaderlibrary") //skip .yacreaderlibrary folder
|
||||
create(QDir(fileInfoS.absoluteFilePath()));
|
||||
i++;
|
||||
}
|
||||
else
|
||||
if(fileInfoD.isDir()) //delete this folder from library
|
||||
{
|
||||
delTree(QDir(fileInfoD.absoluteFilePath()));
|
||||
dirD.rmdir(fileInfoD.absoluteFilePath());
|
||||
j++;
|
||||
}
|
||||
else //both are files //BUG on windows (no case sensitive)
|
||||
{
|
||||
nameD.remove(nameD.size()-4,4);
|
||||
int comparation = QString::localeAwareCompare(nameS,nameD);
|
||||
if(comparation < 0) //create new thumbnail
|
||||
{
|
||||
dirD.mkpath(_target+(QDir::cleanPath(fileInfoS.absolutePath()).remove(_source)));
|
||||
emit(coverExtracted(QDir::cleanPath(fileInfoS.absoluteFilePath()).remove(_source)));
|
||||
ThumbnailCreator tc(QDir::cleanPath(fileInfoS.absoluteFilePath()),_target+(QDir::cleanPath(fileInfoS.absoluteFilePath()).remove(_source))+".jpg");
|
||||
tc.create();
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(comparation > 0) //delete thumbnail
|
||||
{
|
||||
dirD.remove(fileInfoD.absoluteFilePath());
|
||||
QString tick = fileInfoD.absoluteFilePath();
|
||||
dirD.remove(tick.remove(tick.size()-3,3));
|
||||
dirD.remove(tick+"r");
|
||||
j++;
|
||||
}
|
||||
else //same file
|
||||
{
|
||||
if(fileInfoS.isFile() && fileInfoD.isFile())
|
||||
{
|
||||
if(fileInfoS.lastModified()>fileInfoD.lastModified())
|
||||
{
|
||||
dirD.mkpath(_target+(QDir::cleanPath(fileInfoS.absolutePath()).remove(_source)));
|
||||
emit(coverExtracted(QDir::cleanPath(fileInfoS.absoluteFilePath()).remove(_source)));
|
||||
ThumbnailCreator tc(QDir::cleanPath(fileInfoS.absoluteFilePath()),_target+(QDir::cleanPath(fileInfoS.absoluteFilePath()).remove(_source))+".jpg");
|
||||
tc.create();
|
||||
}
|
||||
}
|
||||
i++;j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ThumbnailCreator::ThumbnailCreator(QString fileSource, QString target="")
|
||||
:_fileSource(fileSource),_target(target),_numPages(0)
|
||||
{
|
||||
}
|
||||
|
||||
void ThumbnailCreator::create()
|
||||
{
|
||||
_7z = new QProcess();
|
||||
QStringList attributes;
|
||||
attributes << "l" << "-ssc-" << "-r" << _fileSource << "*.jpg" << "*.jpeg" << "*.png" << "*.gif" << "*.tiff" << "*.tif" << "*.bmp";
|
||||
//connect(_7z,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(loadFirstImage(void)));
|
||||
connect(_7z,SIGNAL(error(QProcess::ProcessError)),this,SIGNAL(openingError(QProcess::ProcessError)));
|
||||
_7z->start(QCoreApplication::applicationDirPath()+"/utils/7z",attributes);
|
||||
_7z->waitForFinished(60000);
|
||||
|
||||
QRegExp rx("[0-9]{4}-[0-9]{2}-[0-9]{2}[ ]+[0-9]{2}:[0-9]{2}:[0-9]{2}[ ]+.{5}[ ]+([0-9]+)[ ]+([0-9]+)[ ]+(.+)");
|
||||
|
||||
QString ba = QString::fromUtf8(_7z->readAllStandardOutput());
|
||||
QList<QString> lines = ba.split('\n');
|
||||
QString line;
|
||||
_currentName = "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"; //TODO
|
||||
QString name;
|
||||
foreach(line,lines)
|
||||
{
|
||||
if(rx.indexIn(line)!=-1)
|
||||
{
|
||||
name = rx.cap(3).trimmed();
|
||||
if(0 > QString::localeAwareCompare(name,_currentName))
|
||||
_currentName = name;
|
||||
_numPages++;
|
||||
}
|
||||
}
|
||||
delete _7z;
|
||||
attributes.clear();
|
||||
_currentName = QDir::fromNativeSeparators(_currentName).split('/').last(); //separator fixed.
|
||||
#ifdef Q_WS_WIN
|
||||
attributes << "e" << "-so" << "-r" << _fileSource << QString(_currentName.toLocal8Bit().constData()); //TODO platform dependency?? OEM 437
|
||||
#else
|
||||
attributes << "e" << "-so" << "-r" << _fileSource << _currentName; //TODO platform dependency?? OEM 437
|
||||
#endif
|
||||
_7z = new QProcess();
|
||||
connect(_7z,SIGNAL(error(QProcess::ProcessError)),this,SIGNAL(openingError(QProcess::ProcessError)));
|
||||
//connect(_7z,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(writeThumbnail(void)));
|
||||
_7z->start(QCoreApplication::applicationDirPath()+"/utils/7z",attributes);
|
||||
_7z->waitForFinished(60000);
|
||||
|
||||
QByteArray image = _7z->readAllStandardOutput();
|
||||
QString error = _7z->readAllStandardError();
|
||||
QImage p;
|
||||
if(_target=="")
|
||||
{
|
||||
if(!_cover.loadFromData(image))
|
||||
_cover.load(":/images/notCover.png");
|
||||
}
|
||||
else
|
||||
{
|
||||
if(p.loadFromData(image))
|
||||
{
|
||||
//TODO calculate aspect ratio
|
||||
QImage scaled;
|
||||
if(p.width()>p.height()) //landscape??
|
||||
scaled = p.scaledToWidth(640,Qt::SmoothTransformation);
|
||||
else
|
||||
scaled = p.scaledToWidth(480,Qt::SmoothTransformation);
|
||||
scaled.save(_target,0,75);
|
||||
}
|
||||
else
|
||||
{
|
||||
p.load(":/images/notCover.png");
|
||||
p.save(_target);
|
||||
//TODO save a default image.
|
||||
}
|
||||
}
|
||||
delete _7z;
|
||||
}
|
||||
|
||||
/*void ThumbnailCreator::openingError(QProcess::ProcessError error)
|
||||
{
|
||||
//TODO : move to the gui thread
|
||||
switch(error)
|
||||
{
|
||||
case QProcess::FailedToStart:
|
||||
QMessageBox::critical(NULL,tr("7z not found"),tr("7z wasn't found in your PATH."));
|
||||
break;
|
||||
case QProcess::Crashed:
|
||||
QMessageBox::critical(NULL,tr("7z crashed"),tr("7z crashed."));
|
||||
break;
|
||||
case QProcess::ReadError:
|
||||
QMessageBox::critical(NULL,tr("7z reading"),tr("problem reading from 7z"));
|
||||
break;
|
||||
case QProcess::UnknownError:
|
||||
QMessageBox::critical(NULL,tr("7z problem"),tr("Unknown error 7z"));
|
||||
break;
|
||||
default:
|
||||
//TODO
|
||||
break;
|
||||
}
|
||||
}*/
|
64
YACReaderLibrary/library_creator.h
Normal file
@ -0,0 +1,64 @@
|
||||
#ifndef __LIBRARY_CREATOR_H
|
||||
#define __LIBRARY_CREATOR_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QByteArray>
|
||||
#include <QRegExp>
|
||||
#include <QProcess>
|
||||
#include <QtCore>
|
||||
#include <QtGui>
|
||||
#include <QMutex>
|
||||
#include <QThread>
|
||||
|
||||
class LibraryCreator : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LibraryCreator();
|
||||
void createLibrary(const QString & source, const QString & target);
|
||||
void updateLibrary(const QString & source, const QString & target);
|
||||
void stop();
|
||||
private:
|
||||
enum Mode {CREATOR,UPDATER};
|
||||
enum Mode _mode;
|
||||
QString _source;
|
||||
QString _target;
|
||||
QStringList _nameFilter;
|
||||
//recursive method
|
||||
void create(QDir currentDirectory);
|
||||
void update(QDir currentDirectory,QDir libraryCurrentDirectory);
|
||||
void run();
|
||||
bool stopRunning;
|
||||
signals:
|
||||
void finished();
|
||||
void coverExtracted(QString);
|
||||
void folderUpdated(QString);
|
||||
};
|
||||
|
||||
class ThumbnailCreator : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ThumbnailCreator(QString fileSource, QString target);
|
||||
private:
|
||||
QProcess * _7z;
|
||||
QString _fileSource;
|
||||
QString _target;
|
||||
QString _currentName;
|
||||
int _numPages;
|
||||
QPixmap _cover;
|
||||
|
||||
public slots:
|
||||
void create();
|
||||
int getNumPages(){return _numPages;};
|
||||
QPixmap getCover(){return _cover;};
|
||||
signals:
|
||||
void openingError(QProcess::ProcessError error);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
1075
YACReaderLibrary/library_window.cpp
Normal file
164
YACReaderLibrary/library_window.h
Normal file
@ -0,0 +1,164 @@
|
||||
#ifndef __LIBRARYWINDOW_H
|
||||
#define __LIBRARYWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QListView>
|
||||
#include <QTreeView>
|
||||
#include <QModelIndex>
|
||||
#include <QDirModel>
|
||||
#include <QAction>
|
||||
#include <QToolBar>
|
||||
#include <QComboBox>
|
||||
#include <QThread>
|
||||
#include <QFileInfoList>
|
||||
#include <QFileSystemModel>
|
||||
|
||||
#include "create_library_dialog.h"
|
||||
#include "add_library_dialog.h"
|
||||
#include "library_creator.h"
|
||||
#include "comic_flow.h"
|
||||
#include "custom_widgets.h"
|
||||
#include "rename_library_dialog.h"
|
||||
#include "properties_dialog.h"
|
||||
#include "options_dialog.h"
|
||||
#include "export_library_dialog.h"
|
||||
#include "import_library_dialog.h"
|
||||
#include "package_manager.h"
|
||||
|
||||
|
||||
class LibraryWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
QWidget * left;
|
||||
CreateLibraryDialog * createLibraryDialog;
|
||||
UpdateLibraryDialog * updateLibraryDialog;
|
||||
ExportLibraryDialog * exportLibraryDialog;
|
||||
ImportLibraryDialog * importLibraryDialog;
|
||||
AddLibraryDialog * addLibraryDialog;
|
||||
LibraryCreator * libraryCreator;
|
||||
HelpAboutDialog * had;
|
||||
RenameLibraryDialog * renameLibraryDialog;
|
||||
PropertiesDialog * propertiesDialog;
|
||||
bool fullscreen;
|
||||
bool importedCovers; //if true, the library is read only (not updates,open comic or properties)
|
||||
YACReaderTreeSearch * proxyFilter;
|
||||
YACReaderSortComics * proxySort;
|
||||
PackageManager * packageManager;
|
||||
|
||||
ComicFlow * comicFlow;
|
||||
QSize slideSizeW;
|
||||
QSize slideSizeF;
|
||||
//search filter
|
||||
QLineEdit * foldersFilter;
|
||||
QString previousFilter;
|
||||
QPushButton * clearFoldersFilter;
|
||||
QCheckBox * includeComicsCheckBox;
|
||||
//-------------
|
||||
QListView * comicView;
|
||||
QTreeView * foldersView;
|
||||
QComboBox * selectedLibrary;
|
||||
QFileSystemModel * dm;
|
||||
QFileSystemModel * dmCV;
|
||||
QStringList paths;
|
||||
QMap<QString,QString> libraries;
|
||||
QLabel * fullScreenToolTip;
|
||||
YACReaderIconProvider fip;
|
||||
|
||||
bool fetching;
|
||||
|
||||
int i;
|
||||
unsigned int skip;
|
||||
|
||||
QAction * openComicAction;
|
||||
QAction * showPropertiesAction;
|
||||
QAction * createLibraryAction;
|
||||
QAction * openLibraryAction;
|
||||
QAction * exportLibraryAction;
|
||||
QAction * importLibraryAction;
|
||||
QAction * updateLibraryAction;
|
||||
QAction * deleteLibraryAction;
|
||||
QAction * removeLibraryAction;
|
||||
QAction * helpAboutAction;
|
||||
QAction * renameLibraryAction;
|
||||
QAction * toggleFullScreenAction;
|
||||
QAction * optionsAction;
|
||||
|
||||
QAction * setRootIndexAction;
|
||||
QAction * expandAllNodesAction;
|
||||
QAction * colapseAllNodesAction;
|
||||
|
||||
QAction * openContainingFolderAction;
|
||||
QAction * openContainingFolderComicAction;
|
||||
QAction * setAsReadAction;
|
||||
QAction * setAsNonReadAction;
|
||||
QAction * setAllAsReadAction;
|
||||
QAction * setAllAsNonReadAction;
|
||||
QAction * showHideMarksAction;
|
||||
|
||||
|
||||
QToolBar * libraryToolBar;
|
||||
QToolBar * treeActions;
|
||||
QToolBar * comicsToolBar;
|
||||
|
||||
OptionsDialog * optionsDialog;
|
||||
|
||||
QString libraryPath;
|
||||
QString comicsPath;
|
||||
|
||||
QString _lastAdded;
|
||||
|
||||
QModelIndex _rootIndex;
|
||||
QModelIndex _rootIndexCV;
|
||||
|
||||
void setupUI();
|
||||
void createActions();
|
||||
void createToolBars();
|
||||
void createMenus();
|
||||
void createConnections();
|
||||
public:
|
||||
LibraryWindow();
|
||||
public slots:
|
||||
void loadLibrary(const QString & path);
|
||||
void loadCovers(const QModelIndex & mi);
|
||||
void centerComicFlow(const QModelIndex & mi);
|
||||
void updateComicView(int i);
|
||||
void openComic();
|
||||
void createLibrary();
|
||||
void create(QString source,QString dest, QString name);
|
||||
void showAddLibrary();
|
||||
void openLibrary(QString path, QString name);
|
||||
void loadLibraries();
|
||||
void saveLibraries();
|
||||
void openLastCreated();
|
||||
void updateLibrary();
|
||||
void deleteLibrary();
|
||||
void openContainingFolder();
|
||||
void openContainingFolderComic();
|
||||
void deleteCurrentLibrary();
|
||||
void removeLibrary();
|
||||
void renameLibrary();
|
||||
void rename(QString newName);
|
||||
void cancelCreating();
|
||||
void stopLibraryCreator();
|
||||
void setRootIndex();
|
||||
void toggleFullScreen();
|
||||
void toNormal();
|
||||
void toFullScreen();
|
||||
void setFoldersFilter(QString filter);
|
||||
void showProperties();
|
||||
void exportLibrary(QString destPath);
|
||||
void importLibrary(QString clc,QString destPath,QString name);
|
||||
void reloadOptions();
|
||||
void updateFoldersView(QString);
|
||||
void setCurrentComicReaded();
|
||||
void setCurrentComicUnreaded();
|
||||
void setComicsReaded();
|
||||
void setComicsUnreaded();
|
||||
void searchInFiles(int);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
22
YACReaderLibrary/main.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include "library_window.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
#define PICTUREFLOW_QT4 1
|
||||
|
||||
int main( int argc, char ** argv )
|
||||
{
|
||||
QApplication app( argc, argv );
|
||||
|
||||
QTranslator translator;
|
||||
QString sufix = QLocale::system().name();
|
||||
translator.load(":/yacreaderlibrary_"+sufix);
|
||||
app.installTranslator(&translator);
|
||||
app.setApplicationName("YACReaderLibrary");
|
||||
|
||||
QMainWindow * mw = new LibraryWindow();
|
||||
mw->resize(800,480);
|
||||
mw->showMaximized();
|
||||
|
||||
return app.exec();
|
||||
}
|
148
YACReaderLibrary/options_dialog.cpp
Normal file
@ -0,0 +1,148 @@
|
||||
#include "options_dialog.h"
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QFileDialog>
|
||||
#include <QGroupBox>
|
||||
#include <QRadioButton>
|
||||
#include <QTextStream>
|
||||
#include <QCoreApplication>
|
||||
#include <QFile>
|
||||
#include <QMessageBox>
|
||||
|
||||
PictureFlow::FlowType flowType = PictureFlow::Strip;
|
||||
|
||||
OptionsDialog::OptionsDialog(QWidget * parent)
|
||||
:QDialog()
|
||||
{
|
||||
QVBoxLayout * layout = new QVBoxLayout(this);
|
||||
|
||||
accept = new QPushButton(tr("Save"));
|
||||
cancel = new QPushButton(tr("Cancel"));
|
||||
connect(accept,SIGNAL(clicked()),this,SLOT(saveOptions()));
|
||||
connect(cancel,SIGNAL(clicked()),this,SLOT(restoreOptions()));
|
||||
connect(cancel,SIGNAL(clicked()),this,SLOT(close()));
|
||||
|
||||
QGroupBox *groupBox = new QGroupBox(tr("How to show covers:"));
|
||||
|
||||
radio1 = new QRadioButton(tr("CoverFlow look"));
|
||||
radio2 = new QRadioButton(tr("Stripe look"));
|
||||
radio3 = new QRadioButton(tr("Overlapped Stripe look"));
|
||||
|
||||
|
||||
QVBoxLayout *vbox = new QVBoxLayout;
|
||||
QHBoxLayout * opt1 = new QHBoxLayout;
|
||||
opt1->addWidget(radio1);
|
||||
QLabel * lOpt1 = new QLabel();
|
||||
lOpt1->setPixmap(QPixmap(":/images/flow1.png"));
|
||||
opt1->addStretch();
|
||||
opt1->addWidget(lOpt1);
|
||||
vbox->addLayout(opt1);
|
||||
|
||||
QHBoxLayout * opt2 = new QHBoxLayout;
|
||||
opt2->addWidget(radio2);
|
||||
QLabel * lOpt2 = new QLabel();
|
||||
lOpt2->setPixmap(QPixmap(":/images/flow2.png"));
|
||||
opt2->addStretch();
|
||||
opt2->addWidget(lOpt2);
|
||||
vbox->addLayout(opt2);
|
||||
|
||||
QHBoxLayout * opt3 = new QHBoxLayout;
|
||||
opt3->addWidget(radio3);
|
||||
QLabel * lOpt3 = new QLabel();
|
||||
lOpt3->setPixmap(QPixmap(":/images/flow3.png"));
|
||||
opt3->addStretch();
|
||||
opt3->addWidget(lOpt3);
|
||||
vbox->addLayout(opt3);
|
||||
|
||||
|
||||
//vbox->addStretch(1);
|
||||
groupBox->setLayout(vbox);
|
||||
|
||||
QHBoxLayout * buttons = new QHBoxLayout();
|
||||
buttons->addStretch();
|
||||
buttons->addWidget(accept);
|
||||
buttons->addWidget(cancel);
|
||||
|
||||
layout->addWidget(groupBox);
|
||||
layout->addLayout(buttons);
|
||||
|
||||
setLayout(layout);
|
||||
|
||||
restoreOptions(); //load options
|
||||
resize(200,0);
|
||||
setModal (true);
|
||||
setWindowTitle("Options");
|
||||
}
|
||||
|
||||
void OptionsDialog::findFolder()
|
||||
{
|
||||
QString s = QFileDialog::getExistingDirectory(0,tr("Comics directory"),".");
|
||||
if(!s.isEmpty())
|
||||
{
|
||||
pathEdit->setText(s);
|
||||
}
|
||||
}
|
||||
|
||||
void OptionsDialog::saveOptions()
|
||||
{
|
||||
QFile f(QCoreApplication::applicationDirPath()+"/YACReaderLibrary.conf");
|
||||
if(!f.open(QIODevice::WriteOnly))
|
||||
{
|
||||
QMessageBox::critical(NULL,tr("Saving config file...."),tr("There was a problem saving YACReaderLibrary configuration. Please, check if you have enough permissions in the YACReader root folder."));
|
||||
}
|
||||
else
|
||||
{
|
||||
QTextStream txtS(&f);
|
||||
if(radio1->isChecked())
|
||||
{
|
||||
txtS << "FLOW_TYPE" << "\n" << (int)PictureFlow::CoverFlowLike << "\n";
|
||||
flowType = PictureFlow::CoverFlowLike;
|
||||
}
|
||||
if(radio2->isChecked())
|
||||
{
|
||||
txtS << "FLOW_TYPE" << "\n" << (int)PictureFlow::Strip << "\n";
|
||||
flowType = PictureFlow::Strip;
|
||||
}
|
||||
if(radio3->isChecked())
|
||||
{
|
||||
txtS << "FLOW_TYPE" << "\n" << (int)PictureFlow::StripOverlapped << "\n";
|
||||
flowType = PictureFlow::StripOverlapped;
|
||||
}
|
||||
f.close();
|
||||
close();
|
||||
emit(optionsChanged());
|
||||
}
|
||||
}
|
||||
|
||||
void OptionsDialog::restoreOptions()
|
||||
{
|
||||
QFile f(QCoreApplication::applicationDirPath()+"/YACReaderLibrary.conf");
|
||||
if(f.exists())
|
||||
{
|
||||
f.open(QIODevice::ReadOnly);
|
||||
QTextStream txtS(&f);
|
||||
QString content = txtS.readAll();
|
||||
|
||||
QStringList lines = content.split('\n');
|
||||
if(lines.count()>0){
|
||||
QString name = lines.at(1);
|
||||
|
||||
switch(flowType=(PictureFlow::FlowType)name.toInt()){
|
||||
case PictureFlow::CoverFlowLike:
|
||||
radio1->setChecked(true);
|
||||
break;
|
||||
case PictureFlow::Strip:
|
||||
radio2->setChecked(true);
|
||||
break;
|
||||
case PictureFlow::StripOverlapped:
|
||||
radio3->setChecked(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
flowType=PictureFlow::Strip;
|
||||
}
|
||||
else
|
||||
flowType=PictureFlow::Strip;
|
||||
|
||||
}
|
50
YACReaderLibrary/options_dialog.h
Normal file
@ -0,0 +1,50 @@
|
||||
#ifndef __OPTIONS_DIALOG_H
|
||||
#define __OPTIONS_DIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QSlider>
|
||||
#include <QPushButton>
|
||||
#include <QRadioButton>
|
||||
#include "pictureflow.h"
|
||||
|
||||
extern PictureFlow::FlowType flowType;
|
||||
|
||||
class OptionsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
OptionsDialog(QWidget * parent = 0);
|
||||
private:
|
||||
QLabel * pathLabel;
|
||||
QLineEdit * pathEdit;
|
||||
QPushButton * pathFindButton;
|
||||
|
||||
QLabel * magGlassSizeLabel;
|
||||
|
||||
QLabel * zoomLevel;
|
||||
|
||||
QLabel * slideSizeLabel;
|
||||
QSlider * slideSize;
|
||||
|
||||
QPushButton * accept;
|
||||
QPushButton * cancel;
|
||||
|
||||
QRadioButton *radio1;
|
||||
QRadioButton *radio2;
|
||||
QRadioButton *radio3;
|
||||
|
||||
public slots:
|
||||
void saveOptions();
|
||||
void restoreOptions();
|
||||
void findFolder();
|
||||
|
||||
signals:
|
||||
void optionsChanged();
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
47
YACReaderLibrary/package_manager.cpp
Normal file
@ -0,0 +1,47 @@
|
||||
#include "package_manager.h"
|
||||
#include <QCoreApplication>
|
||||
|
||||
PackageManager::PackageManager()
|
||||
:_7z(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void PackageManager::createPackage(const QString & libraryPath,const QString & dest)
|
||||
{
|
||||
QStringList attributes;
|
||||
attributes << "a" << "-y" << "-ttar" << dest+".clc" << libraryPath ;
|
||||
_7z = new QProcess();
|
||||
connect(_7z,SIGNAL(error(QProcess::ProcessError)),this,SLOT(openingError(QProcess::ProcessError)));
|
||||
connect(_7z,SIGNAL(finished(int,QProcess::ExitStatus)),this,SIGNAL(exported()));
|
||||
_7z->start(QCoreApplication::applicationDirPath()+"/utils/7z",attributes);
|
||||
}
|
||||
|
||||
void PackageManager::extractPackage(const QString & packagePath,const QString & destDir)
|
||||
{
|
||||
QStringList attributes;
|
||||
QString output = "-o";
|
||||
output += destDir;
|
||||
attributes << "x" << "-y" << output << packagePath;
|
||||
_7z = new QProcess();
|
||||
connect(_7z,SIGNAL(error(QProcess::ProcessError)),this,SLOT(openingError(QProcess::ProcessError)));
|
||||
connect(_7z,SIGNAL(finished(int,QProcess::ExitStatus)),this,SIGNAL(imported()));
|
||||
_7z->start(QCoreApplication::applicationDirPath()+"/utils/7z",attributes);
|
||||
}
|
||||
|
||||
void PackageManager::cancel()
|
||||
{
|
||||
if(_7z!=0)
|
||||
{
|
||||
_7z->disconnect();
|
||||
_7z->kill();
|
||||
if(creating)
|
||||
{
|
||||
//TODO remove dest+".clc"
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO fixed: is done by libraryWindow
|
||||
}
|
||||
}
|
||||
}
|
24
YACReaderLibrary/package_manager.h
Normal file
@ -0,0 +1,24 @@
|
||||
#ifndef PACKAGE_MANAGER_H
|
||||
#define PACKAGE_MANAGER_H
|
||||
|
||||
#include <QProcess>
|
||||
|
||||
class PackageManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PackageManager();
|
||||
void createPackage(const QString & libraryPath,const QString & dest);
|
||||
void extractPackage(const QString & packagePath,const QString & destDir);
|
||||
public slots:
|
||||
void cancel();
|
||||
private:
|
||||
bool creating;
|
||||
QProcess * _7z;
|
||||
|
||||
signals:
|
||||
void exported();
|
||||
void imported();
|
||||
};
|
||||
|
||||
#endif
|
77
YACReaderLibrary/properties_dialog.cpp
Normal file
@ -0,0 +1,77 @@
|
||||
#include "properties_dialog.h"
|
||||
#include <QHBoxLayout>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
|
||||
|
||||
|
||||
PropertiesDialog::PropertiesDialog(QWidget * parent)
|
||||
:QDialog(parent)
|
||||
{
|
||||
QVBoxLayout * l = new QVBoxLayout();
|
||||
|
||||
sa = new QScrollArea(this);
|
||||
_cover = new QLabel(sa);
|
||||
_cover->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
|
||||
_cover->setScaledContents(true);
|
||||
_cover->setAlignment(Qt::AlignTop|Qt::AlignHCenter);
|
||||
|
||||
|
||||
sa->setWidget(_cover);
|
||||
sa->setBackgroundRole(QPalette::Dark);
|
||||
sa->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
sa->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
sa->setFrameStyle(QFrame::NoFrame);
|
||||
sa->setAlignment(Qt::AlignCenter);
|
||||
|
||||
l->addWidget(sa);
|
||||
|
||||
QVBoxLayout * info = new QVBoxLayout();
|
||||
info->addWidget(_name = new QLabel("name"));
|
||||
info->addWidget(_pages = new QLabel("pages"));
|
||||
info->addWidget(_size = new QLabel("size"));
|
||||
info->setSizeConstraint(QLayout::SetMaximumSize);
|
||||
l->addLayout(info);
|
||||
this->setLayout(l);
|
||||
this->setWindowTitle(tr("Comic properties"));
|
||||
}
|
||||
|
||||
void PropertiesDialog::setCover(const QPixmap & cover)
|
||||
{
|
||||
_cover->setPixmap(cover);
|
||||
float aspectRatio = (float)cover.width()/cover.height();
|
||||
int heightDesktopResolution = QApplication::desktop()->screenGeometry().height();
|
||||
int widthDesktopResolution = QApplication::desktop()->screenGeometry().width();
|
||||
int sHeight,sWidth;
|
||||
sHeight = static_cast<int>(heightDesktopResolution*0.84);
|
||||
|
||||
if(aspectRatio<1)
|
||||
{
|
||||
sWidth = static_cast<int>(sHeight*0.70);
|
||||
this->resize(sWidth,sHeight);
|
||||
this->move(QPoint((widthDesktopResolution-sWidth)/2,((heightDesktopResolution-sHeight)-40)/2));
|
||||
_cover->resize(static_cast<int>((height()-90)*aspectRatio),
|
||||
(height()-90));
|
||||
}
|
||||
else
|
||||
{
|
||||
sWidth = static_cast<int>(sHeight*1.10);
|
||||
this->resize(sWidth,sHeight);
|
||||
this->move(QPoint((widthDesktopResolution-sWidth)/2,((heightDesktopResolution-sHeight)-40)/2));
|
||||
_cover->resize((width()-25),
|
||||
static_cast<int>((width()-25)/aspectRatio));
|
||||
}
|
||||
}
|
||||
void PropertiesDialog::setFilename(const QString & name)
|
||||
{
|
||||
_name->setText(tr("Name : ") + name);
|
||||
}
|
||||
void PropertiesDialog::setNumpages(int pages)
|
||||
{
|
||||
_pages->setText(tr("Number of pages : ") + QString::number(pages));
|
||||
}
|
||||
void PropertiesDialog::setSize(float size)
|
||||
{
|
||||
|
||||
_size->setText(tr("Size : ") + QString::number(size,'f',2) + " MB");
|
||||
}
|
29
YACReaderLibrary/properties_dialog.h
Normal file
@ -0,0 +1,29 @@
|
||||
#ifndef __PROPERTIES_DIALOG_H
|
||||
#define __PROPERTIES_DIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QScrollArea>
|
||||
|
||||
class PropertiesDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
QLabel * _cover;
|
||||
QLabel * _name;
|
||||
QLabel * _pages;
|
||||
QLabel * _size;
|
||||
QScrollArea * sa;
|
||||
|
||||
public:
|
||||
PropertiesDialog(QWidget * parent = 0);
|
||||
public slots:
|
||||
void setCover(const QPixmap & cover);
|
||||
void setFilename(const QString & name);
|
||||
void setNumpages(int pages);
|
||||
void setSize(float size);
|
||||
};
|
||||
#endif
|
||||
|
68
YACReaderLibrary/rename_library_dialog.cpp
Normal file
@ -0,0 +1,68 @@
|
||||
#include "rename_library_dialog.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QFileDialog>
|
||||
|
||||
|
||||
|
||||
RenameLibraryDialog::RenameLibraryDialog(QWidget * parent)
|
||||
:QDialog(parent)
|
||||
{
|
||||
setupUI();
|
||||
}
|
||||
|
||||
void RenameLibraryDialog::setupUI()
|
||||
{
|
||||
newNameLabel = new QLabel(tr("New Library Name : "));
|
||||
newNameEdit = new QLineEdit;
|
||||
newNameLabel->setBuddy(newNameEdit);
|
||||
|
||||
accept = new QPushButton(tr("Rename"));
|
||||
//accept->setDisabled(true);
|
||||
connect(accept,SIGNAL(clicked()),this,SLOT(rename()));
|
||||
|
||||
cancel = new QPushButton(tr("Cancel"));
|
||||
connect(cancel,SIGNAL(clicked()),this,SLOT(close()));
|
||||
|
||||
QHBoxLayout *nameLayout = new QHBoxLayout;
|
||||
|
||||
nameLayout->addWidget(newNameLabel);
|
||||
nameLayout->addWidget(newNameEdit);
|
||||
|
||||
QHBoxLayout *bottomLayout = new QHBoxLayout;
|
||||
bottomLayout->addStretch();
|
||||
bottomLayout->addWidget(accept);
|
||||
bottomLayout->addWidget(cancel);
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
mainLayout->addLayout(nameLayout);
|
||||
mainLayout->addStretch();
|
||||
mainLayout->addLayout(bottomLayout);
|
||||
|
||||
QHBoxLayout * imgMainLayout = new QHBoxLayout;
|
||||
QLabel * imgLabel = new QLabel(this);
|
||||
QPixmap p(":/images/edit.png");
|
||||
imgLabel->setPixmap(p);
|
||||
imgMainLayout->addWidget(imgLabel);
|
||||
imgMainLayout->addLayout(mainLayout);
|
||||
|
||||
setLayout(imgMainLayout);
|
||||
|
||||
setModal(true);
|
||||
setWindowTitle(tr("Rename current library"));
|
||||
}
|
||||
|
||||
void RenameLibraryDialog::rename()
|
||||
{
|
||||
//accept->setEnabled(false);
|
||||
emit(renameLibrary(newNameEdit->text()));
|
||||
close();
|
||||
}
|
||||
|
||||
void RenameLibraryDialog::close()
|
||||
{
|
||||
newNameEdit->clear();
|
||||
//accept->setEnabled(false);
|
||||
QDialog::close();
|
||||
}
|
30
YACReaderLibrary/rename_library_dialog.h
Normal file
@ -0,0 +1,30 @@
|
||||
#ifndef __RENAME_LIBRARY_DIALOG_H
|
||||
#define __RENAME_LIBRARY_DIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
|
||||
|
||||
class RenameLibraryDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RenameLibraryDialog(QWidget * parent = 0);
|
||||
private:
|
||||
QLabel * newNameLabel;
|
||||
QLineEdit * newNameEdit;
|
||||
QPushButton * accept;
|
||||
QPushButton * cancel;
|
||||
void setupUI();
|
||||
public slots:
|
||||
void rename();
|
||||
void close();
|
||||
signals:
|
||||
void renameLibrary(QString newName);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
BIN
YACReaderLibrary/yacreaderlibrary_es.qm
Normal file
522
YACReaderLibrary/yacreaderlibrary_es.ts
Normal file
@ -0,0 +1,522 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.0" language="es_ES">
|
||||
<context>
|
||||
<name>AddLibraryDialog</name>
|
||||
<message>
|
||||
<location filename="add_library_dialog.cpp" line="17"/>
|
||||
<source>Comics folder : </source>
|
||||
<translation>Carpeta de cómics:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="add_library_dialog.cpp" line="21"/>
|
||||
<source>Library Name : </source>
|
||||
<translation>Nombre de la librería:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="add_library_dialog.cpp" line="25"/>
|
||||
<source>Add</source>
|
||||
<translation>Añadir</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="add_library_dialog.cpp" line="29"/>
|
||||
<source>Cancel</source>
|
||||
<translation>Cancelar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="add_library_dialog.cpp" line="69"/>
|
||||
<source>Add an existing library</source>
|
||||
<translation>Añadir la librería existente</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CreateLibraryDialog</name>
|
||||
<message>
|
||||
<location filename="create_library_dialog.cpp" line="17"/>
|
||||
<source>Comics folder : </source>
|
||||
<translation>Carpeta de cómics:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="create_library_dialog.cpp" line="21"/>
|
||||
<source>Library Name : </source>
|
||||
<translation>Nombre de la libreria:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="create_library_dialog.cpp" line="25"/>
|
||||
<source>Create</source>
|
||||
<translation>Crear</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="create_library_dialog.cpp" line="29"/>
|
||||
<source>Cancel</source>
|
||||
<translation>Cancelar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="create_library_dialog.cpp" line="78"/>
|
||||
<source>Create new library</source>
|
||||
<translation>Crear la nueva librería</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ExportLibraryDialog</name>
|
||||
<message>
|
||||
<location filename="export_library_dialog.cpp" line="10"/>
|
||||
<source>Output folder : </source>
|
||||
<translation>Carpeta de destino:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="export_library_dialog.cpp" line="14"/>
|
||||
<source>Create</source>
|
||||
<translation>Crear</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="export_library_dialog.cpp" line="18"/>
|
||||
<source>Cancel</source>
|
||||
<translation>Cancelar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="export_library_dialog.cpp" line="53"/>
|
||||
<source>Create covers package</source>
|
||||
<translation>Crear paquete de portadas</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="export_library_dialog.cpp" line="67"/>
|
||||
<source>Destination directory</source>
|
||||
<translation>Carpeta de destino</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="export_library_dialog.cpp" line="93"/>
|
||||
<source>Creating package .</source>
|
||||
<translation>Creando paquete .</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>HelpAboutDialog</name>
|
||||
<message>
|
||||
<location filename="../common/custom_widgets.cpp" line="31"/>
|
||||
<source>About</source>
|
||||
<translation>Acerca de</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../common/custom_widgets.cpp" line="34"/>
|
||||
<source>Help</source>
|
||||
<translation>Ayuda</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ImportLibraryDialog</name>
|
||||
<message>
|
||||
<source>Comics folder : </source>
|
||||
<translation type="obsolete">Carpeta de cómics:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="import_library_dialog.cpp" line="17"/>
|
||||
<source>Library Name : </source>
|
||||
<translation>Nombre de la biblioteca :</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Add</source>
|
||||
<translation type="obsolete">Añadir</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="import_library_dialog.cpp" line="22"/>
|
||||
<source>Package location : </source>
|
||||
<translation>Ubicación del paquete:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="import_library_dialog.cpp" line="26"/>
|
||||
<source>Destination folder : </source>
|
||||
<translation>Directorio de destino:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="import_library_dialog.cpp" line="30"/>
|
||||
<source>Unpack</source>
|
||||
<translation>Desempaquetar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="import_library_dialog.cpp" line="34"/>
|
||||
<source>Cancel</source>
|
||||
<translation>Cancelar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="import_library_dialog.cpp" line="87"/>
|
||||
<source>Extract a catalog</source>
|
||||
<translation>Extraer un catálogo</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="import_library_dialog.cpp" line="103"/>
|
||||
<source>Compresed library covers (*.clc)</source>
|
||||
<translation>Compresed library covers (*.clc)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="import_library_dialog.cpp" line="153"/>
|
||||
<source>Importing package .</source>
|
||||
<translation>Importando paquete.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LibraryWindow</name>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="80"/>
|
||||
<source>Select a library:</source>
|
||||
<translation>Seleciona una biblioteca:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="92"/>
|
||||
<source>Clear</source>
|
||||
<translation>Borrar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="94"/>
|
||||
<source>Search folders/comics</source>
|
||||
<translation>Buscar directorios/cómics</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="97"/>
|
||||
<source>Include files (slower)</source>
|
||||
<translation>Incluir archivos (lento)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="161"/>
|
||||
<source><font color='white'> press 'F' to close fullscreen mode </font></source>
|
||||
<translation><font color='white'> presiona 'F' para salir de pantalla completa </font></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="177"/>
|
||||
<source>YACReader Library</source>
|
||||
<translation>YACReader Library</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="183"/>
|
||||
<source>Create a new library</source>
|
||||
<translation>Crear una nueva biblioteca</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="188"/>
|
||||
<source>Open an existing library</source>
|
||||
<translation>Abrir una biblioteca existente</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="193"/>
|
||||
<source>Pack the covers of the selected library</source>
|
||||
<translation>Empaquetar las portadas de la biblioteca seleccionada</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="197"/>
|
||||
<source>Unpack a catalog</source>
|
||||
<translation>Desempaquetar un catálogo</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="201"/>
|
||||
<source>Update current library</source>
|
||||
<translation>Actualizar la librería seleccionada</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="206"/>
|
||||
<source>Rename current library</source>
|
||||
<translation>Renombrar la libreria seleccionada</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="211"/>
|
||||
<source>Delete current library from disk</source>
|
||||
<translation>Borrar la libería seleccionada del disco</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="215"/>
|
||||
<source>Remove current library from your collection</source>
|
||||
<translation>Eliminar librería de la colección</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="219"/>
|
||||
<source>Open current comic on YACReader</source>
|
||||
<translation>Abrir el cómic actual en YACReader</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="223"/>
|
||||
<source>Set as read</source>
|
||||
<translation>Marcar como leído</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="224"/>
|
||||
<source>Set comic as read</source>
|
||||
<translation>Marcar cómic como leído</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="227"/>
|
||||
<source>Set as unread</source>
|
||||
<translation>Marcar como no leído</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="228"/>
|
||||
<source>Set comic as unread</source>
|
||||
<translation>Marcar cómic como no leído</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="231"/>
|
||||
<source>Set all as read</source>
|
||||
<translation>Marcar todos como leídos</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="232"/>
|
||||
<source>Set all comics as read</source>
|
||||
<translation>Marcar todos los cómics como leídos</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="235"/>
|
||||
<source>Set all as unread</source>
|
||||
<translation>Marcar todos como no leídos</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="236"/>
|
||||
<source>Set all comics as unread</source>
|
||||
<translation>Marcar todos los cómics como no leídos</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="239"/>
|
||||
<source>Show/Hide marks</source>
|
||||
<translation>Mostrar/Ocultar marcas</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="240"/>
|
||||
<source>Show or hide readed marks</source>
|
||||
<translation>Mostrar u ocultar marcas</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="248"/>
|
||||
<source>Show properties of current comic</source>
|
||||
<translation>Mostrar las propiedades del cómic actual</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="253"/>
|
||||
<source>Fullscreen mode on/off (F)</source>
|
||||
<translation>Activar/desactivar modo a pantalla completa (F)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="258"/>
|
||||
<source>Help, About YACReader</source>
|
||||
<translation>Ayuda, A cerca de... YACReader</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="263"/>
|
||||
<source>Select root node</source>
|
||||
<translation>Seleccionar el nodo raíz</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="267"/>
|
||||
<source>Expand all nodes</source>
|
||||
<translation>Expandir todos los nodos</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="271"/>
|
||||
<source>Colapse all nodes</source>
|
||||
<translation>Contraer todos los nodos</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="275"/>
|
||||
<source>Show options dialog</source>
|
||||
<translation>Mostrar opciones</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="291"/>
|
||||
<source>Open folder...</source>
|
||||
<translation>Abrir carpeta...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="295"/>
|
||||
<source>Open containing folder...</source>
|
||||
<translation>Abrir carpeta contenedora...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="301"/>
|
||||
<source>Library</source>
|
||||
<translation>Librería</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="807"/>
|
||||
<source>Saving libraries file....</source>
|
||||
<translation>Guardando bibliotecas...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="807"/>
|
||||
<source>There was a problem saving YACReaderLibrary libraries file. Please, check if you have enough permissions in the YACReader root folder.</source>
|
||||
<translation>Hubo un problema al guardar las bibliotecas de YACReaderLibrary. Por favor, comprueba si tienes suficientes permisos en el directorio raíz de YACReader.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="840"/>
|
||||
<location filename="library_window.cpp" line="868"/>
|
||||
<source>Are you sure?</source>
|
||||
<translation>¿Estás seguro?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="840"/>
|
||||
<source>Do you want delete </source>
|
||||
<translation>¿Deseas borrar </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="868"/>
|
||||
<source>Do you want remove </source>
|
||||
<translation>¿Deseas eliminar </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="library_window.cpp" line="868"/>
|
||||
<source> library?
|
||||
Files won't be erased from disk.</source>
|
||||
<translation>? Los archivos no serán borrados del disco.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>OptionsDialog</name>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="19"/>
|
||||
<source>Save</source>
|
||||
<translation>Guardar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="20"/>
|
||||
<source>Cancel</source>
|
||||
<translation>Cancelar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="25"/>
|
||||
<source>How to show covers:</source>
|
||||
<translation>Cómo mostrar las portadas:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="27"/>
|
||||
<source>CoverFlow look</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="28"/>
|
||||
<source>Stripe look</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="29"/>
|
||||
<source>Overlapped Stripe look</source>
|
||||
<oldsource>Overlaped Stripe look</oldsource>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Restart is needed</source>
|
||||
<translation type="obsolete">Es necesario reiniciar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="79"/>
|
||||
<source>Comics directory</source>
|
||||
<translation>Directorio de cómics</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="91"/>
|
||||
<source>Saving config file....</source>
|
||||
<translatorcomment>Hubo un problema al guardar la configuración de YACReaderLibrary. Por favor, comprueba si tienes suficientes permisos en el directorio raíz de YACReader.</translatorcomment>
|
||||
<translation>Guardando archivo de configuración...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="options_dialog.cpp" line="91"/>
|
||||
<source>There was a problem saving YACReaderLibrary configuration. Please, check if you have enough permissions in the YACReader root folder.</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>PropertiesDialog</name>
|
||||
<message>
|
||||
<location filename="properties_dialog.cpp" line="36"/>
|
||||
<source>Comic properties</source>
|
||||
<translation>Propiedades del cómic</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="properties_dialog.cpp" line="67"/>
|
||||
<source>Name : </source>
|
||||
<translation>Nombre : </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="properties_dialog.cpp" line="71"/>
|
||||
<source>Number of pages : </source>
|
||||
<translation>Número de páginas : </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="properties_dialog.cpp" line="76"/>
|
||||
<source>Size : </source>
|
||||
<translation>Tamaño : </translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QPushButton</name>
|
||||
<message>
|
||||
<source>Hello world!</source>
|
||||
<translation type="obsolete">Hola mundo!</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RenameLibraryDialog</name>
|
||||
<message>
|
||||
<location filename="rename_library_dialog.cpp" line="17"/>
|
||||
<source>New Library Name : </source>
|
||||
<translation>Nombre de la nueva librería :</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="rename_library_dialog.cpp" line="21"/>
|
||||
<source>Rename</source>
|
||||
<translation>Renombrar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="rename_library_dialog.cpp" line="25"/>
|
||||
<source>Cancel</source>
|
||||
<translation>Cancelar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="rename_library_dialog.cpp" line="53"/>
|
||||
<source>Rename current library</source>
|
||||
<translation>Renombrar la libreria seleccionada</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ThumbnailCreator</name>
|
||||
<message>
|
||||
<source>7z not found</source>
|
||||
<translation type="obsolete">7z no encontrado</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>7z wasn't found in your PATH.</source>
|
||||
<translation type="obsolete">7z no ha sido encontrado en tu PATH.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>7z crashed</source>
|
||||
<translation type="obsolete">fallo en 7z</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>7z crashed.</source>
|
||||
<translation type="obsolete">fallo en 7z.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>7z reading</source>
|
||||
<translation type="obsolete">Leyendo de 7z</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>problem reading from 7z</source>
|
||||
<translation type="obsolete">Problema lenyendo de 7z</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>7z problem</source>
|
||||
<translation type="obsolete">Problema en 7z</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unknown error 7z</source>
|
||||
<translation type="obsolete">Error desconocido en 7z</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>UpdateLibraryDialog</name>
|
||||
<message>
|
||||
<location filename="create_library_dialog.cpp" line="118"/>
|
||||
<source>Updating....</source>
|
||||
<translation>Actualizado...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="create_library_dialog.cpp" line="123"/>
|
||||
<source>Cancel</source>
|
||||
<translation>Cancelar</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
93
common/check_new_version.cpp
Normal file
@ -0,0 +1,93 @@
|
||||
#include "check_new_version.h"
|
||||
#include <QMessageBox>
|
||||
#include <QUrl>
|
||||
#include <QtGlobal>
|
||||
#include <QStringList>
|
||||
|
||||
#define VERSION "0.4.5"
|
||||
|
||||
HttpVersionChecker::HttpVersionChecker()
|
||||
:QWidget()
|
||||
{
|
||||
http = new QHttp(this);
|
||||
|
||||
connect(http, SIGNAL(requestFinished(int, bool)),
|
||||
this, SLOT(httpRequestFinished(int, bool)));
|
||||
|
||||
connect(http, SIGNAL(responseHeaderReceived(const QHttpResponseHeader &)),
|
||||
this, SLOT(readResponseHeader(const QHttpResponseHeader &)));
|
||||
|
||||
connect(http, SIGNAL(readyRead(const QHttpResponseHeader &)),
|
||||
this, SLOT(read(const QHttpResponseHeader &)));
|
||||
}
|
||||
|
||||
void HttpVersionChecker::get()
|
||||
{
|
||||
QUrl url("http://code.google.com/p/yacreader/downloads/list");
|
||||
QHttp::ConnectionMode mode = QHttp::ConnectionModeHttp;
|
||||
http->setHost(url.host(), mode, url.port() == -1 ? 0 : url.port());
|
||||
QByteArray path = QUrl::toPercentEncoding(url.path(), "!$&'()*+,;=:@/");
|
||||
if (path.isEmpty())
|
||||
path = "/";
|
||||
httpGetId = http->get(path, 0);
|
||||
}
|
||||
void HttpVersionChecker::readResponseHeader(const QHttpResponseHeader &responseHeader)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void HttpVersionChecker::read(const QHttpResponseHeader &){
|
||||
content.append(http->readAll());
|
||||
}
|
||||
|
||||
void HttpVersionChecker::httpRequestFinished(int requestId, bool error)
|
||||
{
|
||||
|
||||
QString response(content);
|
||||
#ifdef Q_WS_WIN
|
||||
QRegExp rx(".*YACReader\\-([0-9]+).([0-9]+).([0-9]+)\\.?([0-9]+)?.{0,5}win32.*");
|
||||
#endif
|
||||
|
||||
#ifdef Q_WS_X11
|
||||
QRegExp rx(".*YACReader\\-([0-9]+).([0-9]+).([0-9]+)\\.?([0-9]+)?.{0,5}X11.*");
|
||||
#endif
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
QRegExp rx(".*YACReader\\-([0-9]+).([0-9]+).([0-9]+)\\.?([0-9]+)?.{0,5}Mac.*");
|
||||
#endif
|
||||
|
||||
int index = 0;
|
||||
bool newVersion = false;
|
||||
bool sameVersion = true;
|
||||
//bool currentVersionIsNewer = false;
|
||||
|
||||
QString version(VERSION);
|
||||
QStringList sl = version.split(".");
|
||||
if((index = rx.indexIn(response))!=-1)
|
||||
{
|
||||
int length = qMin(sl.size(),(rx.cap(4)!="")?4:3);
|
||||
for(int i=0;i<length;i++)
|
||||
{
|
||||
if(rx.cap(i+1).toInt()<sl.at(i).toInt())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(rx.cap(i+1).toInt()>sl.at(i).toInt()){
|
||||
newVersion=true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
sameVersion = sameVersion && rx.cap(i+1).toInt()==sl.at(i).toInt();
|
||||
}
|
||||
if(!newVersion && sameVersion)
|
||||
{
|
||||
if((sl.size()==3)&&(rx.cap(4)!=""))
|
||||
newVersion = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(newVersion == true)
|
||||
emit newVersionDetected();
|
||||
}
|
29
common/check_new_version.h
Normal file
@ -0,0 +1,29 @@
|
||||
#ifndef __CHECKUPDATE_H
|
||||
#define __CHECKUPDATE_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QHttp>
|
||||
#include <QHttpResponseHeader>
|
||||
#include <QByteArray>
|
||||
|
||||
class HttpVersionChecker : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HttpVersionChecker();
|
||||
bool thereIsNewVersion();
|
||||
public slots:
|
||||
void httpRequestFinished(int requestId, bool error);
|
||||
void readResponseHeader(const QHttpResponseHeader &);
|
||||
void read(const QHttpResponseHeader &);
|
||||
void get();
|
||||
private:
|
||||
QHttp *http;
|
||||
int httpGetId;
|
||||
QByteArray content;
|
||||
bool found;
|
||||
signals:
|
||||
void newVersionDetected();
|
||||
};
|
||||
|
||||
#endif
|
370
common/custom_widgets.cpp
Normal file
@ -0,0 +1,370 @@
|
||||
#include "custom_widgets.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QVBoxLayout>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#include <QScrollBar>
|
||||
#include <QFont>
|
||||
#include <QMouseEvent>
|
||||
#include <QStyleOptionViewItem>
|
||||
#include <QStyleOptionViewItemV4>
|
||||
#include <QPainter>
|
||||
#include <QtGlobal>
|
||||
#include <QDesktopWidget>
|
||||
#include <QApplication>
|
||||
#include <QPushButton>
|
||||
#include <QFileSystemModel>
|
||||
|
||||
#include "qnaturalsorting.h"
|
||||
|
||||
|
||||
|
||||
|
||||
HelpAboutDialog::HelpAboutDialog(QWidget * parent)
|
||||
:QDialog(parent)
|
||||
{
|
||||
QVBoxLayout * layout = new QVBoxLayout();
|
||||
|
||||
tabWidget = new QTabWidget();
|
||||
|
||||
tabWidget->addTab(aboutText = new QTextBrowser(), tr("About"));
|
||||
aboutText->setOpenExternalLinks(true);
|
||||
aboutText->setFont(QFont("Comic Sans MS", 10)); //purisa
|
||||
tabWidget->addTab(helpText = new QTextBrowser(), tr("Help"));
|
||||
helpText->setOpenExternalLinks(true);
|
||||
helpText->setFont(QFont("Comic Sans MS", 10));
|
||||
//helpText->setDisabled(true);
|
||||
//tabWidget->addTab(,"About Qt");
|
||||
|
||||
layout->addWidget(tabWidget);
|
||||
layout->setContentsMargins(1,3,1,1);
|
||||
|
||||
setLayout(layout);
|
||||
resize(500, QApplication::desktop()->availableGeometry().height()*0.83);
|
||||
}
|
||||
|
||||
HelpAboutDialog::HelpAboutDialog(const QString & pathAbout,const QString & pathHelp,QWidget * parent)
|
||||
:QDialog(parent)
|
||||
{
|
||||
loadAboutInformation(pathAbout);
|
||||
loadHelp(pathHelp);
|
||||
}
|
||||
|
||||
void HelpAboutDialog::loadAboutInformation(const QString & path)
|
||||
{
|
||||
aboutText->insertHtml(fileToString(path));
|
||||
aboutText->moveCursor(QTextCursor::Start);
|
||||
}
|
||||
|
||||
void HelpAboutDialog::loadHelp(const QString & path)
|
||||
{
|
||||
helpText->insertHtml(fileToString(path));
|
||||
helpText->moveCursor(QTextCursor::Start);
|
||||
}
|
||||
|
||||
QString HelpAboutDialog::fileToString(const QString & path)
|
||||
{
|
||||
QFile f(path);
|
||||
f.open(QIODevice::ReadOnly);
|
||||
QTextStream txtS(&f);
|
||||
QString content = txtS.readAll();
|
||||
f.close();
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
void delTree(QDir dir)
|
||||
{
|
||||
dir.setFilter(QDir::AllDirs|QDir::Files|QDir::Hidden|QDir::NoDotAndDotDot);
|
||||
QFileInfoList list = dir.entryInfoList();
|
||||
for (int i = 0; i < list.size(); ++i)
|
||||
{
|
||||
QFileInfo fileInfo = list.at(i);
|
||||
if(fileInfo.isDir())
|
||||
{
|
||||
delTree(QDir(fileInfo.absoluteFilePath()));
|
||||
dir.rmdir(fileInfo.absoluteFilePath());
|
||||
}
|
||||
else
|
||||
{
|
||||
dir.remove(fileInfo.absoluteFilePath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
YACReaderIconProvider::YACReaderIconProvider()
|
||||
:QFileIconProvider()
|
||||
{
|
||||
}
|
||||
|
||||
QIcon YACReaderIconProvider::icon(IconType type) const
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case Folder:
|
||||
return QIcon(":/images/folder.png");
|
||||
break;
|
||||
case File:
|
||||
return QIcon(":/images/icon.png");
|
||||
break;
|
||||
default:
|
||||
return QFileIconProvider::icon(type);
|
||||
}
|
||||
}
|
||||
QIcon YACReaderIconProvider::icon(const QFileInfo & info) const
|
||||
{
|
||||
if(info.isDir())
|
||||
return QIcon(":/images/folder.png");
|
||||
if(info.isFile())
|
||||
return QIcon(":/images/icon.png");
|
||||
}
|
||||
QString YACReaderIconProvider::type(const QFileInfo & info) const
|
||||
{
|
||||
return QFileIconProvider::type(info);
|
||||
}
|
||||
|
||||
YACReaderFlow::YACReaderFlow(QWidget * parent,FlowType flowType) : PictureFlow(parent,flowType) {}
|
||||
|
||||
void YACReaderFlow::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
if(event->x() > (width()+slideSize().width())/2)
|
||||
showNext();
|
||||
else
|
||||
if(event->x() < (width()-slideSize().width())/2)
|
||||
showPrevious();
|
||||
//else (centered cover space)
|
||||
}
|
||||
|
||||
void YACReaderFlow::mouseDoubleClickEvent(QMouseEvent* event)
|
||||
{
|
||||
if((event->x() > (width()-slideSize().width())/2)&&(event->x() < (width()+slideSize().width())/2))
|
||||
emit selected(centerIndex());
|
||||
}
|
||||
|
||||
YACReaderComicDirModel::YACReaderComicDirModel( const QStringList & nameFilters, QDir::Filters filters, QDir::SortFlags sort, QObject * parent )
|
||||
:QDirModel(nameFilters,filters,sort,parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//this method isn't used to show fileName on QListView
|
||||
QString YACReaderComicDirModel::fileName ( const QModelIndex & index ) const
|
||||
{
|
||||
QString fileName = QDirModel::fileName(index);
|
||||
return fileName.remove(fileName.size()-4,4);
|
||||
}
|
||||
|
||||
QFileInfo YACReaderComicDirModel::fileInfo ( const QModelIndex & index ) const
|
||||
{
|
||||
QFileInfo fileInfo = QDirModel::fileInfo(index);
|
||||
QString path = QDir::cleanPath(filePath(index)).remove("/.yacreaderlibrary");
|
||||
path.remove(path.size()-4,4);
|
||||
fileInfo.setFile(path);
|
||||
return fileInfo;
|
||||
}
|
||||
|
||||
|
||||
YACReaderComicViewDelegate::YACReaderComicViewDelegate(QObject * parent)
|
||||
:QItemDelegate(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void YACReaderComicViewDelegate::paint ( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const
|
||||
{
|
||||
QStyleOptionViewItemV4 opt = setOptions(index, option);
|
||||
|
||||
const QStyleOptionViewItemV2 *v2 = qstyleoption_cast<const QStyleOptionViewItemV2 *>(&option);
|
||||
opt.features = v2 ? v2->features
|
||||
: QStyleOptionViewItemV2::ViewItemFeatures(QStyleOptionViewItemV2::None);
|
||||
const QStyleOptionViewItemV3 *v3 = qstyleoption_cast<const QStyleOptionViewItemV3 *>(&option);
|
||||
opt.locale = v3 ? v3->locale : QLocale();
|
||||
opt.widget = v3 ? v3->widget : 0;
|
||||
|
||||
// prepare
|
||||
painter->save();
|
||||
painter->setClipRect(opt.rect);
|
||||
|
||||
// get the data and the rectangles
|
||||
|
||||
QVariant value;
|
||||
|
||||
QPixmap pixmap;
|
||||
QRect decorationRect;
|
||||
QIcon icon;
|
||||
value = index.data(Qt::DecorationRole);
|
||||
if (value.isValid()) {
|
||||
// ### we need the pixmap to call the virtual function
|
||||
pixmap = decoration(opt, value);
|
||||
if (value.type() == QVariant::Icon) {
|
||||
icon = qvariant_cast<QIcon>(value);
|
||||
const QSize size = icon.actualSize(option.decorationSize);
|
||||
decorationRect = QRect(QPoint(0, 0), size);
|
||||
} else {
|
||||
icon = QIcon();
|
||||
decorationRect = QRect(QPoint(0, 0), pixmap.size());
|
||||
}
|
||||
} else {
|
||||
icon = QIcon();
|
||||
decorationRect = QRect();
|
||||
}
|
||||
|
||||
QString text;
|
||||
QRect displayRect;
|
||||
value = index.data(Qt::DisplayRole);
|
||||
if (value.isValid() && !value.isNull()) {
|
||||
text = value.toString();
|
||||
text.remove(text.size()-4,4);
|
||||
displayRect = textRectangle(painter, textLayoutBounds(opt), opt.font, text);
|
||||
}
|
||||
|
||||
QRect checkRect;
|
||||
Qt::CheckState checkState = Qt::Unchecked;
|
||||
value = index.data(Qt::CheckStateRole);
|
||||
if (value.isValid()) {
|
||||
checkState = static_cast<Qt::CheckState>(value.toInt());
|
||||
checkRect = check(opt, opt.rect, value);
|
||||
}
|
||||
|
||||
// do the layout
|
||||
|
||||
doLayout(opt, &checkRect, &decorationRect, &displayRect, false);
|
||||
|
||||
// draw the item
|
||||
|
||||
drawBackground(painter, opt, index);
|
||||
drawCheck(painter, opt, checkRect, checkState);
|
||||
drawDecoration(painter, opt, decorationRect, pixmap);
|
||||
drawDisplay(painter, opt, displayRect, text);
|
||||
drawFocus(painter, opt, displayRect);
|
||||
|
||||
// done
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
QRect YACReaderComicViewDelegate::textLayoutBounds(const QStyleOptionViewItemV2 &option) const
|
||||
{
|
||||
QRect rect = option.rect;
|
||||
const bool wrapText = option.features & QStyleOptionViewItemV2::WrapText;
|
||||
switch (option.decorationPosition) {
|
||||
case QStyleOptionViewItem::Left:
|
||||
case QStyleOptionViewItem::Right:
|
||||
rect.setWidth(wrapText && rect.isValid() ? rect.width() : (1000));
|
||||
break;
|
||||
case QStyleOptionViewItem::Top:
|
||||
case QStyleOptionViewItem::Bottom:
|
||||
rect.setWidth(wrapText ? option.decorationSize.width() : (1000));
|
||||
break;
|
||||
}
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
||||
YACReaderTreeSearch::YACReaderTreeSearch(QObject * parent)
|
||||
:QSortFilterProxyModel(parent),cache(new ModelIndexCache())
|
||||
{
|
||||
this->setFilterCaseSensitivity(Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
bool YACReaderTreeSearch::containsFiles(QString path,const QRegExp &exp) const
|
||||
{
|
||||
QDir dir(path);
|
||||
QStringList list = dir.entryList(QStringList() << "*"+exp.pattern()+"*",QDir::Files | QDir::NoDotAndDotDot);
|
||||
return list.size()>0;
|
||||
}
|
||||
|
||||
bool YACReaderTreeSearch::itemMatchesExpression(const QModelIndex &index, const QRegExp &exp) const
|
||||
{
|
||||
|
||||
QString name = ((QFileSystemModel *)sourceModel())->filePath(index);
|
||||
ModelIndexCache::CacheData cd = cache->getCacheData(name);
|
||||
bool v = false;
|
||||
if(!cd.visited || cd.acepted)
|
||||
{
|
||||
v = name.contains(exp);// || containsFiles(name,exp); // TODO : complete path?
|
||||
int numChildren = sourceModel()->rowCount(index);
|
||||
for(int i=0; i<numChildren;i++)
|
||||
{
|
||||
if(v) break;
|
||||
v = v || itemMatchesExpression(sourceModel()->index(i,0,index), exp);
|
||||
}
|
||||
cd.visited = true;
|
||||
cd.acepted = v;
|
||||
cache->setModelIndex(name,cd);
|
||||
}
|
||||
|
||||
return cd.acepted;
|
||||
}
|
||||
|
||||
bool YACReaderTreeSearch::filterAcceptsRow ( int sourceRow, const QModelIndex & sourceParent ) const
|
||||
{
|
||||
QString name = sourceModel()->data(sourceModel()->index(sourceRow, 0, sourceParent),Qt::DisplayRole ).toString();
|
||||
QFileSystemModel * dm = (QFileSystemModel *)sourceModel();
|
||||
if(!dm->isDir(dm->index(sourceRow, 0, sourceParent)))
|
||||
//if(name.endsWith(".jpg")||name.endsWith(".db")) //TODO: if is not a dir
|
||||
return false;
|
||||
if(filterRegExp().isEmpty())
|
||||
return true;
|
||||
if(name.contains("yacreader"))
|
||||
return true;
|
||||
QString path = dm->filePath(dm->index(sourceRow, 0, sourceParent));
|
||||
if(path.contains("yacreaderlibrary"))
|
||||
return itemMatchesExpression(sourceModel()->index(sourceRow, 0, sourceParent), filterRegExp());
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
void YACReaderTreeSearch::reset()
|
||||
{
|
||||
//invalidateFilter();
|
||||
cache->clear();
|
||||
}
|
||||
|
||||
void YACReaderTreeSearch::softReset()
|
||||
{
|
||||
//invalidateFilter();
|
||||
}
|
||||
|
||||
ModelIndexCache::ModelIndexCache()
|
||||
:cache()
|
||||
{
|
||||
}
|
||||
|
||||
void ModelIndexCache::setModelIndex(const QString & index, const CacheData & cd)
|
||||
{
|
||||
cache.insert(index,cd);
|
||||
}
|
||||
ModelIndexCache::CacheData ModelIndexCache::getCacheData(const QString & index) const
|
||||
{
|
||||
if(cache.contains(index))
|
||||
return cache.value(index);
|
||||
else
|
||||
{
|
||||
CacheData cd;
|
||||
cd.visited = false;
|
||||
cd.acepted = true;
|
||||
return cd;
|
||||
}
|
||||
}
|
||||
|
||||
void ModelIndexCache::clear()
|
||||
{
|
||||
cache.clear();
|
||||
}
|
||||
|
||||
YACReaderSortComics::YACReaderSortComics(QObject * parent)
|
||||
:QSortFilterProxyModel(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool YACReaderSortComics::lessThan(const QModelIndex &left, const QModelIndex &right) const
|
||||
{
|
||||
QVariant leftData = sourceModel()->data(left);
|
||||
QVariant rightData = sourceModel()->data(right);
|
||||
|
||||
QString leftString = leftData.toString();
|
||||
QString rightString = rightData.toString();
|
||||
|
||||
return naturalSortLessThanCI(leftString,rightString);
|
||||
}
|
138
common/custom_widgets.h
Normal file
@ -0,0 +1,138 @@
|
||||
#ifndef __CUSTOM_WIDGETS_H
|
||||
#define __CUSTOM_WIDGETS_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QHBoxLayout>
|
||||
#include <QTabWidget>
|
||||
#include <QTextBrowser>
|
||||
#include <QDir>
|
||||
#include <QFileIconProvider>
|
||||
#include <QDirModel>
|
||||
#include <QFileInfo>
|
||||
#include <QItemDelegate>
|
||||
#include <QStyleOptionViewItemV2>
|
||||
#include <QStyleOptionViewItemV4>
|
||||
#include <QVariant>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QModelIndex>
|
||||
#include <QRegExp>
|
||||
#include <QHash>
|
||||
|
||||
|
||||
#include "pictureflow.h"
|
||||
|
||||
class QToolBarStretch : public QWidget
|
||||
{
|
||||
public:
|
||||
QToolBarStretch(QWidget * parent=0):QWidget(parent)
|
||||
{
|
||||
QHBoxLayout * l= new QHBoxLayout();
|
||||
l->addStretch();
|
||||
setLayout(l);
|
||||
}
|
||||
};
|
||||
|
||||
class HelpAboutDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HelpAboutDialog(QWidget * parent=0);
|
||||
HelpAboutDialog(const QString & pathAbout,const QString & pathHelp,QWidget * parent =0);
|
||||
public slots:
|
||||
void loadAboutInformation(const QString & path);
|
||||
void loadHelp(const QString & path);
|
||||
|
||||
private:
|
||||
QTabWidget *tabWidget;
|
||||
QTextBrowser *aboutText;
|
||||
QTextBrowser *helpText;
|
||||
QString fileToString(const QString & path);
|
||||
};
|
||||
|
||||
class YACReaderIconProvider : public QFileIconProvider
|
||||
{
|
||||
public:
|
||||
YACReaderIconProvider();
|
||||
virtual QIcon icon ( IconType type ) const;
|
||||
virtual QIcon icon ( const QFileInfo & info ) const;
|
||||
virtual QString type ( const QFileInfo & info ) const;
|
||||
};
|
||||
|
||||
class YACReaderFlow : public PictureFlow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
YACReaderFlow(QWidget * parent,FlowType flowType = CoverFlowLike);
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
void mouseDoubleClickEvent(QMouseEvent* event);
|
||||
|
||||
signals:
|
||||
void selected(unsigned int centerIndex);
|
||||
};
|
||||
|
||||
class YACReaderComicDirModel : public QDirModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
YACReaderComicDirModel( const QStringList & nameFilters, QDir::Filters filters, QDir::SortFlags sort, QObject * parent = 0 );
|
||||
QString fileName ( const QModelIndex & index ) const;
|
||||
QFileInfo fileInfo ( const QModelIndex & index ) const;
|
||||
};
|
||||
|
||||
class YACReaderComicViewDelegate : public QItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
YACReaderComicViewDelegate(QObject * parent = 0);
|
||||
virtual void paint ( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const;
|
||||
QRect textLayoutBounds(const QStyleOptionViewItemV2 &option) const;
|
||||
};
|
||||
|
||||
class ModelIndexCache
|
||||
{
|
||||
|
||||
public:
|
||||
struct CacheData{
|
||||
bool visited;
|
||||
bool acepted;
|
||||
};
|
||||
ModelIndexCache();
|
||||
void setModelIndex(const QString & index, const CacheData & cd);
|
||||
CacheData getCacheData(const QString & index) const;
|
||||
void clear();
|
||||
|
||||
|
||||
private:
|
||||
QHash<QString, CacheData> cache;
|
||||
};
|
||||
|
||||
|
||||
class YACReaderTreeSearch : public QSortFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
YACReaderTreeSearch(QObject * parent = 0);
|
||||
protected:
|
||||
virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex & source_parent ) const;
|
||||
bool itemMatchesExpression(const QModelIndex &index, const QRegExp &exp) const;
|
||||
bool containsFiles(QString path,const QRegExp &exp) const;
|
||||
public slots:
|
||||
void reset();
|
||||
void softReset();
|
||||
private:
|
||||
ModelIndexCache * cache;
|
||||
};
|
||||
|
||||
class YACReaderSortComics : public QSortFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
YACReaderSortComics(QObject * parent = 0);
|
||||
protected:
|
||||
bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
|
||||
};
|
||||
|
||||
void delTree(QDir dir);
|
||||
#endif
|
||||
|
1298
common/pictureflow.cpp
Normal file
223
common/pictureflow.h
Normal file
@ -0,0 +1,223 @@
|
||||
/*
|
||||
PictureFlow - animated image show widget
|
||||
http://pictureflow.googlecode.com
|
||||
|
||||
Copyright (C) 2008 Ariya Hidayat (ariya@kde.org)
|
||||
Copyright (C) 2007 Ariya Hidayat (ariya@kde.org)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef PICTUREFLOW_H
|
||||
#define PICTUREFLOW_H
|
||||
|
||||
#include <qwidget.h>
|
||||
|
||||
class PictureFlowPrivate;
|
||||
|
||||
/*!
|
||||
Class PictureFlow implements an image show widget with animation effect
|
||||
like Apple's CoverFlow (in iTunes and iPod). Images are arranged in form
|
||||
of slides, one main slide is shown at the center with few slides on
|
||||
the left and right sides of the center slide. When the next or previous
|
||||
slide is brought to the front, the whole slides flow to the right or
|
||||
the right with smooth animation effect; until the new slide is finally
|
||||
placed at the center.
|
||||
|
||||
*/
|
||||
class PictureFlow : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor)
|
||||
Q_PROPERTY(QSize slideSize READ slideSize WRITE setSlideSize)
|
||||
Q_PROPERTY(int slideCount READ slideCount)
|
||||
Q_PROPERTY(int centerIndex READ centerIndex WRITE setCenterIndex)
|
||||
|
||||
public:
|
||||
|
||||
enum ReflectionEffect
|
||||
{
|
||||
NoReflection,
|
||||
PlainReflection,
|
||||
BlurredReflection
|
||||
};
|
||||
|
||||
enum FlowType
|
||||
{
|
||||
CoverFlowLike,
|
||||
Strip,
|
||||
StripOverlapped
|
||||
};
|
||||
|
||||
/*!
|
||||
Creates a new PictureFlow widget.
|
||||
*/
|
||||
PictureFlow(QWidget* parent = 0, FlowType flowType = CoverFlowLike);
|
||||
|
||||
/*!
|
||||
Destroys the widget.
|
||||
*/
|
||||
~PictureFlow();
|
||||
|
||||
/*!
|
||||
Returns the background color.
|
||||
*/
|
||||
QColor backgroundColor() const;
|
||||
|
||||
/*!
|
||||
Sets the background color. By default it is black.
|
||||
*/
|
||||
void setBackgroundColor(const QColor& c);
|
||||
|
||||
/*!
|
||||
Returns the dimension of each slide (in pixels).
|
||||
*/
|
||||
QSize slideSize() const;
|
||||
|
||||
/*!
|
||||
Sets the dimension of each slide (in pixels).
|
||||
*/
|
||||
void setSlideSize(QSize size);
|
||||
|
||||
/*!
|
||||
Returns the total number of slides.
|
||||
*/
|
||||
int slideCount() const;
|
||||
|
||||
/*!
|
||||
Returns QImage of specified slide.
|
||||
*/
|
||||
QImage slide(int index) const;
|
||||
|
||||
/*!
|
||||
Returns the index of slide currently shown in the middle of the viewport.
|
||||
*/
|
||||
int centerIndex() const;
|
||||
|
||||
/*!
|
||||
Returns the effect applied to the reflection.
|
||||
*/
|
||||
ReflectionEffect reflectionEffect() const;
|
||||
|
||||
/*!
|
||||
Sets the effect applied to the reflection. The default is PlainReflection.
|
||||
*/
|
||||
void setReflectionEffect(ReflectionEffect effect);
|
||||
|
||||
|
||||
public slots:
|
||||
|
||||
/*!
|
||||
Adds a new slide.
|
||||
*/
|
||||
void addSlide(const QImage& image);
|
||||
|
||||
/*!
|
||||
Adds a new slide.
|
||||
*/
|
||||
void addSlide(const QPixmap& pixmap);
|
||||
|
||||
/*!
|
||||
Sets an image for specified slide. If the slide already exists,
|
||||
it will be replaced.
|
||||
*/
|
||||
void setSlide(int index, const QImage& image);
|
||||
|
||||
/*!
|
||||
Sets a pixmap for specified slide. If the slide already exists,
|
||||
it will be replaced.
|
||||
*/
|
||||
void setSlide(int index, const QPixmap& pixmap);
|
||||
|
||||
/*!
|
||||
Sets slide to be shown in the middle of the viewport. No animation
|
||||
effect will be produced, unlike using showSlide.
|
||||
*/
|
||||
void setCenterIndex(int index);
|
||||
|
||||
/*!
|
||||
Clears all slides.
|
||||
*/
|
||||
void clear();
|
||||
|
||||
/*!
|
||||
Shows previous slide using animation effect.
|
||||
*/
|
||||
void showPrevious();
|
||||
|
||||
/*!
|
||||
Shows next slide using animation effect.
|
||||
*/
|
||||
void showNext();
|
||||
|
||||
/*!
|
||||
Go to specified slide using animation effect.
|
||||
*/
|
||||
void showSlide(int index);
|
||||
|
||||
/*!
|
||||
Rerender the widget. Normally this function will be automatically invoked
|
||||
whenever necessary, e.g. during the transition animation.
|
||||
*/
|
||||
void render();
|
||||
|
||||
/*!
|
||||
Schedules a rendering update. Unlike render(), this function does not cause
|
||||
immediate rendering.
|
||||
*/
|
||||
void triggerRender();
|
||||
|
||||
void setFlowType(FlowType flowType);
|
||||
|
||||
void setMarkImage(const QImage & mark);
|
||||
|
||||
void markSlide(int index);
|
||||
|
||||
void updateMarks();
|
||||
|
||||
void unmarkSlide(int index);
|
||||
|
||||
void setMarks(const QVector<bool> & marks);
|
||||
|
||||
void setShowMarks(bool enable);
|
||||
|
||||
QVector<bool> getMarks();
|
||||
|
||||
|
||||
signals:
|
||||
void centerIndexChanged(int index);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void keyPressEvent(QKeyEvent* event);
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
void resizeEvent(QResizeEvent* event);
|
||||
|
||||
private slots:
|
||||
void updateAnimation();
|
||||
|
||||
private:
|
||||
PictureFlowPrivate* d;
|
||||
QImage mark;
|
||||
QVector<bool> marks;
|
||||
};
|
||||
|
||||
#endif // PICTUREFLOW_H
|
||||
|
257
common/qnaturalsorting.cpp
Normal file
@ -0,0 +1,257 @@
|
||||
/* This file contains parts of the KDE libraries
|
||||
Copyright (C) 1999 Ian Zepp (icszepp@islc.net)
|
||||
Copyright (C) 2006 by Dominic Battre <dominic@battre.de>
|
||||
Copyright (C) 2006 by Martin Pool <mbp@canonical.com>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "qnaturalsorting.h"
|
||||
|
||||
//from KDE
|
||||
/*
|
||||
int naturalCompare(const QString &_a, const QString &_b, Qt::CaseSensitivity caseSensitivity)
|
||||
{
|
||||
// This method chops the input a and b into pieces of
|
||||
// digits and non-digits (a1.05 becomes a | 1 | . | 05)
|
||||
// and compares these pieces of a and b to each other
|
||||
// (first with first, second with second, ...).
|
||||
//
|
||||
// This is based on the natural sort order code code by Martin Pool
|
||||
// http://sourcefrog.net/projects/natsort/
|
||||
// Martin Pool agreed to license this under LGPL or GPL.
|
||||
|
||||
// FIXME: Using toLower() to implement case insensitive comparison is
|
||||
// sub-optimal, but is needed because we compare strings with
|
||||
// localeAwareCompare(), which does not know about case sensitivity.
|
||||
// A task has been filled for this in Qt Task Tracker with ID 205990.
|
||||
// http://trolltech.com/developer/task-tracker/index_html?method=entry&id=205990
|
||||
QString a;
|
||||
QString b;
|
||||
if (caseSensitivity == Qt::CaseSensitive) {
|
||||
a = _a;
|
||||
b = _b;
|
||||
} else {
|
||||
a = _a.toLower();
|
||||
b = _b.toLower();
|
||||
}
|
||||
|
||||
const QChar* currA = a.unicode(); // iterator over a
|
||||
const QChar* currB = b.unicode(); // iterator over b
|
||||
|
||||
if (currA == currB) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const QChar* begSeqA = currA; // beginning of a new character sequence of a
|
||||
const QChar* begSeqB = currB;
|
||||
|
||||
while (!currA->isNull() && !currB->isNull()) {
|
||||
if (currA->unicode() == QChar::ObjectReplacementCharacter) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (currB->unicode() == QChar::ObjectReplacementCharacter) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (currA->unicode() == QChar::ReplacementCharacter) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (currB->unicode() == QChar::ReplacementCharacter) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// find sequence of characters ending at the first non-character
|
||||
while (!currA->isNull() && !currA->isDigit() && !currA->isPunct() && !currA->isSpace()) {
|
||||
++currA;
|
||||
}
|
||||
|
||||
while (!currB->isNull() && !currB->isDigit() && !currB->isPunct() && !currB->isSpace()) {
|
||||
++currB;
|
||||
}
|
||||
|
||||
// compare these sequences
|
||||
const QStringRef& subA(a.midRef(begSeqA - a.unicode(), currA - begSeqA));
|
||||
const QStringRef& subB(b.midRef(begSeqB - b.unicode(), currB - begSeqB));
|
||||
const int cmp = QStringRef::localeAwareCompare(subA, subB);
|
||||
if (cmp != 0) {
|
||||
return cmp < 0 ? -1 : +1;
|
||||
}
|
||||
|
||||
if (currA->isNull() || currB->isNull()) {
|
||||
break;
|
||||
}
|
||||
|
||||
// find sequence of characters ending at the first non-character
|
||||
while (currA->isPunct() || currA->isSpace() || currB->isPunct() || currB->isSpace()) {
|
||||
if (*currA != *currB) {
|
||||
return (*currA < *currB) ? -1 : +1;
|
||||
}
|
||||
++currA;
|
||||
++currB;
|
||||
}
|
||||
|
||||
// now some digits follow...
|
||||
if ((*currA == '0') || (*currB == '0')) {
|
||||
// one digit-sequence starts with 0 -> assume we are in a fraction part
|
||||
// do left aligned comparison (numbers are considered left aligned)
|
||||
while (1) {
|
||||
if (!currA->isDigit() && !currB->isDigit()) {
|
||||
break;
|
||||
} else if (!currA->isDigit()) {
|
||||
return +1;
|
||||
} else if (!currB->isDigit()) {
|
||||
return -1;
|
||||
} else if (*currA < *currB) {
|
||||
return -1;
|
||||
} else if (*currA > *currB) {
|
||||
return + 1;
|
||||
}
|
||||
++currA;
|
||||
++currB;
|
||||
}
|
||||
} else {
|
||||
// No digit-sequence starts with 0 -> assume we are looking at some integer
|
||||
// do right aligned comparison.
|
||||
//
|
||||
// The longest run of digits wins. That aside, the greatest
|
||||
// value wins, but we can't know that it will until we've scanned
|
||||
// both numbers to know that they have the same magnitude.
|
||||
|
||||
bool isFirstRun = true;
|
||||
int weight = 0;
|
||||
while (1) {
|
||||
if (!currA->isDigit() && !currB->isDigit()) {
|
||||
if (weight != 0) {
|
||||
return weight;
|
||||
}
|
||||
break;
|
||||
} else if (!currA->isDigit()) {
|
||||
if (isFirstRun) {
|
||||
return *currA < *currB ? -1 : +1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
} else if (!currB->isDigit()) {
|
||||
if (isFirstRun) {
|
||||
return *currA < *currB ? -1 : +1;
|
||||
} else {
|
||||
return +1;
|
||||
}
|
||||
} else if ((*currA < *currB) && (weight == 0)) {
|
||||
weight = -1;
|
||||
} else if ((*currA > *currB) && (weight == 0)) {
|
||||
weight = + 1;
|
||||
}
|
||||
++currA;
|
||||
++currB;
|
||||
isFirstRun = false;
|
||||
}
|
||||
}
|
||||
|
||||
begSeqA = currA;
|
||||
begSeqB = currB;
|
||||
}
|
||||
|
||||
if (currA->isNull() && currB->isNull()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return currA->isNull() ? -1 : + 1;
|
||||
}
|
||||
|
||||
*/
|
||||
static inline QChar getNextChar(const QString &s, int location)
|
||||
{
|
||||
return (location < s.length()) ? s.at(location) : QChar();
|
||||
}
|
||||
|
||||
int naturalCompare(const QString &s1, const QString &s2, Qt::CaseSensitivity cs)
|
||||
{
|
||||
for (int l1 = 0, l2 = 0; l1 <= s1.count() && l2 <= s2.count(); ++l1, ++l2) {
|
||||
// skip spaces, tabs and 0's
|
||||
QChar c1 = getNextChar(s1, l1);
|
||||
while (c1.isSpace())
|
||||
c1 = getNextChar(s1, ++l1);
|
||||
QChar c2 = getNextChar(s2, l2);
|
||||
while (c2.isSpace())
|
||||
c2 = getNextChar(s2, ++l2);
|
||||
|
||||
if (c1.isDigit() && c2.isDigit()) {
|
||||
while (c1.digitValue() == 0)
|
||||
c1 = getNextChar(s1, ++l1);
|
||||
while (c2.digitValue() == 0)
|
||||
c2 = getNextChar(s2, ++l2);
|
||||
|
||||
int lookAheadLocation1 = l1;
|
||||
int lookAheadLocation2 = l2;
|
||||
int currentReturnValue = 0;
|
||||
// find the last digit, setting currentReturnValue as we go if it isn't equal
|
||||
for (
|
||||
QChar lookAhead1 = c1, lookAhead2 = c2;
|
||||
(lookAheadLocation1 <= s1.length() && lookAheadLocation2 <= s2.length());
|
||||
lookAhead1 = getNextChar(s1, ++lookAheadLocation1),
|
||||
lookAhead2 = getNextChar(s2, ++lookAheadLocation2)
|
||||
) {
|
||||
bool is1ADigit = !lookAhead1.isNull() && lookAhead1.isDigit();
|
||||
bool is2ADigit = !lookAhead2.isNull() && lookAhead2.isDigit();
|
||||
if (!is1ADigit && !is2ADigit)
|
||||
break;
|
||||
if (!is1ADigit)
|
||||
return -1;
|
||||
if (!is2ADigit)
|
||||
return 1;
|
||||
if (currentReturnValue == 0) {
|
||||
if (lookAhead1 < lookAhead2) {
|
||||
currentReturnValue = -1;
|
||||
} else if (lookAhead1 > lookAhead2) {
|
||||
currentReturnValue = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (currentReturnValue != 0)
|
||||
return currentReturnValue;
|
||||
}
|
||||
|
||||
if (cs == Qt::CaseInsensitive) {
|
||||
if (!c1.isLower()) c1 = c1.toLower();
|
||||
if (!c2.isLower()) c2 = c2.toLower();
|
||||
}
|
||||
int r = QString::localeAwareCompare(c1, c2);
|
||||
if (r < 0)
|
||||
return -1;
|
||||
if (r > 0)
|
||||
return 1;
|
||||
}
|
||||
// The two strings are the same (02 == 2) so fall back to the normal sort
|
||||
return QString::compare(s1, s2, cs);
|
||||
}
|
||||
bool naturalSortLessThanCS( const QString &left, const QString &right )
|
||||
{
|
||||
return (naturalCompare( left, right, Qt::CaseSensitive ) < 0);
|
||||
}
|
||||
|
||||
bool naturalSortLessThanCI( const QString &left, const QString &right )
|
||||
{
|
||||
return (naturalCompare( left, right, Qt::CaseInsensitive ) < 0);
|
||||
}
|
||||
|
||||
bool naturalSortLessThanCIFileInfo(const QFileInfo & left,const QFileInfo & right)
|
||||
{
|
||||
return naturalSortLessThanCI(left.fileName(),right.fileName());
|
||||
}
|
13
common/qnaturalsorting.h
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
#ifndef __QNATURALSORTING_H
|
||||
#define __QNATURALSORTING_H
|
||||
|
||||
#include <QString>
|
||||
#include <QFileInfo>
|
||||
|
||||
bool naturalSortLessThanCS( const QString &left, const QString &right );
|
||||
bool naturalSortLessThanCI( const QString &left, const QString &right );
|
||||
bool naturalSortLessThanCIFileInfo(const QFileInfo & left,const QFileInfo & right);
|
||||
|
||||
#endif
|
29
files/about.html
Normal file
@ -0,0 +1,29 @@
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
YACReader - Yet Another Comic Reader - version 0.4.5 <br/>
|
||||
by Luis <20>ngel San Mart<72>n Rodr<64>guez <br/>
|
||||
e-mail: luisangelsm@gmail.com <br/>
|
||||
web site: <a href="http://code.google.com/p/yacreader/">http://code.google.com/p/yacreader/</a> <br/>
|
||||
Published under <a href="http://www.gnu.org/copyleft/gpl.html">GPL v3</a> license.
|
||||
<hr/>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If you like YACReader, please, consider to make a donation <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=5TAMNQCDDMVP8&lc=ES&item_name=YACReader¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted"> Donate! </a>
|
||||
<hr/>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Compressed files are loaded using <a href="http://www.7-zip.org/">7zip</a> (Windows version) and <a href="http://p7zip.sourceforge.net/">p7zip</a> (Linux/MacOS X versions)
|
||||
</p>
|
||||
<p>
|
||||
Flow effect uses <a href="http://code.google.com/p/pictureflow/">PictureFlow</a>.
|
||||
</p>
|
||||
<p>
|
||||
Icons were desinged by <a href="http://mattahan.deviantart.com/">Mattahan</a>.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
30
files/about_es_ES.html
Normal file
@ -0,0 +1,30 @@
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
<img src=":/images/icon.png" /> <br/>
|
||||
YACReader - Yet Another Comic Reader - versi<73>n 0.4.5 <br/>
|
||||
por Luis <20>ngel San Mart<72>n Rodr<64>guez <br/>
|
||||
e-mail: luisangelsm@gmail.com <br/>
|
||||
P<EFBFBD>gina web: <a href="http://code.google.com/p/yacreader/">http://code.google.com/p/yacreader/</a> <br/>
|
||||
Publicado bajo licencia <a href="http://www.gnu.org/copyleft/gpl.html">GPL v3</a>.
|
||||
<hr/>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Si te gusta YACReader, por favor, considera realizar una donaci<63>n. <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=5TAMNQCDDMVP8&lc=ES&item_name=YACReader¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted"> <20>Dona! </a>
|
||||
<hr/>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Los archivos comprimidos son cargados mediante <a href="http://www.7-zip.org/">7zip</a> (en Windows) y <a href="http://p7zip.sourceforge.net/">p7zip</a> (en las versiones Linux/MacOS X)
|
||||
</p>
|
||||
<p>
|
||||
Los efectos de animaci<63>n 'flow' usan <a href="http://code.google.com/p/pictureflow/">PictureFlow</a>.
|
||||
</p>
|
||||
<p>
|
||||
Los iconos han sido dise<73>ados por <a href="http://mattahan.deviantart.com/">Mattahan</a>.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
126
files/helpYACReader.html
Normal file
@ -0,0 +1,126 @@
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Quick start guide</h1>
|
||||
<h2>Features</h2>
|
||||
<p>
|
||||
YACReader is a fast and simple comic reader with the following features:
|
||||
<ul>
|
||||
<li>Multiplatform, there are Windows, Linux and MacOS X versions.</li>
|
||||
<li>cbr, cbz, rar, zip, tar and folders support</li>
|
||||
<li>jpeg, gif, png, tiff and bmp image support</li>
|
||||
<li>comic reading using keyboard and mouse</li>
|
||||
<li>fast open and comic navigation</li>
|
||||
<li>fullscreen mode</li>
|
||||
<li>configurable magnifying glass for improved reading, since 0.2.0 version is avaliable in windowed mode</li>
|
||||
<li>fit width (also adjust to an specific width) and fit height modes.</li>
|
||||
<li>configurable CoverFlow like effect for "go to page" function.</li>
|
||||
<li>image rotation for comfortable reading even in tablet PCs</li>
|
||||
<li>double page reading</li>
|
||||
<li>Comic bookmarks</li>
|
||||
</ul>
|
||||
</p>
|
||||
<h2>Functions and sortcuts</h2>
|
||||
<p>
|
||||
<b>General functions:</b>
|
||||
<ul>
|
||||
<li><img src=":/images/helpImages/open.png" align="middle"/>Open comic : 'O' key</li>
|
||||
<li><img src=":/images/helpImages/openFolder.png" align="middle"/>Open folder : 'Ctrl' + 'O' key</li>
|
||||
<li><img src=":/images/helpImages/nextComic.png" align="middle"/> Open next c<>mic : 'Ctrl' + 'Right'</li>
|
||||
<li><img src=":/images/helpImages/previousComic.png" align="middle"/> Open previous comic : 'Ctrl' + 'Left' key</li>
|
||||
<li><img src=":/images/helpImages/deleteLibrary.png" align="middle"/> Exit : 'Esc' key</li>
|
||||
<li><img src=":/images/helpImages/prev.png" align="middle"/> Go to previous page : 'Left' key</li>
|
||||
<li><img src=":/images/helpImages/next.png" align="middle"/>Go to next page : 'Right' key</li>
|
||||
<li><img src=":/images/helpImages/mouse.png" align="middle"/>Scroll up : 'Wheel mouse up' or 'Up' key </li>
|
||||
<li><img src=":/images/helpImages/mouse.png" align="middle"/>Scroll down : 'Wheel mouse down' or 'Down' key </li>
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/>Auto Scroll down : 'Space Bar'</li>
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/>Auto Scroll up : 'B' key</li>
|
||||
<li><img src=":/images/helpImages/rotateL.png" align="middle"/>Rotate to the left : 'L' key</li>
|
||||
<li><img src=":/images/helpImages/rotateR.png" align="middle"/>Rotate to the rigth : 'R' key</li>
|
||||
<li><img src=":/images/helpImages/goto.png" align="middle"/>Open "Go to" dialog : 'G' key</li>
|
||||
<li><img src=":/images/helpImages/fit.png" align="middle"/>Change between fit width/height modes : 'A' key</li>
|
||||
<li><img src=":/images/helpImages/doublePage.png" align="middle"/>Double page mode : 'D' key</li>
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/>Toggle Full Screen mode : 'F' key or double click</li>
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/>For "Go to flow" mode aproximate mouse cursor to bottom border or press 'S' key (show/hide switch).</li>
|
||||
<li><img src=":/images/helpImages/zoom.png" align="middle"/>Show magnifying glass (only in fullscreen mode) : 'Z' key</li>
|
||||
<li><img src=":/images/helpImages/options.png" align="middle"/>Show options : 'C' key</li>
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/>Show/hide tool bar : 'H' key</li>
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/>Show information ("current page/number of pages - current time"): 'I' key</li>
|
||||
<li><img src=":/images/helpImages/bookmark.png" align="middle"/>Show bookmarks dialog : 'M' key</li>
|
||||
<li><img src=":/images/helpImages/setBookmark.png" align="middle"/>Set bookmark: 'Ctrl' + 'M' key</li>
|
||||
</ul>
|
||||
</p>
|
||||
<p>
|
||||
<b>"Go to flow" functions:</b>
|
||||
<ul>
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/>Hide / show : 'S' key.</li>
|
||||
<!--<li><img src=":/images/helpImages/keyboard.png" align="middle"/>Center page : 'Space Bar'</li>-->
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/>Go to current central page on the flow : 'Return' or 'Enter' </li>
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/>Next flow page : 'Right' key or left mouse click on the right area of the flow</li>
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/>Previous flow page : 'Left' key or left mouse click on the left area of the flow</li>
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/>Fast forward : 'Ctrl' + 'Right'</li>
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/>Fast backward : 'Ctrl' + 'Left'</li>
|
||||
<li><img src=":/images/helpImages/mouse.png" align="middle"/>Scroll flow : Wheel mouse</li>
|
||||
</ul>
|
||||
</p>
|
||||
<p>
|
||||
<b>Magnifying glass functions:</b>
|
||||
<ul>
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/>Show/hide : 'Z' key.</li>
|
||||
<li><img src=":/images/helpImages/mouse.png" align="middle"/>Resize : Wheel mouse or '+'/'-' keys.</li>
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/><img src=":/images/helpImages/mouse.png" align="middle"/>Resize height : 'Ctrl' + Wheel mouse.</li>
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/><img src=":/images/helpImages/mouse.png" align="middle"/>Resize width : 'Alt' + Wheel mouse.</li>
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/><img src=":/images/helpImages/mouse.png" align="middle"/>Adjust zoom level : 'Shift' + Wheel mouse or 'Shift' + '+'/'-' keys.</li>
|
||||
</ul>
|
||||
</p>
|
||||
<p>
|
||||
<b>Configuration dialog</b>
|
||||
<ul>
|
||||
<li>"My comics path" : set your favourite comic path. Open comic dialog will open that path by default.</li>
|
||||
<li>"Go to flow size" : move the slider to set your prefered go to flow size </li>
|
||||
<li>"How to show pages in GoToFlow" : since version 0.2.0, you can choose between three diferent styles:
|
||||
<ul>
|
||||
<li> Cover Flow : the classic style</li>
|
||||
<li> Strip : a strip of pages flowing horizontaly </li>
|
||||
<li> Overlapped Strip : a strip of pages with overlap effect </li>
|
||||
<ul>
|
||||
</li>
|
||||
<li>"Page width stretch" : move the slider to set your prefered page width stretch. This takes effect in "fit to width" reading mode.</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Bookmarks</b>
|
||||
<ul>
|
||||
<li>You can add three bookmarks per comic (using thumbtack icon or pressing 'Ctrl'+M). New bookmarks replace oldest bookmarks.</li>
|
||||
<li>YACReader saves automatically the latest page read (the current page when closing).</li>
|
||||
<li>To go to any bookmark (last page included), open de bookmarks dialog and click on the desired page</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<h2>Usage and considerations</h2>
|
||||
<p>
|
||||
The usual way to read a comic with YACReader is press 'O' to open a comic,
|
||||
and then use 'Space' and 'B' for autoscrolling pages, you can use 'UP', 'DOWN' or
|
||||
'Mouse Wheel' too, when you reach page limit (top or bottom) next page is loaded
|
||||
automatically, moreover, you can go to next or previous page using 'RIGTH' and 'LEFT'.
|
||||
</p>
|
||||
<p>
|
||||
Jumping between pages is posible using "Go To..." dialog ('G' key) or "Go To Flow" widget ('S' key).
|
||||
You don't have to wait until all pages are loaded to use these functions, because pages are shown as soon
|
||||
as they are ready.
|
||||
</p>
|
||||
<p>
|
||||
YACReader loads all comic compresed images in memory, when it needs to show one page, only that one is rendered.
|
||||
Since all pages are in memory YACReader uses aproximately the same RAM as the comic size, so take care if you want to view huge
|
||||
comics with YACReader (comics larger than your RAM).
|
||||
</p>
|
||||
<p>
|
||||
The "Go To flow" widget needs to render only the images which will be shown,
|
||||
doing it in a lazy way to reduce memory consumption, in any case,
|
||||
it takes a significant amount of RAM (RAM consumption depends on how many images and
|
||||
how larger are them). So, if you don't have enough RAM, please, reduce 'Slide' size on the 'Options' dialog.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
75
files/helpYACReaderLibrary.html
Normal file
@ -0,0 +1,75 @@
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Quick start guide</h1>
|
||||
<h2>Features</h2>
|
||||
<p>
|
||||
YACReader Library is a comic library browser with the following features:
|
||||
<ul>
|
||||
<li>Three different effects for cover viewing (Cover Flow like, Strip and Overlapped Strip)</li>
|
||||
<li>Create, add existing, update, delete or rename various comic collections</li>
|
||||
<li>Export and import covers of your libraries.</li>
|
||||
<li>Fast navigation between comics ussing tree and list views</li>
|
||||
<li>Open your comics on YACReader directly from your collection</li>
|
||||
<li>Fullscreen mode</li>
|
||||
<li>Search folders in your collections</li>
|
||||
</ul>
|
||||
</p>
|
||||
<h2>Functions and shortcuts</h2>
|
||||
<p>
|
||||
<ul>
|
||||
<li>Create a new library: Set a name to your library, select your comics folder and start the creation process</li>
|
||||
<li>Open an existing library: This funcions allows you to select a folder with a comic library previously created</li>
|
||||
<li>Export</li>
|
||||
<li>Import</li>
|
||||
<li>Update current library: Update the selected library, adding covers to the library if new comics were added, or deleting them if comics were removed</li>
|
||||
<li>Rename current library: This funcions allows you to rename the selected library.
|
||||
<li>Remove current library from your collection: delete the selected library from YACReaderLibrary, although library will not be removed from file system</li>
|
||||
<li>Delete current library from your disk: delete the selected library from YACReaderLibrary and erase it from disk (only covers, comics will never be deleted from disk)</li>
|
||||
<li>Open current comic on YACReader (Enter):Open for reading the centred comic in the cover flow.</li>
|
||||
<li>Comic properties: shows a full quality cover, comic file name, number of pages and size comic</li>
|
||||
<li>Switching to fullscreen mode: you can view your covers bigger in fullscreen mode using 'F' key</li>
|
||||
<li>Browsing your collection:
|
||||
<ul>
|
||||
<li>Select a library: you can select a library from the combo box clicking on it.</li>
|
||||
<li>Browse a library: there are three views.
|
||||
<ul>
|
||||
<li>On the left, there is a treeview with the folders existing in your library,
|
||||
you can select any folder, it is posible to expand or collapse it by double clicking on a folder. Also, you can expand or collapse all folders using '+' and '-' buttons. Root folder
|
||||
can be selected clicking on "Select root node" button. </li>
|
||||
<li>On the top right, there is the covers view. This view shows the comics on the selected folder. You can browse them using left and right cursors (pressing CTRL allows you to fast fordward/backward), or clicking on the right/left of the central cover.</li>
|
||||
<li>On the bottom right, there is the list view. This view shows the comics on the selected folder as a list. You can select any comic clicking on it.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Search: you can search an especific folder using the text field on the left-bottom corner. If you type "<b>sp</b>", the search will match with "<b>Sp</b>iderman - vol 7" and "The dark ages - <b>Sp</b>awn". In any case, the search will be case insensitive.
|
||||
</ul>
|
||||
</li>
|
||||
<li>Configuration dialog:
|
||||
<ul>
|
||||
<li>"How to show covers" : since version 0.2.0, you can choose between three diferent styles:
|
||||
<ul>
|
||||
<li> Cover Flow : the classic style</li>
|
||||
<li> Strip : a strip of covers flowing horizontaly </li>
|
||||
<li> Overlapped Strip : a strip of covers with overlap effect </li>
|
||||
<ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</p>
|
||||
<h2>Usage and considerations</h2>
|
||||
<p></p>You can create a collection in any folder (write privilieges are needed). Creation process involves looking for image files in any
|
||||
rar,zip,cbr,cbz and tar files. If images are found, the first one (alfabetically) is taken as the comic cover and added
|
||||
to the collection.</p>
|
||||
|
||||
<p>The hidden folder .yacreaderlibrary is created in the root path of your comics folder. This folder stores
|
||||
the library with cover's tumbnails, so please, don't mess with it.</p>
|
||||
|
||||
<p><s>.yacreaderlibrary folder can be copied in order to share your comic library with your friends. To do that, you
|
||||
can copy .yacreaderlibrary to any folder, and then "Open an existing library" from this folder (Note:
|
||||
if you update that library, all covers will be removed). Is intended that this task could be done automatically from YACReaderLibrary in a later version.</s></p>
|
||||
|
||||
</body>
|
||||
</html>
|
73
files/helpYACReaderLibrary_es_ES.html
Normal file
@ -0,0 +1,73 @@
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Gu<EFBFBD>a de comienzo r<>pido</h1>
|
||||
<h2>Caracter<EFBFBD>sticas</h2>
|
||||
<p>
|
||||
YACReader Library es un navegador de bibliotecas de c<>mics con las siguiente carater<65>sticas:
|
||||
<ul>
|
||||
<li>Tres modos diferentes de ver las portadas de tus c<>mics (Cover Flow, Strip and Overlapped Strip)</li>
|
||||
<li>Crea, a<>ade, actauliza, renombra y borra varias colecciones de comics</li>
|
||||
<li>Exporta e importa tus biblitecas (solo las portadas).</li>
|
||||
<li>Navegaci<EFBFBD>n r<>pida entre tus c<>mics utilizando <20>rboles y listas</li>
|
||||
<li>Permite abrir directamente tus c<>mics en YACReader</li>
|
||||
<li>Modo a pantalla completa</li>
|
||||
<li>Permite realizar b<>squedas de directorios en tus bibliotecas</li>
|
||||
</ul>
|
||||
</p>
|
||||
<h2>Funciones y atajos</h2>
|
||||
<p>
|
||||
<ul>
|
||||
<li>Crear una nueva biblioteca: Set a name to your library, select your comics folder and start the creation process</li>
|
||||
<li>Abrir una biblioteca existente: This funcions allows you to select a folder with a comic library previously created</li>
|
||||
<li>Empaquetar</li>
|
||||
<li>Desempaquetar</li>
|
||||
<li>Actualizar la biblioteca actual: Update the selected library, adding covers to the library if new comics were added, or deleting them if comics were removed</li>
|
||||
<li>Renombrar la biblioteca actual: This funcions allows you to rename the selected library.
|
||||
<li>Eliminar la biblioteca actual de tu colecci<63>n: delete the selected library from YACReaderLibrary, although library will not be removed from file system</li>
|
||||
<li>Eliminar la biblioteca actual de tu disco: delete the selected library from YACReaderLibrary and erase it from disk (only covers, comics will never be deleted from disk)</li>
|
||||
<li>Abrir el c<>mic actual en YACReader (Enter):Open for reading the centred comic in the cover flow.</li>
|
||||
<li>Mostrar las propiedades del c<>mic: shows a full quality cover, comic file name, number of pages and size comic</li>
|
||||
<li>Cambiar a modo a pantalla completa: you can view your covers bigger in fullscreen mode using 'F' key</li>
|
||||
<li>Navegar por tu colecci<63>n:
|
||||
<ul>
|
||||
<li>Selecciona una biblioteca: puedes seleccionar una biblioteca haciendo click en el campo desplegable de la parte superior izquierda.</li>
|
||||
<li>Navega en una biblitoca: existen tres vistas.
|
||||
<ul>
|
||||
<li>A la izquierda hay un <20>rbol que contiene todos las carpetas de tu biblioteca, puedes seleccionar cualquier carpeta, adem<65>s es posible expandir o contraer mediante doble click cualquier
|
||||
carpeta que contenga otras en su interior. Adem<65>s, tambi<62>n es posible expandir o contraer el <20>rbol completo usando los botones '+' y '-'. La carpeta ra<72>z puede ser seleccionada pulsando en el bot<6F>n "Seleccionar nodo ra<72>z".</li>
|
||||
<li>En la parte superior derecha est<73> la vista de las portadas the covers view. Esta vista muestra los c<>mics que hay en la carpeta seleccionada actualmente. Puedes navegar por los c<>mics usando los cursores izquierda y derecha (pulsando CTRL podr<64>s adem<65>s avanzar y retroceder r<>pido), tambi<62>n se puede navegar pulsando en las partes izquierda y derecha de la vista o simplemente usando la rueda del rat<61>n.</li>
|
||||
<li>En la parte inferior derecha hay una lista de c<>mics que se corresponde con los mostrados en la vista superior. Se puede seleccionar cualquier c<>mic pulsando en <20>l</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>B<EFBFBD>squeda: puedes buscar una carpeta en concreto usando el campo de texto situado en la parte inferior izquierda. Por ejemplo, si escribes "<b>sp</b>", la b<>squeda coincidir<69> con "<b>Sp</b>iderman - vol 7" y "The dark ages - <b>Sp</b>awn". La busqueda siempre ser<65> insensible a las may<61>sculas.
|
||||
</ul>
|
||||
</li>
|
||||
<li>Di<EFBFBD>logo de configuraci<63>n:
|
||||
<ul>
|
||||
<li>"How to show covers" : a partir de la versi<73>n 0.2.0, se pueden elegir tres estilos para mostrar las car<61>tulas.
|
||||
<ul>
|
||||
<li> Cover Flow : el estilo cl<63>sico</li>
|
||||
<li> Strip : una tira de im<69>genes desliz<69>ndose horizontalmente </li>
|
||||
<li> Overlapped Strip : una tira de imagenes parcialmente solapadas a izquierda y derecha de la imagen central </li>
|
||||
<ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</p>
|
||||
<h2>Uso y consideraciones</h2>
|
||||
<p></p>Se puede crear una colecci<63>n en cualquier directorio (con permisos de escritura). El proceso de creaci<63>n implica buscar im<69>genes en cualquier archivo
|
||||
rar,zip,cbr,cbz o tar. Si se encuentran im<69>genes, la primera (alfab<61>ticamente) es elegida como la portada del c<>mic y ser<65> a<>adida a tu biblioteca.</p>
|
||||
|
||||
<p>La carpeta .yacreaderlibrary es creada en la carpeta ra<72>z de c<>mics elegida. Esta carpeta alamecena copias de las car<61>tulas de los c<>mics de la biblioteca, as<61> que por favor, no enredes con ella ;).</p>
|
||||
|
||||
<p>La funci<63>n de exportar las car<61>tulas de una biblioteca es ideal para compartir la informaci<63>n de las bibliotecas con otras personas</p>
|
||||
<p><s>.yacreaderlibrary folder can be copied in order to share your comic library with your friends. To do that, you
|
||||
can copy .yacreaderlibrary to any folder, and then "Open an existing library" from this folder (Note:
|
||||
if you update that library, all covers will be removed). Is intended that this task could be done automatically from YACReaderLibrary in a later version.</s></p>
|
||||
|
||||
</body>
|
||||
</html>
|
126
files/helpYACReader_es_ES.html
Normal file
@ -0,0 +1,126 @@
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Gu<EFBFBD>a de comienzo r<>pido</h1>
|
||||
<h2>Caracter<EFBFBD>sticas</h2>
|
||||
<p>
|
||||
YACReader es un visor de c<>mics r<>pido y sencillo con las siguiente caracter<65>sticas:
|
||||
<ul>
|
||||
<li>Multiplataforma, hay versiones para Windows, Linux y MacOS X.</li>
|
||||
<li>Soporta archivos cbr,cbz,rar,zip y tar, tambi<62>n permite visualizar im<69>genes almacenadas en un directorio</li>
|
||||
<li>Soporta im<69>genes bmp,jpeg,gif,png y tiff</li>
|
||||
<li>Lectura usando teclado y rat<61>n</li>
|
||||
<li>Apertura y navegaci<63>n r<>pida</li>
|
||||
<li>Modo a pantalla completa</li>
|
||||
<li>Lupa configurable para mejorar la lectura</li>
|
||||
<li>Ajuste de p<>gina en altura y anchura (con nivel de anchura configurable)</li>
|
||||
<li>Modo de lectura a doble p<>gina</li>
|
||||
<li>Permite a<>adir marcadores a tus c<>mics y recordar la <20>ltima p<>gina leida</li>
|
||||
<li>Efecto CoverFlow para navegar entre las p<>ginas y la funci<63>n "ir a..."</li>
|
||||
<li>Rotaci<EFBFBD>n de imagen para la lectura confortable incluso en tablet PCs</li>
|
||||
</ul>
|
||||
</p>
|
||||
<h2>Funciones y atajos</h2>
|
||||
<p>
|
||||
<b>Funciones generales:</b>
|
||||
<ul>
|
||||
<li><img src=":/images/helpImages/open.png" align="middle"/> Abrir c<>mic : tecla 'O'</li>
|
||||
<li><img src=":/images/helpImages/openFolder.png" align="middle"/> Abrir carpeta : 'Ctrl+O'</li>
|
||||
<li><img src=":/images/helpImages/nextComic.png" align="middle"/> Abrir siguiente c<>mic : 'Ctrl' + 'Right'</li>
|
||||
<li><img src=":/images/helpImages/previousComic.png" align="middle"/> Abrir siguiente comic : 'Ctrl' + 'Left' key</li>
|
||||
<li><img src=":/images/helpImages/deleteLibrary.png" align="middle"/> Salir : 'Esc'</li>
|
||||
<li><img src=":/images/helpImages/prev.png" align="middle"/> Ir a la p<>gina anterior : 'Cursor izquierdo'</li>
|
||||
<li><img src=":/images/helpImages/next.png" align="middle"/> Ir a la p<>gina siguiente : 'Cursor derecho'</li>
|
||||
<li><img src=":/images/helpImages/mouse.png" align="middle"/> Scroll hac<61>a arriba : 'Rueda del rat<61>n arriba' o 'Cursor arriba'</li>
|
||||
<li><img src=":/images/helpImages/mouse.png" align="middle"/> Scroll hac<61>a abajo : 'Rueda del rat<61>n abajo' o 'Cursor arriba'</li>
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/> Auto Scroll abajo : 'Barra espaciadora'</li>
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/> AutoAuto Scroll arriba : 'B'</li>
|
||||
<li><img src=":/images/helpImages/rotateL.png" align="middle"/> Rotar a la izquierda : 'L'</li>
|
||||
<li><img src=":/images/helpImages/rotateR.png" align="middle"/> Rotar a la derecha : 'R' </li>
|
||||
<li><img src=":/images/helpImages/goto.png" align="middle"/> Abrir el di<64>logo "Ir a": 'G'</li>
|
||||
<li><img src=":/images/helpImages/fit.png" align="middle"/> Cambiar entre los modos ajustar en altura/anchura : 'A'</li>
|
||||
<li><img src=":/images/helpImages/doublePage.png" align="middle"/>Modo a doble p<>gina : 'D'</li>
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/> Cambiar a pantalla completa : 'F' o doble click</li>
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/> Para usar la funci<63>n "Go to flow" aproximar el cursor del rat<61>n a la parte baja del visor o pulsar 'S'(mostrar/ocultar).</li>
|
||||
<li><img src=":/images/helpImages/zoom.png" align="middle"/> Mostrar lupa : 'Z'</li>
|
||||
<li><img src=":/images/helpImages/options.png" align="middle"/> Mostrar opciones : 'C'</li>
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/> Mostrar/ocultar la barra de herramientas : 'H'</li>
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/> Mostrar informaci<63>n ("p<>gina actual/numero de p<>ginas - hora actual"): 'I'</li>
|
||||
<li><img src=":/images/helpImages/bookmark.png" align="middle"/> Mostrar el di<64>logo de marcadores : 'M'</li>
|
||||
<li><img src=":/images/helpImages/setBookmark.png" align="middle"/> Poner un marcador en la p<>gina actual : 'CTRL' + 'M'</li>
|
||||
</ul>
|
||||
<!--<p>
|
||||
Some general functions are accesible from the toolbar or the context menu. <br/>
|
||||
<!-- <img src=":/images/helpImages/toolbar.png" width="550"/>
|
||||
</p>-->
|
||||
</p>
|
||||
<p>
|
||||
<b>Funciones "Go to flow":</b>
|
||||
<ul>
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/> Mostrar / Ocultar : 'S'.</li>
|
||||
<!--<li><img src=":/images/helpImages/keyboard.png" align="middle"/> Center page : 'Space Bar'</li>-->
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/> Ir a la p<>gina central : 'Return' o 'Enter' </li>
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/> Avanzar a la siguiente p<>gina : 'Cursor derecha' o click en la parte derecha del di<64>logo</li>
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/> Retroceder a la p<>gina anterior : 'Cursor izquierda' o click en la parte izquierda del di<64>logo</li>
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/> Avance r<>pido : 'Ctrl' + 'Cursor derecha'</li>
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/> Retroceso r<>pido : 'Ctrl' + 'Cursor izquierda'</li>
|
||||
<li><img src=":/images/helpImages/mouse.png" align="middle"/> Scroll : Rueda del rat<61>n</li>
|
||||
</ul>
|
||||
</p>
|
||||
<p>
|
||||
<b>Funciones de lupa:</b>
|
||||
<ul>
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/> Mostrar / Ocultar : 'Z'.</li>
|
||||
<li><img src=":/images/helpImages/mouse.png" align="middle"/> Redimensionar : Rueda del rat<61>n o '+'/'-'.</li>
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/><img src=":/images/helpImages/mouse.png" align="middle"/>Ajustar altura : 'Ctrl' + Rueda de rat<61>n.</li>
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/><img src=":/images/helpImages/mouse.png" align="middle"/>Ajustar anchura : 'Alt' + Rueda de rat<61>n.</li>
|
||||
<li><img src=":/images/helpImages/keyboard.png" align="middle"/><img src=":/images/helpImages/mouse.png" align="middle"/> Ajustar el nivel de zoom : 'Shift' + Rueda del rat<61>n o 'Shift' + '+'/'-'.</li>
|
||||
</ul>
|
||||
</p>
|
||||
<p>
|
||||
<b>Di<EFBFBD>logo de configuraci<63>n</b>
|
||||
<ul>
|
||||
<li>"Ruta a mis c<>mics" : configura la ruta a tu directorio de c<>mics favorito. El di<64>logo de abrir c<>mic se abrir<69> en esa ruta por defecto.</li>
|
||||
<li>Tama<EFBFBD>o de "Go to flow" : usa el deslizador para establecer el tama<6D>o deseado </li>
|
||||
<li>"Aspecto de GoToFlow" : desde la versi<73>n 0.2.0, puedes elegir entre tres estilos diferentes:
|
||||
<ul>
|
||||
<li> Cover Flow : el estilo cl<63>sico</li>
|
||||
<li> Strip : una tira de im<69>genes desliz<69>ndose horizontalmente </li>
|
||||
<li> Overlapped Strip : una tira de imagenes parcialmente solapadas a izquierda y derecha de la imagen central </li>
|
||||
<ul>
|
||||
</li>
|
||||
<li>"Ajuste en anchura de la p<>gina" : mueve el deslizador para establecer tu ajuste en anchura preferido. La configuraci<63>n tiene efecto en el modo de lectura ajuste en anchura</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Marcadores</b>
|
||||
<ul>
|
||||
<li>Se pueden a<>adir tres marcadores por c<>mic (usando el bot<6F>n marcador o pulsando 'Ctrl'+M). Los nuevos marcadores reemplanzan a los antiguos.</li>
|
||||
<li>YACReader guarda autom<6F>ticamente la <20>ltima p<>gina leida (la p<>gina actual cuando el programa es cerrado).</li>
|
||||
<li>Para ir a cualquier marcador (la <20>ltima p<>gina incluida), basta con abrir el di<64>logo de marcadores y pulsar sobre la p<>gina deseada.</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<h2>Uso y consideraciones</h2>
|
||||
<p>
|
||||
La manera habitual de leer un c<>mic con YACReader es pulsar 'O' para abrir un c<>mic,
|
||||
y despu<70>s usar la barra espaciadora y la tecla 'B' para avanzar y retroceder autom<6F>ticamente, tambien se pueden usar las teclas 'Cursor ARRIBA', 'Cursor ABAJO' o
|
||||
la rueda del rat<61>n, Cuando se alcanza el limite superior o inferior de la p<>ginat la siguiente p<>gina es cargada autom<6F>ticamente
|
||||
, adem<65>s, se puede avanzar o retroceder entre p<>ginas con las teclas 'Cursor DERECHA' y cursor 'IZQUIERDA'.
|
||||
</p>
|
||||
<p>
|
||||
Para saltar entre p<>ginas se pueden usar las funciones "Ir a" (tecla G) y "Go To Flow" (tecla S).
|
||||
No es necesario esperar a que todas las p<>ginas del c<>mic est<73>n cargadas para usar estas funciones, ya que cuando una p<>gina se carga, se muestra inmediatamente si el usuario est<73> esperando para verla.
|
||||
</p>
|
||||
<p>
|
||||
YACReader carga todas las p<>ginas del c<>mic en memoria, cuando necesita mostrar una, solo esa es renderizada.
|
||||
Puesto que todas las p<>ginas est<73>n en memoria, YACReader usa una cantidad m<>nima de RAM igual al tama<6D>o del c<>mic, as<61> que deber<65>as tener cuidado si intentar leer c<>mics enormes (de tama<6D>o superior a la cantidad de RAM instalada)
|
||||
</p>
|
||||
<p>
|
||||
El widget "Go To flow" solo necesita renderizar las im<69>genes que muestre, carg<72>ndolas seg<65>n las necesita con el fin de consumir la minima cantidad de RAM posible. A<>n as<61>, si se desean ver todas las p<>ginas del c<>mic
|
||||
de este modo, esta funci<63>n consumir<69> una cantidad significativa de RAM (El consumo de RAM depende de la calidad y el tama<6D>o de las im<69>genes). Si no tienes suficiente RAM, por favor, reduce el tama<6D>o de "Go To Flow" en el di<64>logo de opciones.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
38
files/shortcuts.html
Normal file
@ -0,0 +1,38 @@
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<div style="font-size:large; color: rgb(20,20,155); padding-top:0px;padding-bottom:0px;"><b>General functions:</b></div>
|
||||
<hr>
|
||||
<div style="padding-top:0px;padding-bottom:0px;">
|
||||
<b>C</b>: Open options<br/>
|
||||
<b>Ctrl+M</b> : Set/Unset bookmark<br/>
|
||||
<b>Esc</b> : Exit<br/>
|
||||
<b>F</b> : Fullscreen mode on/off<br/>
|
||||
<b>F1</b> : Show About/Help dialog<br/>
|
||||
<b>H</b> : Show/Hide toolbar <br/>
|
||||
<b>I</b> : Show/Hide information (pages/current time)<br/>
|
||||
<b>M</b> : Show bookmarks<br/>
|
||||
<b>O</b> : Open comic <br/>
|
||||
<b>Ctrl + O </b> : Open folder <br/>
|
||||
<b>T</b> : Show/Hide YACReader Translator <br/>
|
||||
</div>
|
||||
|
||||
<div style="font-size:large; color: rgb(20,20,155); padding-top:0px;padding-bottom:0px;"><b>Reading functions:</b></div>
|
||||
<hr>
|
||||
<div style="padding-top:0px;padding-bottom:0px;">
|
||||
<b>B</b> : Auto Scroll up <br/>
|
||||
<b>D</b> : Double page mode<br/>
|
||||
<b>Down</b> : Scroll down<br/>
|
||||
<b>G</b> : Open "Go to" dialog<br/>
|
||||
<b>Left</b> : Go to previous page<br/>
|
||||
<b>Mouse drag: Scroll</b>
|
||||
<b>Right</b> : Go to next page<br/>
|
||||
<b>Space Bar</b> : Auto Scroll down<br/>
|
||||
<b>Up</b> : Scroll up <br/>
|
||||
<b>Wheel mouse up</b> : Scroll up <br/>
|
||||
<b>Wheel mouse down</b> : Scroll down<br/>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
38
files/shortcuts2.html
Normal file
@ -0,0 +1,38 @@
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<div style="font-size:large; color: rgb(20,20,155); padding-top:0px;padding-bottom:0px;"><b>Image adjust functions:</b></div>
|
||||
<hr>
|
||||
<div style="padding-top:0px;padding-bottom:0px;">
|
||||
<b>A</b> : Fit to width / height<br>
|
||||
<b>L</b> : Rotate to the left<br/>
|
||||
<b>Q</b> : Always on Top<br/>
|
||||
<b>R</b> : Rotate to the rigth<br/>
|
||||
<b>W</b> : Show pages at full size<br/>
|
||||
</div>
|
||||
<div style="font-size:large; color: rgb(20,20,155); padding-top:0px;padding-bottom:0px;"><b>Magnifying glass:</b></div>
|
||||
<hr>
|
||||
<div style="padding-top:0px;padding-bottom:0px;">
|
||||
<b>Alt + Wheel mouse up</b> : Decrease horizontal size <br/>
|
||||
<b>Alt + Wheel mouse down</b> : Increase Horizontal size <br/>
|
||||
<b>Ctrl + Wheel mouse up</b> : Decrease vertical size <br/>
|
||||
<b>Ctrl + Wheel mouse down</b> : Increase vertical size <br/>
|
||||
<b>Shift + Wheel mouse up</b> : Zoom out <br/>
|
||||
<b>Shift + Wheel mouse down</b> : Zoom in <br/>
|
||||
<b>Wheel mouse up</b> : Decrease size<br/>
|
||||
<b>Wheel mouse down</b> : Increase size<br/>
|
||||
<b>Z</b> : Show/hide<br/>
|
||||
</div>
|
||||
|
||||
<div style="font-size:large; color: rgb(20,20,155); padding-top:0px;padding-bottom:0px;"><b>GoTo Flow functions:</b></div>
|
||||
<hr>
|
||||
<div style="padding-top:0px;padding-bottom:0px;">
|
||||
<b> S </b> : Show/hide <br/>
|
||||
<b> Wheel mouse up</b> : Next flow page <br/>
|
||||
<b> Wheel mouse down</b> : Previous flow page <br/>
|
||||
<b> Enter </b> : Go to current page <br/>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
639
files/translator.html
Normal file
31
generateVS2010Projects.bat
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
echo Setting up a Qt environment...
|
||||
|
||||
set QTDIR=D:\Desarrollo\Qt\4.8.0
|
||||
echo -- QTDIR set to D:\Desarrollo\Qt\4.8.0
|
||||
set PATH=D:\Desarrollo\Qt\4.8.0\bin;%PATH%
|
||||
echo -- Added D:\Desarrollo\Qt\4.8.0\bin to PATH
|
||||
set QMAKESPEC=win32-msvc2010
|
||||
echo -- QMAKESPEC set to "win32-msvc2010"
|
||||
|
||||
if not "%1"=="vsvars" goto ENDVSVARS
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\vsvars32.bat"
|
||||
:ENDVSVARS
|
||||
|
||||
if not "%1"=="vsstart" goto ENDVSSTART
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\vsvars32.bat"
|
||||
devenv /useenv
|
||||
:ENDVSSTART
|
||||
|
||||
|
||||
cd YACReader
|
||||
echo Entering YACReader
|
||||
qmake -spec win32-msvc2010 -tp vc YACReader.pro
|
||||
echo qmake -spec win32-msvc2010 -tp vc YACReader.pro
|
||||
cd ..
|
||||
echo leaving YACReader
|
||||
cd YACReaderLibrary
|
||||
echo Entering YACReaderLibrary
|
||||
qmake -spec win32-msvc2010 -tp vc YACReaderLibrary.pro
|
||||
echo qmake -spec win32-msvc2010 -tp vc YACReaderLibrary.pro
|
||||
cd ..
|
BIN
images/adjustToFullSize.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
images/alwaysOnTop.png
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
images/bookmark.png
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
images/center.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
images/close.png
Normal file
After Width: | Height: | Size: 8.2 KiB |
BIN
images/colapse.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
images/comicFolder.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
images/coversPackage.png
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
images/deleteLibrary.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
images/dictionary.png
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
images/doublePage.png
Normal file
After Width: | Height: | Size: 35 KiB |
BIN
images/down.png
Normal file
After Width: | Height: | Size: 689 B |