This is the new trunk

This commit is contained in:
jaime 2015-01-14 18:51:30 +00:00
parent 1478dc3b0f
commit 70e109cfab
69 changed files with 35584 additions and 0 deletions

3
AUTHORS Normal file
View File

@ -0,0 +1,3 @@
Jaime Robles, EA4TV <jaime@robles.es> (2002-today)
Andrew Goldie, ZL2ACG <andrew.goldie@rocketmail.com> (2009-2010)

674
COPYING Normal file
View 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>.

View File

@ -1,3 +1,31 @@
January-2015 - 0.9.0.3
- Bugfix: ADIF was not properly imported when Fields where using the Type of data optional field preventing logs from Logger32 being imported. (TNX EB1TR)
- Bugfix: QSL Sent/Received status in the search box were switched.
- Bugfix: CTY.CSV was not updated if the file was already existing.
- Bugfix: Entity DB was not updated when CTY.CSV was updated.
- Bugfix: Search results showed the default Station Callsign if non was in the QSO. This lead to errors if QRZ was not the default.
- KLog recognizes now .ADIF files (instead of only .ADI).
- KLog shows now the WAZ status.
- Added a very basic support of DX Marathon (http://www.dxmarathon.com/).
- DXCluster filters are now working.
- The user can manually assign the DXCC entity for a DX.
- Improved the function to update the DB from one release to the following.
- DB file is compressed everytime KLog finishes.
- It is possible to find QSL pending to receive.
- It is possible to modify entities data in the World Editor in preferences.
- It is possible to choose in preferences whether to keep my Data Tab from one QSO to the next or not.
- GUI: A tooltip is shown in the search results showing the DXCC name / CQ zone.
- GUI: Added a button to rescore awards.
- GUI: Added a button to update the search Box without modifying the text.
- GUI: Updates Bearing/distance/... when changing Locator.
- GUI: When the QRZ lineedit is blank or the clear button is clicked, entity info is deleted (beam, distance, ...).
- GUI: The IOTA continent is updated when the QRZ is modified.
- GUI: DXCluster input is disabled when not connected.
- GUI: Corrected the behaviour of the status bar.
- GUI: Added primary & secondary subdivisions in the Others Tab.
- Some other minor fixes.
November-2014 - 0.9.0.2
- Bugfix: Right-click on search result sometimes caused KLog to crash.

430
Changelog Normal file
View File

@ -0,0 +1,430 @@
January-2015 - 0.9.0.3
- Bugfix: ADIF was not properly imported when Fields where using the Type of data optional field preventing logs from Logger32 being imported. (TNX EB1TR)
- Bugfix: QSL Sent/Received status in the search box were switched.
- Bugfix: CTY.CSV was not updated if the file was already existing.
- Bugfix: Entity DB was not updated when CTY.CSV was updated.
- Bugfix: Search results showed the default Station Callsign if non was in the QSO. This lead to errors if QRZ was not the default.
- KLog recognizes now .ADIF files (instead of only .ADI).
- KLog shows now the WAZ status.
- Added a very basic support of DX Marathon (http://www.dxmarathon.com/).
- DXCluster filters are now working.
- The user can manually assign the DXCC entity for a DX.
- Improved the function to update the DB from one release to the following.
- DB file is compressed everytime KLog finishes.
- It is possible to find QSL pending to receive.
- It is possible to modify entities data in the World Editor in preferences.
- It is possible to choose in preferences whether to keep my Data Tab from one QSO to the next or not.
- GUI: A tooltip is shown in the search results showing the DXCC name / CQ zone.
- GUI: Added a button to rescore awards.
- GUI: Added a button to update the search Box without modifying the text.
- GUI: Updates Bearing/distance/... when changing Locator.
- GUI: When the QRZ lineedit is blank or the clear button is clicked, entity info is deleted (beam, distance, ...).
- GUI: The IOTA continent is updated when the QRZ is modified.
- GUI: DXCluster input is disabled when not connected.
- GUI: Corrected the behaviour of the status bar.
- GUI: Added primary & secondary subdivisions in the Others Tab.
- Some other minor fixes.
November-2014 - 0.9.0.2
- Bugfix: Right-click on search result sometimes caused KLog to crash.
November-2014 - 0.9.0.1
- Bugfix: Selected DX-Cluster servers were not used to connect. (TNX DL6FBS)
November-2014 - 0.9.0
- Ensures the ASCII requirement of ADIF.
- Updated the Preferences dialog.
- Added the About Qt help menu.
- Bugfix: Selected DX-Cluster servers were not used to connect.
- Bugfix: When selecting QSL received/sent with right click, date was not updated.
- Bugfix: Fixed the FileManager::adifReadLog to be able to read logs with several lines per QSO.
- Some other minor bugfixes.
- New feature: It is possible to show Imperial System (Miles instead of Km) data. (TNX - KF5JNU)
- New feature: It is possible to mark/look for & export requested QSL.
- New feature: It is possible to automatically mark(or not) a QSL as requested by the DX when the DX's card is received.
- New feature: It is possible to show (or not) the callsign used in the search box.
- New feature: KLog uses bigcty.csv for normal DX & will use cty.csv for contesting.
April-2014 - 0.7.1
- Backport to Qt 4.8.
- Download the http://www.country-files.com/cty/cty.csv instead of cty.dat (with no ARRL id).
- Capable to read cty.csv to get the info of the ARRL id.
April-2014 - 0.7.0
- Full rewritten software based only in Qt. NO KDE dependency.
- KLog can now run on Linux, OSX and Windows.
November-2013 - 0.6.2
- Bug fixed: Under some conditions, KLog crashes when entering a new QRZ. (TNX LW1EQI).
- Bug fixed: IOTA data was not properly cleared when clicking the Cancel button.
- Bug fixed: QSL combobox content was not properly managed. (TNX DF4FH).
- Bug (gui) fixed: IOTA continent is now "automagically" detected... again (a bug prevented this functionality).
- GUI updated: You can click on RX or TX Frequency buttons to copy the frequency to the other one.
- GUI updated: You can select eQSL in the QSL combobox as an option to mark the QSL information of a QSO.
- GUI updated: Two new shortcuts: CTRL+W: deletes the current QSO. CTRL+Q: to (quick)edit the last QSO added.
- GUI updated: Minor tab reorder.
June-2013 - 0.6.1
- Bug fixed: Locator was not properly calculated due to a sign difference management from KLog and CTY.DAT.
- GUI updated: The cursor position management of the QRZ box has been improved to ease the operation.
January-2013 - 0.6.0
- Bug fixed: Typo "Frecuency" changed to "Frequency" in a tooltip. (Debian bug: #654328) (TNX Jonas Stein)
- Bug fixed: Typo/wishlist "Numb" changed to "Number" in main table. (Debian bug: #654331) (TNX Jonas Stein)
- Bug fixed: Typo/wishlist "UTC" changed to "Time" in main table. (Debian bug: #654331) (TNX Jonas Stein)
- Removal of several not needed #includes.
- Removed some warnings on compilation.
- GUI improved: The information boxes are now independant from the top right tab widget to improve usability.
- GUI updated: Disabled the Setup tab of Hamlib until hamlib is properly working.
January-2012 - 0.5.9
- Bug fixed: When starting for the first time, the CTY.DAT file downloaded had a loop that was not properly managed. (Debian bug: #653697) (TNX Jonas Stein)
- Fixed some typo: "Km" changed to "km". (Debian bug: #6536978) (TNX Jonas Stein)
December-2011 - 0.5.8
- Bug fixed: Right button in the search result did not "sent" the QSL card.
- Bug fixed: Closing the window did not ask to save data before exit. (TNX EA7HEG).
- Bug fixed: Beam was not properly calculated. (TNX DL6FBS).
- Bug fixed: Minor problem of APP_KLOG_NUMBER ADIF header fixed.
- Bug fixed: When modifying, some fields did not accepted empty fields (deleting). (TNX VK4JAZ).
- GUI updated: Remove the map tab in the main GUI as it is still not implemented.
- GUI updated: Ordered the tab-switching to make it more usable. (TNX Cedric).
- Added the support for QRP. Power has two decimals. (TNX VK4JAZ).
November-2010 - 0.5.7
- New feature: Added the Export needed QSL that allows to create an ADIF file with all the QSO with new ones and new bands still not confirmed that has not been QSLed.
The objective is to export it to a QSL or label printing software (until KLog implements that feature).
- Updated translations: SV by SM4ABE.
- GUI improved: Added sliders to be able to move panels.
- GUI improved: Changing the band combobox changes the TX Freq box and viceversa.
- Minor fix: The PROGRAMVERSION tag in log was not properly formated.
July-2010 - 0.5.6
- Fixed the hamlib compilation scripts (CMakeLists.txt, FindHamlib.cmake). (TNX AB4BD).
- Fixed one bug that causes some architectures not to compile.
- Fixed some permisions and other warnings for Fedora packaging. (TNX N3LRX).
- BUG fixed: Setting QSL from the log with right button was not working.
May-2010 - 0.5.5
- New feature: If cty.dat file is not found, KLog offers to download from the web.
- New feature: New tool to update the update the cty.dat file from the web.
- New feature: QRZ font color changes to red if has been worked previously. (Proposed by KE7TDY)
March-2010 - 0.5.4
- Small fix to initialize a variable before using it.(realTimeLog in klog.cpp)
- Fixed a bug that caused KLog to crash of no cty.dat file was found (bug #016917)(TNX KA6MAL)
February-2010 - 0.5.3
- Fixed a bug that caused modified QSO not being updated.
- Fixed a bug in the way the band & mode combobox managed the data.
February-2010 - 0.5.2
- Fixed a bug that causes a crash when connectiong to DXCluster. (bug #016653)
- Added a very basic Satellite support.
- Removed the Freq LCD and added two new editable widgets: Freq TX and Freq RX. (bug #016609)
- Added again the entity count of /M stations.
January-2010 - 0.5.1
- Fixed a bug with the display of the Date.
December-2009 - 0.5.0
- Migrated to Qt4.
- Updated translations: SV by SM4ABE, DE by DL5PD, ES by EA4TV.
- ZL2ACG joined the KLog team. Welcome and thank you Andrew!
April-2009 0.4.7
- New feature: Import cabrillo logs.
- Improved the ADIF compatibility up to ADIF 2.2.2.
- BUG fixed: Improved the confirmed QSO accounting.
- BUG fixed: RST format were not changed when another mode was selected if the CALL was empty. (TNX Alvaro, EA4RCT).
- BUG fixed: Calls like F0XXX/TU8 were not recognised if written as TU8/F0XXX.
- BUG fixed: TX_PWR is only saved when bigger than 0w :-)
- BUG fixed: Prefixes were not properly managed and some information, as the STATE from ADIF files were not always well imported.
- BUG fixed: Related with the ADIF saving CQ & ITU zones for QSO. It was not properly saved but can be recovered from the CALL.
20-dic-2008 - 0.4.6
- BUG fixed: Printing was not properly working due to library actualization.
- BUG fixed: Fields STX/SRX/STATION_CALLSIGN/CONTEST_ID were copied from one QSO to the following one.
23-nov-2008 - 0.4.5
- GUI fixed: Changed the order of the input fields tab switching.
- GUI fixed: Corrected the layout to fix the screen as ITU was not properly shown.
- GUI improved: Added a new one color to differ a completely new one spot in the DX-cluster from a needed in a band.
This last improvement is specially usefull in the search QSO to QSL. Test it!
- GUI improved: Added a tab in the botton box with the DXCC status (only main HF bands).
- New feature: Added the possibility to choose to show or not DX Spots based on CW/SSB activity. (TNX EA7BJ)
- New feature: Added the support of the 0.136KHz and GHz bands (not to the GUI but KLog can process them).
- BUG fixed: Minor check on QSL sent date was not properly done (no data lost).
- BUG fixed: Some Entities & zones where not properly recognized.
- BUG fixed: The state (needed/worked/confirmed) was not always properly shown.
- Improved the way is readed the cty.dat file and added support for its new format.
- Improved the ADIF compatibility supported fields, band frecuencies, modes...
- Improved the QSO merging with previous data.
- Updated translations: English, Spanish, TNX: Swedish (SM4ABE), German (DL5PD).
1-may-2008 - 0.4.4
- BUG fixed: KLog now recognises a "/LH" LightHouse stations (TNX G3OAG)
- BUG fixed: TLF import did not show the imported QSO in the log. QSO were not lost, just not shown. They were added to the logfile and saved when saving. No data was lost. This bug was introduced in release 0.4.2 after an optimization in the logfile reading.
BUG: Frequency was not compliance with ADIF as was saved in KHz instead of MHz.
- BUG fixed: If a logfile does not provide a MY_GRIDSQUARE, KLog does not add the predefined MY_GRIDSQUARE.
- BUG fixed: Some GRIDSQUARES were not detected as wrong althought they were.
- Minor fix: Corrected the URL to CTY.DAT file in the start message.
- GUI improved: Added a progress dialog when saving.
- GUI changes: Some widgets have been changed to prepare for the Qt4 migration. Specially the Led near the QRZ box that will reapear as usual when KLog is migrated to Qt4.
- Added the 70Mhz band.
- New feature: New tool added "Merge QSO data" that looks in all the log for the QSO that has been worked more than once and merges the data like Name, QSL info, QTH, Locator, ...
The information comming from all the appearances of a call in the log is grouped in the first appearance of that call in the log.
18-jan-2008 - 0.4.3.1
- Package fix: Distributed with the language (po) files.
12-jan-2008 - 0.4.3
- BUG fixed: KLog copied the QSL sent date into the QSL rec date. Only QSL rec date was lost but not the QSL status.
- BUG fixed: KLog now recognises a "/J" (Jamboree On The Air) Scout Station.
- GUI improved: Added the cty.dat URL.
12-Sep-2007 - 0.4.2
- New feature: The user can now configure to require or not the mandatory data for each QSO (QRZ, date, time, band, mode, RST tx & RST rx. (if not all the mandatory fields are entered, KLog's behaviour may be unexpected).
- New feature: Klog creates a temp file (~.klog/tempklog.adi) where it saves automatically all the QSOs entered until the log is manually saved. It prevents the log to be lost in case of unprevented KLog/computer failure. (TNX SM5OUU)
- BUG fixed: If the field (maybe any other field too) COMMENT is more than one line long, the log is broken and cannot be read. (TNX SM5OUU)
- BUG fixed: KLog does not ask for the file name if you have previously opened one file and the name has not changed.
- BUG fixed: In the GUI, the "Preferences" is correctly shown and not as "&Preferences".
- BUG fixed: When modifying a QSO, the number of QSOs was incremented when the user click over OK.
- BUG fixed: If a QSO was deleted the awards/number of QSO where not decresed.
- BUG fixed: When the date
- GUI improved: Deleted the WAE box (the WAE calculations was not implemented).
- New translation: KLog is now also in Swedish.(TNX SM4BE)
- New translation: KLog is now also in Galician.(TNX Fuco Mera)
- Updated German translation.(TNX DL5PD)
- Updated Spanish translation.
16-Dic-2006 - 0.4.1
- Bug fixed: The distance and beam is also resetted when the call box is deleted.
- Bug fixed: Calls /M and /MM do not count for DXCC.(TNX SM5CNQ)
- Bug fixed: It is possible to filter only for needed entities spots.
- Change: The hamlib signal meter has been removed from the GUI.
- New feature: There is a new tool available to find QSO from which the QSL is needed that you have still not sent the QSL. Very useful to find which QSL you need to send first!
- New feature: The MY_GRIDSQUARE is managed by default by all QSO (saves the default if none is entered)
10-Sep-2006 - 0.4.0
- New feature: It is possible to manage user-created local awards (TPEA, DOK, WAS, ...) KLog reads user defined awards in a special format.
- New feature: KLog reads ".adif" files also.(TNX DL5PD)
- New feature: It is possible to add/delete new DXServer clusters in the setup box.(TNX DL5PD)
- GUI Improved: IOTA continent is now "automagically" detected.
- Bug fixed: Not really a bug but now, the log is cleaner as it does not save the "STATE" for ALL the QSO, only does it if needed.
- Bug fixed: After modifying a QSO the band and mode did not return to the last used (TNX DL5PD).
- Bug fixed: If the band changed, without any call in the Call box, KLog showed "new one, work it"
- Bug fixed: If the band changed, when modifying KLog fooled the entity color band boxes.
- Bug fixed: KLog recognises /MM as maritime mobile station
- Bug fixed: When opening a new log, the number of QSO did not start from zero.
- New translation: KLog is now also in German.(TNX DL5PD)
18-Jan-2006 - 0.3.3
- New feature: It is now possible to sort the log by numbers from the main log.
- New feature: The frequency box is now also used when no hamlib support is active (double clicking over a
dx-cluster spot.
- New feature: If file name does not end in .adi, add the .adi.
- Bug fixed: Reporting a bug does not crash KLog although the widget has been temporally/drastically simplified.
- Bug fixed: It is possible to select the radio from the setup.
- Bug fixed: (introduced in 0.3.2) It was not possible to activate the progress dialog.
- Bug fixed: When clicking over "New File", confirmed entities was not set to "zero".
- Bug fixed: When reading from cty.dat file, the prefix was reading with some spaces at the begining.
- GUI Improved: After pressing OK/clear button, the QRZ box is selected. (TNX P.H. Rankin Hansen)
- GUI Improved: You can now reach to Name&QTH using the tab key (TNX P.H. Rankin Hansen)
- GUI Improved: QTH/Locator is now on the main QSO tab (TNX P.H. Rankin Hansen)
25-Apr-2005 - 0.3.2
- New feature-(unstable): Hamlib support to control/read the rig from KLog.
- New feature-(unstable): It is possible to click over a DX-Spot and set the radio to that frecuency & mode to work the spot (hamlib).
- New feature-(unstable): KLog reads the frecuency, band, mode and signal from the radio in real time (hamlib).
- New feature: After QSLing using the Right Button option from the search box, the search box is updated so the QSL status is shown updated.
- New feature: Local operator callsign can now be also logged.
- Bug fixed: A call ending in /B is now correctly recognised as a beacon.
- Bug fixed: Now it recognise all the "special suffix" like /r Rotuma, /a Mount Athos,...
- Bug fixed: WARC Bands were not correctly detected.
- GUI improved: The QRZ box always shows the QRZ as uppercase. (TNX ea4eej)
- Bug fixed: KLog can now read ADIF files where the QSO can be in several lines.
- Bug fixed: Importing from tlf, the QSO count was not properly done because of the comment lines.
16-Jan-2005 - 0.3.1
- KLog has been optimized and now runs faster.
- New feature: KLog saves the date/time of the last log file save.
- New feature: KLog ask the user for a comment when Importing a TLF log (for example
to note that those QSO are from an specific contest or whatever).
- Bug fixed: When selecting a DX-Spot from the DX-Cluster it did not overwrote the name.
- Bug fixed: When writting the log, there was an space missing before the <EOR>.
It is just a "cosmetic" fix, not a real bug.
- Bug fixed: The same with the QSL card status.
- Bug fixed: KLog now recognises all the prefix that appears in cty.dat file with
special CQ/ITU zones.
- Bug fixed: KLog recognises the special call "3XDQC/P" as "3X" although it does not
follow the "prefix+number+suffix" pattern
- Bug fixed: When starting it now looks the cty.dat file in: ~/.klog and in the current
directory before starting without Entities' data. (TNX oh7jjt)
- Bug fixed: If we are modifying a QSO, the search box is not updated. Avoids some
crashes.
07-Nov-2004 - 0.3.0
- Fixed source code to allow compiling in more architectures.
- New feature: It is possible to show a progress dialog when opening the log file.
This is configurable.
- New feature: It is now possible to hide/show WARC spots or announces from cluster.
- New feature: Printing the is now possible.
- New feature: Sorting the log file is now possible.
- New feature: New option in right button to send&rec QSL at once.
- New feature: If a CALL has been previously worked it shows data to the actual QSO.
- Fixed bug: When modifying, the QTH was not modified.
- Fixed bug: It did not make you save if you just modify a QSO.
- Improved the gui: The "T" (from RST) does not disappears but is disabled when is
not needed. (TNX Ferm<72>n H.).
- Improved the gui: The QSL info text box is always active.
- Improved the gui: When connecting to the DX-Cluster server, automatically sets
the DXCluster window as active.
2-May-2004 - 0.2.9
- New feature: Selection of a DX-Spot shows the Entity data and state.
- New feature: KLog checks and captures the output of a sh/dx command in cluster.
- Fixed bug(caused in 0.2.8): QRZs as KA3AA, when the prefix is just one letter but the call uses two are now well recognised.
- Fixed bug: Better recognision from /number calls from DX-Cluster.
21-Mar-2004 - 0.2.8
- Fixed bug: Now ignores comments in TLF's files.
- Fixed bug: QRZs as VP2MCV, with complex prefixes are now well recognised.
- Improved the gui: RST, Power size adjusted. (TNX ea1ddn)
- Improved the gui: Name and QTH moved to QSO tab.
- Improved the gui: QSL via bureau is now the default option. (TNX ea1ddn)
- New feature: Calculate distance and beam if locator is entered. (TNX ea1ddn)
- New feature: Auto-open logfile when starting is now possible. (TNX ke6sls & ea1ddn)
- New feature: Now it is possible to double-click over a DXCluster spot to copy it to the QSO input box. (TNX ea1ddn)
- New feature: In the search box, QSOs are colored indicating if worked, needed, ...
04-Jan-2004 - 0.2.7
- Fixed bug: When editing a QSO, the QSL date was not properly displayed.
- Fixed bug: When entering a QSO, if the band is changed, KLog checks the state in this new band.
- Fixed bug: RST (tx&rx) in ADIF was always length 3, now is calculated for every QSO (at writing).
- Fixed bug: When modifying if QSL rec, the date was shown as 00/00/0000
- New feature: It is posible to select a default mode & band in the setup.
- First Icon draft created.
02-Dec-2003 - 0.2.6
- Fixed bug: When Non real time logging was setting the time was "real time" when modifying. (TNX rz3dfs)
- Fixed bug: When reading the log file if an entity was not recognised Klog used to crash.
- Fixed bug: Now we recognise calls like 3XY1L when reading from a log file.
- Fixed bug: Improved the way of checking the confirmed/worked entities.
- Fixed bug: /P, /M and /QRZ are now better recognised when reading from logfile or clicked.
- Fixed bug: Stats were not shown after importing a tlf log file.
- Fixed bug: The zone & entity numbering fixed.
- New feature: It is posible to setup a default power level.
- New feature: When receiving a qsl with the mouse's right button the numbers are updated.
- New feature: Also a default color is selectionable as non-info color.
- Improved the gui: Band info leds removed to gain space in the info widget.
26-Aug-2003 - 0.2.5
- Fixed bug:<3A>RST was changed so when entering SSB RST. Entering 590 -> showed 509. (TNX ke6sls)
- Fixed bug: In cluster some frecs (432MHz and 2190m) were not properly recognized.
- New feature: It is now possible to hide HF/VHF/ANN spots or announces from cluster.
- New feature: It ask for the file name when saving first time instead of using "klog.adi" as default. (TNX ke6sls)
- New feature: It is now possible to add QSO in non real time (to add previous QSOs). (TNX yu1is)
- New feature: Power value is remembered from previous QSO. (TNX ke6sls)
- New feature: Basic bug report system. (TNX ke6sls)
- New feature: Mode selection affects to the RST configuration (TNX yu1is & ke6sls)
- New feature: Colors for confirmed/worked/needed are configurable by the user.
- New feature: Added tips to many widgets to explain their functions.
31-Jul-2003 - 0.2.4
- Fixed bug: Some calls were not recognized when checked (as 3da0sv).
- Fixed bug: When opening a second log having a previous one KLog did not ask for saving if needed.
- New feature: Basic Setup dialog and functions.
- New feature: Now the band combo change checks automatically the entity state.
- New feature: Smart cluster tells you if a dx spot is needed, worked and/or confirmed using colors.
- New feature: Clock is now in UTC by default but can be changed in preferences.
24-Jul-2003 - 0.2.3
- Improved the gui: The "entity state" LED has been moved to a always seen zone.
- Improved the gui: The way to edit QSO.
- Fixed bug: When searching it showed a wrong name and a qth.
- New feature: Basic DX-Cluster support.
- New feature: It is possible to add a log file to the current log.
- New feature: QSO deletion.
- New feature: QSO selection's data is shown in the show box.
- New feature: You can delete qso & manage qsl from the list with righ button quickly & easily.
30-Jun-2003 - 0.2.2
- Changed the behavior of the search box to look not only for complete calls but characters.
- Fixed bug: Improved the GUI layout.
- Fixed bug: When editing a previous QSO the date was not always properly saved.
- New feature: Added real time clock.
20-Mar-2003 - 0.2.0
- New feature: Added search for QSO tab.
- New feature: Added Name field.
- New feature: Added QTH field.
- New feature: Added operator (self call) field.
- Fixed bug: When saving log to file comment is not saved if there is no comment.
- Fixed bug: When selecting a "portable" (/P) (or /number) qso in the list it didn't recognize the entity.
- Translation updated: pt_BR.
13-Mar-2003 - 0.1-beta02
- Added many modes and some more bands.
- New feature: Asking for saving when finishing without save.
- New feature: Asking if overwrite when saving as to an existing file.
- New feature: The main led only shows info about the current band.
- New feature: Band/Mode sticky between contacts.
- New feature: Added the long path beam and distance.
- New feature: You can track each entity state per band with leds.
- New feature: Basic WAZ award support.
- Fixed bug: If you had a log and started a new one, the DXCC kept the data.
- Fixed bug: The IOTA number was limited to 99 (now 999).
28-Feb-2003 - 0.1-beta
- New feature: Led is green (new one), yellow (worked but not confirmed), red (confirmed).
- New feature: Support calls as EA4TV/EA8, EA8/EA4TV.
- New feature: Import TLF logs.
- New feature: Added beam and distance calculations.
- New feature: Added Locator & IOTA fields.
- New feature: Basic DXCC award support.
- Improved the search the Entity algorithm (much quick).
- Clear button shows "Cancel" when modifying.
- Changed many classes from Qt classes to KDE classes.
- Fixed bug: Some times the QSL was checked automaticaly.
- Fixed bug: The Mode combobox showed SBB and it is SSB.
- Fixed bug: some calls showed as worked before and they were not.
29-Jan-2003 - 0.1-alpha
- Fixed bug: When modifying a QSO it was not shown in the log box.
- Fixed bug: If you clicked over the log box but not over a qso, the program crashed
- Fixed bug: When modifying a QSO the date was always set to "now".
- Now you can select what log file you want to open.
- Now you can select the file's name when saving the log.
- Now you can create a new log always you want.
- Logs are now stored in ~/.klog directory by default.
- Logs are saved as klog.adi by default.
- Some prefix were not found in previous version.
- QSL date is activated when a QSO is selected
- QSL via is working, manager field, and QSL info field
22-Jan-2003 - 0.1-pre-alpha
- First "release" of the software.
- You can add/edit QSOs and save/read your log to/from the disk with a fixed name in ADIF format.
- Can manage QSL sent/rec.

18
INSTALL-linux Normal file
View File

@ -0,0 +1,18 @@
Follow these steps to build KLog.
1. Check if you have the necessary include files to compile QT5 applications.
- Qt - http://qt-project.org/
- CMake - http://wiki.qtcentre.org/index.php?title=Compiling%5FQt4%5Fapps%5Fwith%5FCMake
2.- Generate the Makefile
qmake PREFIX=/usr/local klog.pro
5. Make everything.
make
5.5 (JUST FOR INFORMATION)
You will find the klog executable in the sources folder.

3
INSTALL-osx.txt Normal file
View File

@ -0,0 +1,3 @@
Installing KLog on a OSX system is easy.
Just click and drop the icon into the Applications folder

3
INSTALL-win.txt Normal file
View File

@ -0,0 +1,3 @@
Installing KLog on a Windows system is easy.
Just double-click on the installer and follow the steps.

9
INSTALL.txt Normal file
View File

@ -0,0 +1,9 @@
This file is about the installation process of KLog.
Please read:
INSTALL-linux.txt for linux installations.
INSTALL-OSX.txt for OSX installations.
INSTALL-win.txt for Windows installations.

1
NEWS Normal file
View File

@ -0,0 +1 @@
Look at http://jaime.robles.es/category/klog/ for NEWS of KLog

17
README Normal file
View File

@ -0,0 +1,17 @@
KLog is an updated version of KLog
The objective of KLog is to provide a free software that runs in Linux, OSX and Windows.
KLog will provide hamradio contest and DX logging support.
Check http://jaime.robles.es for news & updates.
Read the INSTALL.txt for installation purposes.
Read the changelog (windows users, rename to changelog.txt) to see the changes from one version to another.
Read README-DEVEL.txt if you want to help with KLog development.
Please send all your suggestions & bug reports.
I hope you enjoy KLog!
73 de Jaime, EA4TV

248
README-DEVEL Normal file
View File

@ -0,0 +1,248 @@
This is a file to read if you want to join the KLog development team.
This document will explain the KLog architecture, requirements, tips and important to know
things to take into account when joining the KLog development team.
CONTENT:
1 - BEFORE CODING
2 - KLOG ARCHITECTURE
3 - BEFORE CODING
4 - CODING
5 - AFTER CODING
6 - GUI
7 - DOCUMENTATION
8 - TRANSLATIONS
9 - DEPLOYING
0 - MISSION AND OBJECTIVE
The objective of KLog is to provide a free software that runs in Linux, OSX and Windows.
KLog will provide hamradio contest and DX logging support.
0.1 - REQUIREMENTS
- Able to run in Linux, OSX and Windows.
- Easy to use.
- Able to localize to any language.
- Any data can be exportable into ADIF (http://www.adif.org).
- Can import standard ADIF.
- Can export to Cabrillo (http://www.kkn.net/~trey/cabrillo/).
- Provides a user manual / documentation.
1 - BEFORE CODING:
Read this document.
Join the KLog mailing list and send a "Hello that's me and I am here" message:
http//MAILINGLIST
Interesting links:
http://www.qtcentre.org/wiki/index.php?title=Keeping_the_GUI_Responsive
Packer: http://upx.sourceforge.net/
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
2 - KLOG ARCHITECTURE
KLog is intended to be a MODULAR software with the requirement to be modular ;-) so it is easy to
add new features (mainly contests and awards support).
2.1 IMPORTANT THINGS TO HAVE IN MIND
- KLog version number is using the following system:
Release versions: The Decimal par of the version number will always use even numbers like 0, 1.2, 2.20, ...
while the decimal part of the development or Release Candidate versions will always be an odd number ie 0.1, 1.3, ...
The release number is defined in the "main.cpp" file.
- KLog should manage several logs. The "log" table of the DB has a column called "lognumber".
ALL QSO has a lognumber id that identifies the log it belongs to.
Each lognumber will have associated a Name and/or ID (TBD) so the user is able to "open" just
that log. It is important that all the QSO operations are aware of this lognumber id.
- The log table has a "marked" column. This column is to allow mass operations. Changing this column has
to be done with care and leave it "unmarked" once the desired operation is finished.
KLog should unmark(N) all QSO when starts and exits. Mark = 'X', unmark='N' or other.
Marked column should not be saved.
- Any change to the DB architecture must be communicated and agreed with the development team before
commiting to the SVN and following the 2.4 DB UPDATES area in this document.
2.2 CONTEST SUPPORT
The "Contest" class (in contest.h) is a base class and all the contest should inherit it.
The "Contest" class has several virtual functions that should re-implemented in all derived classes.
2.2.1 ADDING A NEW CONTEST
To add a new contest, a new class, inheriting the "Contest" class should be created.
The new contest file should be named: "contest_nameofthecontest.h" and "contest_nameofthecontest.cpp"
and should be included in the mainwindow.h
A new contest must include:
- Import/Export Cabrillo file
2.3 AWARD SUPPORT
2.4 DB UPDATES
A DB update consist on:
- All the intended changes.
- Update the softwarecontrol TABLE on the DB
To update the DB structure there are several things to have in mind:
- The current version of the DB is defined in database.h
const float DBVersionf = 0.003;
- All the actions to update the DB to the new structure are done here:
DataBase::updateIfNeeded
- After making any update
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
3 - BEFORE CODING
Update your sources from the SVN: Remember that other developer may has done a commit.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
4 - CODING
- The development language is English.
- All Strings to be shown to the user must be translatable. i.e. tr("String")
4.1 - STYLE
4.2 - ADIF SUPPORT
KLog is using some application defined ADIF fields: APP_{PROGRAMID}_{FIELDNAME}
Header fields:
APP_KLOG_LOG_DATE_EXPORT: The date and time (in UTC) when the log was exported.
APP_KLOG_QSOS: The number of QSOs in the log.
APP_KLOG_RELEASE: Release of KLog used to export the log file.
QSO fields:
APP_KLOG_POINTS: Points given by the QSO.
APP_KLOG_MULTIPLIER: Information about the multiplier status of the QSO.
KLog is also importing other application defined ADIF fields:
APP_N1MM_POINTS: That is imported into the points column in the log table.
4.3 SHORTCUTS
Before adding or modifying any shortcut:
- It should be agreed in the devel mailing list.
- It should be as standard as possible, reuse the same shortcuts of main/popular contest software.
- It should be checked and added to a list below.
4.4 DATA BASE
- The DB version has to be checked and modified after a DB schema modification.
- Any modification to the DB has to be provided with the code to update from any previous version.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
5 - AFTER CODING
Test that your code compiles and does not break the previous code.
Document your changes and close/update the tasks/bugs you have worked on.
Remember to commit your code to the SVN.
Try to do "atomic" commits. That is to commit updates that may be disabled as a block.
i.e. A new function or a modification to a function. Don't commit several things at once
if you can avoid it.
This is just a recommendation to avoid big commits that, in case of a problem are difficult to
trace.
Document your commits: ALWAYS add a clear comment to the commits so it is easy to know what is it about.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
6 - GUI
6.1 CONTEST GUI
- The GUI should only have the data fields that are needed for that contest, keeping the GUI simple
and easy to use.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
7 - DOCUMENTATION
- One feature will not be considered completed until it is not added to the user manual.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
9 - TRANSLATIONS
9.1 ADDING TRANSLATIONS
To add a new translation add the new language file to the klog.pro file following the sintax:
TRANSLATIONS = KLog_es.ts \
klog_fr.ts
Being es, fr, the ISO codes naming the language.
9.2 TRANSLATING
Translators should work in the *.ts files.
9.2 UPDATING TRANSLATIONS
Update translations:
Run: lupdate -verbose klog.pro
in the klog directory to update the language files
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
9 - DEPLOYING
Before deploying, translations should be updated.
9.1 DEPLOYING ON LINUX
9.2 DEPLOYING ON OSX
Rename the bundle directory (klog.app) from the sources directory to klog[VERSION].app
being [VERSION] the version to be deployed.
Run the following command from the sources directory:
macdeployqt KLog.app/ -dmg
mv KLog.dmg KLog-[VERSION].dmg
9.3 DEPLOYING ON WINDOWS
Currently using an Open Source Licence of: BitRock InstallBuilder
Installer:
http://en.wikipedia.org/wiki/List_of_installation_software

254
TODO Normal file
View File

@ -0,0 +1,254 @@
This is a kind of roadmap for KLog development.
It is not fixed... new features may be prioritized or not added without any notice ;-)
Feel free to request any roadmap change if you have any suggestion.
Bug: Check if the dxcluster configuration to show or not confirmed/worked works properly
KLog 0.9.1
TODO: Keep adapting to ADIF 3.0.4
KLog 0.9.2
TODO: Add the awards functionality (to manage awa files, TPEA, WAS, ...)
TODO: Add Satellite support (maybe another Tab) (look this file (below) for details.
TODO: Add another tab in the botton to list the DXCC status.
TBD - Add the feature to add and manage several logs.
TODO: Add an option to auto-complete info (QTH, Locator, Name, QSL Manager(qsl_via), IOTA, AWARD, Entity...) from previously worked QSO.
TODO: UI: Modify the DX-Cluster tab to show the data in a table: DX de/Freq/DX/Comment/Time/Loc
TODO: Keep adapting to ADIF 3.0.4
KLog 0.9.3
TODO: Support CQ WW SSB (Including Cabrillo Import/Export)
TODO: Support CQ WW CW (Including Cabrillo Import/Export)
KLog 0.9.4
TODO: Hamlib support (Linux).
TODO: Add a DXCluster bandmap.
KLog 0.9.5
TODO: Support CQ WPX SSB (Including Cabrillo Import/Export)
TODO: Support CQ WPX CW (Including Cabrillo Import/Export)
KLog 0.9.6
WORLDEDITOR Dialog
TODO: WorldEditor is not updated when the CTY.CSV file is updated
TODO: Create a function to check if the ADIF DXCC corresponds with the prefix.
TODO: Add a ComboBox to change and define a DXCC for each QSO.
TODO: World Editor: Create a way to add an entity.
TODO: World Editor: Create a way to remove an entity.
TODO: World Editor: Create a way to edit an entity.
KLog 0.9.7
TODO: Integrate with www.clublog.org (http://www.clublog.org/docs/pages/viewpage.action?pageId=1638482)
KLog 0.9.8
TODO: Integrate with eqsl.cc
KLog 0.9.9
TODO: Server to log all the QSO in real time (through the network) from N1MM
http://n1mm.hamdocs.com/tiki-index.php?page=UDP+Broadcasts&structure=N1MM+Logger+Documentation
<BUGS>
TODO: Check if the data has been modified (only memory) and save the data!
TODO BUG: When modifying allow deleting data (as in KLog 0.5.8)
DONE BUG: Worked DXCC and WAZ are not updated until confirmed :-?
DONE BUG: When toEdit, the IOTA field is not copied to the UI; IOTA needs to be added always with "6" chars in the BD (AF-001 and not "AF-1" or "AF-001")
</BUGS>
TODO: HelpHelpDialog
TODO: HelpAboutDialog
TODO: setuppagelogs.cpp
TODO: DXCluster: Lines that are not a DX should not be in another color than default.
TODO: Add a default DX Cluster server
TODO: Make a tool to mark and export QSO from the right button. (i.e. To mark several QSO to print and export the ADIF file with just those QSO)
TODO: Add all the Entity Info to the slotClear to clear everything.
TODO: Add a list of previous QSO with the same station, if any.
TODO: Create something like a void Awards::setAwardsOfAllQSO to read ALL QSO and set the Awards at once instead of adding one QSO per QSO
KLOG TODO:
TODO: To create a function tha runs the log and marks "N" if QSL has not been sent or received.
TODO: CTY.DAT update
TODO: Award tabs: center/bold tabs
TODO: Add export to cabrillo to the logfile
SETUP:
TODO: Show progress when doing actions
TODO: Open this file when opening
TODO: DXCLuster: Show HF activity
TODO: DXCLuster: Show WARC
TODO: DXCLuster: Show VHUF
TODO: DXCLuster: Show confirmed
TODO: DXCLuster: Show SSB
TODO: DXCLuster: Show CW
TODO: DXCLuster: Show Ann/full
TODO: DXCLuster: Show WCY
TODO: DXCLuster: Show WWV
TODO: DXCLuster: Double click on a spot, add it to log
TODO: DXCLuster: Add Cluster servers
DONE: TODO: Colors: Confirmed, Worked, Needed band, New, Default
TODO: Complete with previous QSO (Name, ...)
TODO: Require mandatory fields in all QSO
TODO: Awards: Add Award
TODO: Awards: Remove Award
=====================
<SATELLITE SUPPORT>
TODO: Add satellite input fields (in the others input Tab?)
TODO: Sat Modes:
http://www.amsat.org/amsat/intro/sats_faq.html#RTFToC5
http://www.sckans.edu/~sireland/radio/amsat.html
A - This mode requires a 2 meter SSB/CW transmitter and a 10 meter SSB/CW receiver and supports CW and voice.
B - This mode requires a 70 cm SSB/CW transmitter and a 2 meter SSB/CW receiver and supports CW and voice. Some satellites also support RTTY and SSTV in this mode.
J -> V Uplink and U downlink
JA - This mode stands for J Analog and requires a 2 meter SSB/CW transmitter and a 70 cm SSB/CW receiver and supports CW, voice.
JD - This mode stands for J Digital and requires a 2 meter FM transmitter and a 70 cm SSB/CW receiver and supports packet.
K - This mode requires a 15 meter SSB/CW transmitter and a 10 meter SSB/CW receiver and supports CW and voice. This mode is unique in that it can be done with a simple HF rig.
S - This mode requires a 70 cm SSB/CW transmitter and a 2.4 GHz SSB/CW receiver and supports CW and voice. Many people use a 2.4 GHz to 2 meter converter with a 2 meter SSB/CW receiver instead of buying a 2.4 GHz SSB/CW receiver.
T - This mode requires a 15 meter SSB/CW transmitter and a 2 meter SSB/CW receiver and supports CW and voice.
KT, KA, BS, Some satellites have dual modes that operate simultaneously. For example, AO-13 can operate in mode BS which means that it can do both mode B and mode S simultaneously. Other common dual modes are KT and KA.
Mode V
Mode U
Mode U/V -> B
</SATELLITE SUPPORT>
TODO: Code a way to sort the bands/modes in the "setuppagebandsmodes.cpp
TODO: Create an "updateKLog" class to manage all the release updates
so there is a way to detect the version of KLog and upgrade the DB to the latest.
TODO:
The following fields may add information, even if the qsl has not been rcvd/sent
<QSL_RCVD_VIA:1>B <QSL_SENT_VIA:1>B
TODO: showStatusOfDXCC should be executed when band change.
TODO: bandComboBox is populated with TOO much modes (repeated!).
TODO: Add color support: messages for slotQRZTextChanged
TODO: Add color support: log?
TODO: SetupPageColors: Check the style in the buttons as the rounds are lost when I change the color!!
TODO: MainWindow::processConfigLine: add support for the cluster data.
TODO: Check when to connect the DXCluster and when no, it tries twice or more...
TODO: Awards: make a function to calculate the total.
TODO: Working on the dxCluster: Tool to save the DXCluster in a file (for further analysis).
TODO: Color support: Add needed, worked, confirmed, neutral colors to the configuration dialog.
TODO: Color support: Support the bar when a QRZ is entered.
TODO: Color support: Calculate a color for the log.
TODO: World::getDXStatus: Calculate the algorithm to know the different status for a DXCC (confirmed, worked, confirmed in another band, ,...)
TODO: World:: Maybe the color should be returned from the World class
TODO: Check the readDataFromUI. QSO are not added when in contest.
TODO: Check that New Log, Open, ... somewhere the log table is removed from the DB!
TODO: The confirmed WAZ number is not properly calculated.
TODO: GUI: Add in the input box a combobox to change the CQZ
TODO: GUI: Add in the input box a combobox to change the ITUZ
TODO: GUI: Add in the input box a combobox to change the DXCC
TODO: In CQWWSSB, when editing QSO the SRX, Points, multiplier, ... are not sent to the edit so after "OK", those data are lost.
TODO: MainWindow::slotQsoDeleteFromLog: Add the CALL to the message before detele a QSO.
TODO: Search GUI: add multi-selection QSO to do the same actions inmultiple QSO.
TODO: When importing ADIF, update the logview sometimes... just to show the progress.
TODO: When importing ADIF: Only shows the ProgresDialog when the number is low >1000 <14000 investigate
TODO: Import Cabrillo
TODO: Add the Find QSOs to QSL.
TODO: Code the DX-Cluster connection.
TODO: To check how can I order the columns in the log or in the search QTableView. Now the order depends only on the order of the SQL table.
TODO: When mofiying a cell directly in the log, it is possible to select a mode/band that is not actually active in the configuration.
TODO: Slot: If (only)eqsl/lotw is sent/rec, the QSL_RCVD_VIA should be E
TODO: Code a Tool to get statistcs for the contests, some kind of post contest tool.
http://www.qsl.net/3v4-002/Contests/2011%20CQ-WW-SSB%203V8SS/index.htm
TODO: Be able to send scores to: http://www.cqcontest.ru/help/developers.jsp
TODO: Read the IOTA information in the qsoToEdit
TODO: Create an update CTY.DAT without overwriting the current data. Just Adding and correcting (asking) if data is already there but different.
TODO: Create an export CTY.DAT file to create a CTY.DAT file with ALL the data in the current "world".
FILEMANAGER
TODO: adifLogExportToFile: Count the marked QSO and adjust the numberOfQsos
TODO: FileManager::adifReadLog: Optimize the dialog (maybe updating only each 100 or as in KLog)
TODO: FileManager::adifReadLog: Add a semaphore/lock or similar to avoid running the same method twice or more at the same time... or at least the same file.
It seems that now it "serializes" the import...
TODO: Check that FileManager::adifLogExportToFile is exporting ALL the DB fields.
TODO: FileManager::adifLogExportToFile code a progress dialog for exporting.
TODO: When importing ADIF: Check if all the QSO have all the mandatory fields and warn the user if not.
Optimization: The ADIF import is very slow. Optimization is recommended.
IMPROVEMENT: Improve the result of the log printing.
DONE: TODO: Working on the DB version update functions
DONE: MainWindow::showAwards Remove "empty CQZ" when counting to avoid having 41 CQ zones
DONE: Code the color configuration for status of an entity (needed/worked/confirmed).
DONE: Color support: Calculate a color for the search results.
DONE: Color support: Calculate a color for the DXCluster.
DONE: TODO: Colors: Reconfigure the colors needs KLog to be restarted.
DONE: Working on the dxCluster: Color support, identify the different kind of lines... DX de, normal spots, comments, ...
DONE: Working on setAwardDXCC: When adding if a pair is already entered but we are going to add a confirmed status, modify it.
DONE: Right click on log to show a to edit QSO.
DONE: Right click on log to show a QSL received.
DONE: Right click on log to remove a QSO.
DONE: Right click on log to show a QSL sent.
TODO: Right click on search to remove a QSO.
DONE: Right click on search to show a QSL reception.
DONE: Right click on search to show a QSL sent.
DONE: Right click on search to show to edit QSO.
DONE: Added a select/unselect all button to the search QSO tab.
DONE: Search QSO to send
DONE: Add a button to export to ADIF the content of searchResultsTreeWidget
DONE: When importing ADIF, if the CQZ/ITUZ/DXCC is empty, calculate and add it.
DONE: Not export ADIF fields if "N":
DONE: Print the log.
DONE: TODO: Time in UTC
DONE: TODO: Log in real time
DONE: Double click on cluster to select
DONE: TODO: When double clicking on a DX-Spot, frequency should be also copied to inputbox
DONE: TODO: When a DX-Spot is selected, the DX-Entity and status should be shown.
DONE: TODO: DXCluster: Connect, disconnect and connect again does not work
DONE: TODO: Add a field in Mainwindow to manage RX_PWR
DONE: TODO: slotclearbuttons->Colors to default
TODO: Recalculate DXCC Status when deleting/modiying QSO - void Awards::recalculateAwards()

1697
awards.cpp Normal file

File diff suppressed because it is too large Load Diff

142
awards.h Normal file
View File

@ -0,0 +1,142 @@
#ifndef AWARDS_H
#define AWARDS_H
/***************************************************************************
awards.h - description
-------------------
begin : sept 2011
copyright : (C) 2011 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
//#include <QObject> // For the "tr" function
#include <QString>
#include <QSqlQuery>
#include <QSqlRecord>
#include <QVariant>
#include <QColor>
#include <QStringList>
#include <QProgressDialog>
#include <QMultiHash>
#include "world.h"
#include "dataproxy.h"
#include "dataproxy_sqlite.h"
class QProgressDialog;
class Awards
{
//Q_OBJECT
//friend class World;
public:
Awards();
~Awards();
void setAwards(const int _qsoId);
void setAwards(const int _dxcc, const int _waz, const int _band, const int _mode, const int _workedOrConfirmed, const int _logNumber, const int _qsoId);
/*
_workedOrConfirmed = 0 Set as Worked
_workedOrConfirmed = 1 Set as Confirmed
*/
void recalculateAwards();
//void setAwards(const int _qsoId, bool modify);
int getDXCCWorked(const int _logNumber);
int getDXCCConfirmed(const int _logNumber);
int getWAZWorked(const int _logNumber);
int getWAZConfirmed(const int _logNumber);
int getQSOsInLog(const int _logNumber);
bool getIsDXCCConfirmed(const int _dxcc, const int _logNumber);
QString checkIfValidIOTA(const QString _tiota);
int getDXStatus (const QStringList _qs);
QString getDXStatusString (const int _status); // Needs to be called with the output of getDXStatus
void setColors (const QString _newOne, const QString _needed, const QString _worked, const QString _confirmed, const QString _default);
QColor getQRZDXStatusColor(const QStringList _qs);
QColor getDefaultColor();
int getDXMarathonDXCC(const int _year, const int _logNumber);
int getDXMarathonCQ(const int _year, const int _logNumber);
int getDXMarathonScore(const int _year, const int _logNumber);
// Receives: QStringList _qs;
//_qs << QRZ << BandId << lognumber;
/*
0 - New one.
1 - Worked but not confirmed: New one in this band.
2 - Worked but not confirmed: Worked in this band.
3 - Confirmed: New one in this band.
4 - Confirmed: Worked in this band.
5 - Confirmed: Confirmed in this band.
6 - Default: Not applicable
*/
private:
void setAwardDXCC(const int _qsoId);
bool setAwardDXCC(const int _dxcc, const int _band, const int _mode, const int _workedOrConfirmed, const int _logNumber, const int _qsoId);
int setAwardDXCCst(const int _dxcc, const int _band, const int _mode, const bool _confirmed, const int _logNumber, const int _qsoId);
int setAwardDXCCConfirmed(const int _band, const int _mode, const int _dxcc, const int _newQSOid); // Changes the status of a DXCC from worked to confirmed
int setDXCCToQSO(const int _dxcc, const int _qsoid); // Defines the DXCC in a QSO
int setCQToQSO(const int _cqz, const int _qsoid); // Defines the CQ zone in a QSO
int dxccStatusBandMode(const int _ent, const int _band, const int _mode, const int _logNumber, bool _checkingMode); //-1 error / 0 Not worked / 1 worked / 2 confirmed
int dxccStatus(const int _ent, const int _logNumber); //-1 error / 0 Not worked / 1 worked / 2 confirmed
/*
_confirmed = 0 Set as Worked
_cConfirmed = 1 Set as Confirmed
*/
void setAwardWAZ(const int _qsoId);
bool setAwardWAZ(const int _cqz, const int _band, const int _mode, const int _workedOrConfirmed, const int _logNumber, const int _qsoId);
int setAwardWAZst(const int _cqz, const int _band, const int _mode, const bool _confirmed, const int _logNumber, const int _qsoId);
/*
_confirmed = 0 Set as Worked
_confirmed = 1 Set as Confirmed
*/
int getProgresStepForDialog(int totalSteps);
QColor newOneColor; //
QColor neededColor; //
QColor workedColor; //
QColor confirmedColor; //
QColor defaultColor;
World *world;
DataProxy *dataProxy;
typedef QMultiHash<int, int> DXStatus;
DXStatus dxccWorked, dxccConfirmed, wazWorked, wazConfirmed;
};
#endif // AWARDS_H

74
contest.cpp Normal file
View File

@ -0,0 +1,74 @@
/***************************************************************************
contest.cpp - description
-------------------
begin : sept 2011
copyright : (C) 2011 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
#include "contest.h"
//#include <QDebug>
Contest::Contest()
{
//qDebug() << "Contest::Contest" << endl;
}
Contest::Contest(const QStringList _qs)
{
//qDebug() << "Contest::Contest (_qs)" << endl;
}
Contest::~Contest()
{
}
bool Contest::isMultiplier(const QStringList _qs)
{
//qDebug() << "Contest::isMultiplier" << endl;
return false;
}
int Contest::getQSOPoints(const QStringList _qs)
{
//qDebug() << "Contest::getQSOPoints" << endl;
return 0;
}
int Contest::getTotalScore()
{
return 0;
}
int Contest::getMultipliers()
{
return 0;
}
int Contest::getPoints()
{
return 0;
}
bool Contest::saveFileToSend(const QString& _fileName)
{
//qDebug() << "Contest::saveFileToSend" << endl;
return false;
}

58
contest.h Normal file
View File

@ -0,0 +1,58 @@
#ifndef CONTEST_H
#define CONTEST_H
/***************************************************************************
contest.h - description
-------------------
begin : sept 2011
copyright : (C) 2011 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
#include <QString>
#include <QStringList>
#include <QTextEdit>
//#include <QtWidgets>
class Contest
{
public:
Contest();
Contest(const QStringList _qs);
~Contest();
virtual bool isMultiplier(const QStringList _qs);
virtual int getQSOPoints(const QStringList _qs);
virtual bool saveFileToSend(const QString& _fileName);
virtual int getTotalScore();
virtual int getMultipliers();
virtual int getPoints();
private:
int points;
int multipliers;
};
#endif // CONTEST_H

487
contest_cqwwdxssb.cpp Normal file
View File

@ -0,0 +1,487 @@
/***************************************************************************
contestcqwwdxssb.cpp - description
-------------------
begin : sept 2011
copyright : (C) 2011 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
#include "contest_cqwwdxssb.h"
//#include <QDebug>
/*
V. MULTIPLIER: Two types of multiplier will be used.
A multiplier of one (1) for each different zone contacted on each band.
A multiplier of one (1) for each different country contacted on each band.
Stations are permitted to contact their own country and zone for multiplier credit.
The CQ Zone Map, DXCC country list, WAE country list, and WAC boundaries are standards.
Maritime mobile stations count only for a zone multiplier.
VI. POINTS:
Contacts between stations on different continents are worth three (3) points.
Contacts between stations on the same continent but different countries, one (1) point.
Exception: For North American stations only, contacts between stations within the North American
boundaries count two (2) points.
Contacts between stations in the same country are permitted for zone or country multiplier
credit but have zero (0) point value.
VII. SCORING: All stations: the final score is the result of the total QSO points multiplied by
the sum of your zone and country multipliers.
Example: 1000 QSO points × 100 multiplier (30 Zones + 70 Countries) = 100,000 (final score).
*/
ContestCQWWDXSSB::ContestCQWWDXSSB()
{
//qDebug() << "ContestCQWWDXSSB::ContestCQWWDXSSB" << endl;
myEntity = "";
myCQz = "";
myContinent = "";
NA = -1;
mycategory = "";
arrlSection = "";
stationQrz = "";
claimedScore = "";
name = "";
address = "";
operators = "";
soapbox = "";
thiscontest = "";
club = "";
createdby = "";
}
ContestCQWWDXSSB::ContestCQWWDXSSB(const QStringList _qs)
{
// Receives: QStringList _qs;
//_qs << myEntity << myCQz << myContinent << NA-id;
myEntity = _qs.at(0);
myCQz = _qs.at(1);
myContinent = _qs.at(2);
NA = _qs.at(3); // NA is North America for scoring purposes
thiscontest = "CQ-WW-SSB";
mycategory = "SINGLE-OP ALL HIGH";
club = "NoClub";
createdby ="KLog-Alpha";
/* OFFICIAL CATEGORIES
CATEGORY: SINGLE-OP ALL HIGH
CATEGORY: SINGLE-OP 160M HIGH
CATEGORY: SINGLE-OP 80M HIGH
CATEGORY: SINGLE-OP 40M HIGH
CATEGORY: SINGLE-OP 20M HIGH
CATEGORY: SINGLE-OP 15M HIGH
CATEGORY: SINGLE-OP 10M HIGH
CATEGORY: SINGLE-OP ALL LOW
CATEGORY: SINGLE-OP 160M LOW
CATEGORY: SINGLE-OP 80M LOW
CATEGORY: SINGLE-OP 40M LOW
CATEGORY: SINGLE-OP 20M LOW
CATEGORY: SINGLE-OP 15M LOW
CATEGORY: SINGLE-OP 10M LOW
CATEGORY: SINGLE-OP ALL QRP
CATEGORY: SINGLE-OP 160M QRP
CATEGORY: SINGLE-OP 80M QRP
CATEGORY: SINGLE-OP 40M QRP
CATEGORY: SINGLE-OP 20M QRP
CATEGORY: SINGLE-OP 15M QRP
CATEGORY: SINGLE-OP 10M QRP
CATEGORY: SINGLE-OP-ASSISTED ALL
CATEGORY: SINGLE-OP-ASSISTED 160M
CATEGORY: SINGLE-OP-ASSISTED 80M
CATEGORY: SINGLE-OP-ASSISTED 40M
CATEGORY: SINGLE-OP-ASSISTED 20M
CATEGORY: SINGLE-OP-ASSISTED 15M
CATEGORY: SINGLE-OP-ASSISTED 10M
CATEGORY: MULTI-ONE
CATEGORY: MULTI-TWO
CATEGORY: MULTI-MULTI
CATEGORY: CHECKLOG
*/
arrlSection = "DX";
stationQrz = "";
claimedScore = "000";
name = "No-Name";
address = "MyPoBox\nADDRESS: SecondLineOfAddress";
operators = "EA4TV, EA4GCA";
soapbox = "MySoapbox\nSOAPBOX: Another line\nSOAPBOX: and even one more";
//qDebug() << "ContestCQWWDXSSB::ContestCQWWDXSSB: " << myEntity << "/" << myCQz << "/" << myContinent << "/" << NA << endl;
}
ContestCQWWDXSSB::~ContestCQWWDXSSB(){
}
bool ContestCQWWDXSSB::isMultiplier(const QStringList _qs){
//qDebug() << "ContestCQWWDXSSB::isMultiplier" << endl;
for (int i = 0; i<_qs.length(); i++){
////qDebug() << _qs.at(i) <<", ";
}
// Receives: QStringList _qs;
//_qs << DX-Entity << DXCQz << DX-band;
// V. MULTIPLIER: Two types of multiplier will be used.
//
// A multiplier of one (1) for each different zone contacted on each band.
// A multiplier of one (1) for each different country contacted on each band.
// Stations are permitted to contact their own country and zone for multiplier credit.
// The CQ Zone Map, DXCC country list, WAE country list, and WAC boundaries are standards.
// Maritime mobile stations count only for a zone multiplier.
if (_qs.length() != 3){
//qDebug() << "ContestCQWWDXSSB::isMultiplier: diferent THAN 3" << endl;
return false;
}
QString dxEntity = _qs.at(0);
QString dxCQz = _qs.at(1);
if (!( (isValidCQz(dxCQz) ) && (isValidEntity(dxEntity) ) ) ){
return false;
}
//TODO: Check if the band is a valid string
QString dxBand = _qs.at(2);
// A multiplier of one (1) for each different zone contacted on each band.
QString queryString;
QSqlQuery query;
queryString = QString("SELECT id FROM log WHERE bandid='%1' AND stx='%2'").arg(dxBand).arg(dxCQz);
//qDebug() << "ContestCQWWDXSSB::isMultiplier-1: " << queryString << endl;
query.exec(queryString);
query.next();
if (!(query.isValid())){
//qDebug() << "ContestCQWWDXSSB::isMultiplier: Not Worked Zone" << endl;
return true;
}
// A multiplier of one (1) for each different country contacted on each band.
queryString = QString("SELECT id FROM log WHERE bandid='%1' AND dxcc='%2'").arg(dxBand).arg(dxEntity);
//qDebug() << "ContestCQWWDXSSB::isMultiplier-2: " << queryString << endl;
query.exec(queryString);
query.next();
if (!(query.isValid())){
//qDebug() << "ContestCQWWDXSSB::isMultiplier: MULT2 - Not worked DXCC" << endl;
return true;
}
return false;
}
int ContestCQWWDXSSB::getQSOPoints(const QStringList _qs){
//qDebug() << "ContestCQWWDXSSB::getQSOPoints" << endl;
// Receives: QStringList _qs;
//_qs << DX-Entity << DX-Continent
// VI. POINTS:
//
// Contacts between stations on different continents are worth three (3) points.
// Contacts between stations on the same continent but different countries, one (1) point.
// Exception: For North American stations only, contacts between stations within the North American
// boundaries count two (2) points.
//
// Contacts between stations in the same country are permitted for zone or country multiplier
// credit but have zero (0) point value.
if (_qs.length() != 2){
return false;
}
QString dxEntity =_qs.at(0);
QString dxContinent = _qs.at(1);
if (myContinent != dxContinent){
return 3;
}else if (myContinent == NA) {
return 2;
} else if (myEntity != dxEntity){
return 1;
}else{
return 0;
}
return 0;
}
bool ContestCQWWDXSSB::isValidCQz(const QString _cqz){
//qDebug() << "ContestCQWWDXSSB::isValidCQz: " << _cqz << endl;
if ( (_cqz.toInt()>0) && (_cqz.toInt()<41) ){
return true;
}else{
return false;
}
return false;
}
bool ContestCQWWDXSSB::isValidEntity(const QString _ent){
//qDebug() << "ContestCQWWDXSSB::isValidEntity: " << _ent << endl;
if ( (_ent.toInt()>0) ) {
return true;
}else{
return false;
}
return false;
}
bool ContestCQWWDXSSB::saveFileToSend(const QString& _fileName)
{
//qDebug() << "Contest::saveFileToSend" << _fileName << endl;
QFile file(_fileName);
QSqlQuery query1;
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
return false;
QTextStream out(&file);
//_qs << myEntity << myCQz << myContinent << NA-id;
//myARRLSect << StationQRZ << myCategory << myClub <<
//myAddress << operators(comma separated EA4TV, EA4GCA, ...)
//SoapBox
out << "START-OF-LOG: 3" << endl;
out << "ARRL-SECTION: " << arrlSection << endl;
out << "CALLSIGN: " << stationQrz << endl;
out << "CATEGORY: " + mycategory << endl;
out << "CLAIMED-SCORE: " << claimedScore << endl;
out << "CLUB: " << club << endl;
out << "CONTEST: " << thiscontest << endl;
out << "NAME: " << name << endl;
out << "ADDRESS: " << address << endl;
out << "CREATED-BY: " << createdby << endl;
out << "OPERATORS: " << operators << endl;// [required for multi-op stations]
out << "SOAPBOX: " << soapbox << endl; //[add lines if needed]
QSqlQuery query("SELECT * FROM log");
QSqlRecord rec = query.record();
int nameCol;
QString aux1, aux2, queryString;
/*
START-OF-LOG: 3.0
CONTEST: CQ-WW-RTTY
CONTEST: CQ-WW-SSB
CONTEST: CQ-WW-CW
CALLSIGN: LU6ETB
CATEGORY-OPERATOR: SINGLE-OP
CATEGORY-BAND: 10M
CATEGORY-POWER: HIGH
CATEGORY-ASSISTED: NON-ASSISTED
CLAIMED-SCORE: 1410
OPERATORS: N5KO
CLUB: Radio Club Quilmes
NAME: Trey Garlough
ADDRESS: 7375 Oak Ridge Road
ADDRESS-CITY: Aptos
ADDRESS-STATE: CA
ADDRESS-POSTALCODE: 95003
ADDRESS-COUNTRY: USA
QSO: 3799 PH 2000-11-26 0711 N6TW 59 03 K9QZO 59 04 0
END-OF-LOG:
*/
while (query.next()) {
if ( query.isValid())
{
out << "QSO: ";
nameCol = rec.indexOf("freq");
aux1 = (query.value(nameCol)).toString();
if (aux1.length()<1)
{
nameCol = rec.indexOf("bandid");
aux1 = (query.value(nameCol)).toString();
queryString = QString("SELECT cabrillo FROM band WHERE id='%1'").arg(aux1);
query1.exec(queryString);
query1.next();
if (query1.isValid())
{
aux1 = query1.value(0).toString();
//qDebug() << "ContestCQWWDXSSB::saveFileToSend: band: " << queryString << "/" << aux1 << endl;
if (!(aux1.length()>1))
{
aux1 = " NULL";
}
}
}
aux1.remove(QChar('.'), Qt::CaseInsensitive);
out << aux1.rightJustified(5, ' ', true) << " ";
nameCol = rec.indexOf("modeid");
aux1 = (query.value(nameCol)).toString();
queryString = QString("SELECT name FROM mode WHERE id='%1'").arg(aux1);
query1.exec(queryString);
query1.next();
if (query1.isValid())
{
aux1 = (query1.value(0)).toString();
if (aux1=="RTTY")
{
out << "RY ";
}
else if (aux1=="CW")
{
out << "CW ";
}
else
{
out << "PH ";
}
}
nameCol = rec.indexOf("qso_date");
aux1 = (query.value(nameCol)).toString();
//qDebug() << "ContestCQWWDXSSB::saveFileToSend date: " << aux1 << endl;
aux1.replace(QString("/"), QString("-"));
if ((aux1.length()) == 10)
{
out << aux1 << " ";
}
nameCol = rec.indexOf("time_on");
aux1 = (query.value(nameCol)).toString();
//qDebug() << "ContestCQWWDXSSB::saveFileToSend time1: " << aux1 << endl;
aux1.remove(QChar(':'), Qt::CaseInsensitive);
aux1.truncate(4);
aux1 = aux1.leftJustified(4, '0', true);
out << aux1 << " ";
//qDebug() << "ContestCQWWDXSSB::saveFileToSend time2: " << aux1 << endl;
nameCol = rec.indexOf("station_callsign");
aux1 = (query.value(nameCol)).toString();
if (aux1.length()<3)
{
nameCol = rec.indexOf("operator");
aux1 = (query.value(nameCol)).toString();
}
out << aux1.leftJustified(13, ' ', true) << " ";
nameCol = rec.indexOf("rst_sent");
aux1 = (query.value(nameCol)).toString();
aux1.truncate(3);
out << aux1.leftJustified(3, ' ', true) << " ";
//qDebug() << "ContestCQWWDXSSB::saveFileToSend: rsttx" << aux1 << endl;
nameCol = rec.indexOf("stx");
aux1 = (query.value(nameCol)).toString();
aux1.truncate(6);
out << aux1.leftJustified(6, ' ', true) << " ";
nameCol = rec.indexOf("call");
aux1 = (query.value(nameCol)).toString();
aux1.truncate(13);
out << aux1.leftJustified(13, ' ') << " ";
nameCol = rec.indexOf("rst_rcvd");
aux1 = (query.value(nameCol)).toString();
out << aux1.leftJustified(3, ' ', true) << " ";
nameCol = rec.indexOf("srx");
aux1 = (query.value(nameCol)).toString();
aux1.truncate(6);
out << aux1.leftJustified(6, ' ', true) << " ";
nameCol = rec.indexOf("transmiterid");
aux1 = (query.value(nameCol)).toString();
aux1.truncate(1);
out << aux1 ;
// out << "0"; // This is the RIG used to log the QSO. 1 is used as
out << endl;
}
}
out << "END-OF-LOG:" << endl;
return true;
}
int ContestCQWWDXSSB::getTotalScore()
{
return (getMultipliers()) * (getPoints());
}
int ContestCQWWDXSSB::getMultipliers()
{
int multipliers = 0;
QSqlQuery query("SELECT * FROM log");
QSqlRecord rec = query.record();
int nameCol = rec.indexOf("multiplier");
while (query.next()) {
if (query.isValid())
{
multipliers += (query.value(nameCol)).toInt();
}
}
return multipliers;
}
int ContestCQWWDXSSB::getPoints()
{
int points = 0;
QSqlQuery query("SELECT * FROM log");
QSqlRecord rec = query.record();
int nameCol = rec.indexOf("points");
while (query.next()) {
if (query.isValid())
{
points += (query.value(nameCol)).toInt();
}
}
return points;
}

98
contest_cqwwdxssb.h Normal file
View File

@ -0,0 +1,98 @@
#ifndef CONTESTCQWWDXSSB_H
#define CONTESTCQWWDXSSB_H
/***************************************************************************
contestcqwwdxssb.h - description
-------------------
begin : sept 2011
copyright : (C) 2011 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
#include <QString>
#include <QSqlQuery>
#include <QSqlRecord>
#include <QFileDialog>
#include <QFile>
#include <QTextStream>
#include "contest.h"
class ContestCQWWDXSSB : public Contest {
public:
ContestCQWWDXSSB();
ContestCQWWDXSSB(const QStringList _qs);
~ContestCQWWDXSSB();
bool isMultiplier(const QStringList _qs);
// Receives: QStringList _qs;
//_qs << DX-Entity << DXCQz << DX-band;
int getQSOPoints(const QStringList _qs);
// Receives: QStringList _qs;
//_qs << DX-Entity << DX-Continent
bool saveFileToSend(const QString& _fileName);
int getTotalScore();
int getMultipliers();
int getPoints();
// NA in the constructor is North America for scoring purposes
private:
QString myEntity, myCQz, myContinent, NA, thiscontest, mycategory, arrlSection, stationQrz, claimedScore, name, address, operators, soapbox, club, createdby;
bool isValidCQz(const QString _cqz);
bool isValidEntity(const QString _ent);
};
/*
V. MULTIPLIER: Two types of multiplier will be used.
A multiplier of one (1) for each different zone contacted on each band.
A multiplier of one (1) for each different country contacted on each band.
Stations are permitted to contact their own country and zone for multiplier credit.
The CQ Zone Map, DXCC country list, WAE country list, and WAC boundaries are standards.
Maritime mobile stations count only for a zone multiplier.
VI. POINTS:
Contacts between stations on different continents are worth three (3) points.
Contacts between stations on the same continent but different countries, one (1) point.
Exception: For North American stations only, contacts between stations within the North American
boundaries count two (2) points.
Contacts between stations in the same country are permitted for zone or country multiplier
credit but have zero (0) point value.
VII. SCORING: All stations: the final score is the result of the total QSO points multiplied by
the sum of your zone and country multipliers.
Example: 1000 QSO points × 100 multiplier (30 Zones + 70 Countries) = 100,000 (final score).
*/
#endif // CONTESTCQWWDXSSB_H

1264
database.cpp Normal file

File diff suppressed because it is too large Load Diff

103
database.h Normal file
View File

@ -0,0 +1,103 @@
#ifndef DATABASE_H
#define DATABASE_H
/***************************************************************************
database.h - description
-------------------
begin : sept 2011
copyright : (C) 2011 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
#include <QSqlDatabase>
#include <QMessageBox>
#include <QSqlQuery>
#include <QtSql>
#include <QString>
#include <QDateTime>
class QSqlRelationalTableModel;
// Last db update 0.0.4
// Previous db update 0.0.3
const float DBVersionf = 0.004;
class DataBase
{
public:
DataBase(const QString _softVersion, bool inmemoryonly = false);
~DataBase();
bool createConnection();
//bool beginTransaction();
bool isValidBand (const QString b);
bool isValidMode (const QString b);
bool isValidBandNumber (const int b);
bool isValidModeNumber (const int b);
QString getBandNameFromNumber(const int _n);
QString getModeNameFromNumber(const int _n);
int getBandIdFromName(const QString b);
int getModeIdFromName(const QString b);
bool createBandModeMaps();
int getBandIDFromName2(const QString b);
int getModeIDFromName2(const QString b);
QString getBandNameFromID2(const int _i);
QString getModeNameFromID2(const int _i);
int getBandIdFromFreq(const QString fr); //Freq should be in MHz
bool unMarkAllQSO();
bool updateIfNeeded();
void compress();
private:
bool createDataBase();
bool isTheDBCreated();
bool updateToLatest();
bool updateTo003(); // Updates the DB to 0.0.3
bool updateTo004();
bool createTheBandQuickReference();
bool createTheModeQuickReference();
float dbVersion; // The current version of the DB. May differ from latestReaded if we are updating the DB!
QString softVersion;
float latestReaded; // The latest version of DB readed in the DB itself
bool inMemoryOnly; // The DB is to be created in memory, no file support... Faster but less safe!
QDateTime date;
QHash<QString, int> bandIDHash;
QHash<QString, int> modeIDHash;
QHash<int, QString> IDBandHash;
QHash<int, QString> IDModeHash;
QMap<QString, int> bandQMap;
QMap<QString, int> modeQMap;
//QSqlDatabase *db;
};
#endif // DATABASE_H

175
dataproxy.cpp Normal file
View File

@ -0,0 +1,175 @@
/***************************************************************************
dataproxy.cpp - description
-------------------
begin : sept 2014
copyright : (C) 2014 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
#include "dataproxy.h"
DataProxy::DataProxy()
{
//qDebug() << "DataProxy::DataProxy" << endl;
}
DataProxy::~DataProxy()
{
}
void DataProxy::createLogModel(){}
void DataProxy::createLogPanel(){}
int DataProxy::getIdFromModeName(const QString& _modeName)
{
return -1;
}
int DataProxy::getIdFromBandName(const QString& _bandName)
{
return -1;
}
QString DataProxy::getNameFromBandId (const int _id)
{
return "";
}
QString DataProxy::getNameFromModeId (const int _id)
{
return "";
}
int DataProxy::getLastQSOid()
{
return -1;
}
bool DataProxy::clearLog()
{
return false;
}
bool DataProxy::qslSentViaDirect(const int _qsoId, const QString _updateDate)
{
return false;
}
bool DataProxy::qslSentViaBureau(const int _qsoId, const QString _updateDate)
{
return false;
}
bool DataProxy::qslRecViaBureau(const int _qsoId, const QString _updateDate)
{
return false;
}
bool DataProxy::qslRecViaBureau(const int _qsoId, const QString _updateDate, const bool _queueSentQSL)
{
return false;
}
bool DataProxy::qslRecViaDirect(const int _qsoId, const QString _updateDate, const bool _queueSentQSL)
{
return false;
}
bool DataProxy::qslRecViaDirect(const int _qsoId, const QString _updateDate)
{
return false;
}
bool DataProxy::qslSentAsRequested(const int _qsoId, const QString _updateDate)
{
return false;
}
bool DataProxy::qslRecAsRequested(const int _qsoId, const QString _updateDate)
{
return false;
}
bool DataProxy::isQSLReceived(const int _qsoId)
{
return false;
}
bool DataProxy::isQSLSent(const int _qsoId)
{
return false;
}
QString DataProxy::getCallFromId(const int _qsoId)
{
return "";
}
bool DataProxy::deleteQSO(const int _qsoId)
{
return false;
}
int DataProxy::isWorkedB4(const QString _qrz, const int _currentLog)
{
return -1;
}
bool DataProxy::isDXCCConfirmed(const int _dxcc, const int _currentLog)
{
return false;
}
bool DataProxy::isHF(const int _band)
{
return false;
}
bool DataProxy::isWARC(const int _band)
{
return false;
}
bool DataProxy::isVHF(const int _band)
{
return false;
}
QStringList DataProxy::getOperatingYears(const int _currentLog)
{
return QStringList();
}
void DataProxy::compressDB()
{
}

74
dataproxy.h Normal file
View File

@ -0,0 +1,74 @@
#ifndef DATAPROXY_H
#define DATAPROXY_H
#include <QString>
#include <QStringList>
class DataProxy
{
public:
DataProxy();
// DataProxy(const QStringList _qs);
~DataProxy();
virtual void createLogModel();
virtual void createLogPanel();
//UI functions
virtual int getIdFromModeName(const QString& _modeName);
virtual int getIdFromBandName(const QString& _bandName);
virtual QString getNameFromBandId (const int _id);
virtual QString getNameFromModeId (const int _id);
virtual int getLastQSOid();
virtual bool clearLog();
virtual bool deleteQSO(const int _qsoId);
virtual int isWorkedB4(const QString _qrz, const int _currentLog);
virtual bool isDXCCConfirmed(const int _dxcc, const int _currentLog);
virtual bool isQSLReceived(const int _qsoId);
virtual bool isQSLSent(const int _qsoId);
virtual bool qslSentViaDirect(const int _qsoId, const QString _updateDate);
virtual bool qslSentViaBureau(const int _qsoId, const QString _updateDate);
virtual bool qslSentAsRequested(const int _qsoId, const QString _updateDate);
virtual bool qslRecAsRequested(const int _qsoId, const QString _updateDate);
virtual bool qslRecViaBureau(const int _qsoId, const QString _updateDate);
virtual bool qslRecViaBureau(const int _qsoId, const QString _updateDate, const bool _queueSentQSL);
virtual bool qslRecViaDirect(const int _qsoId, const QString _updateDate);
virtual bool qslRecViaDirect(const int _qsoId, const QString _updateDate, const bool _queueSentQSL);
virtual bool isHF(const int _band);
virtual bool isWARC(const int _band);
virtual bool isVHF(const int _band);
virtual QString getCallFromId(const int _qsoId);
virtual QStringList getOperatingYears(const int _currentLog);
virtual void compressDB();
/*
virtual bool addDXMarathonQSO(const int _year, const int _dxcc, const int _cqz, const int _power, const int _mode, const int qsoid, const int _currentLog);
virtual int getDXMarathonTotalScore(const int _year);
virtual int getDXMarathonCountries(const int _year);
virtual int getDXMarathonCQZones(const int _year);
*/
/*
virtual bool isMultiplier(const QStringList _qs);
virtual int getQSOPoints(const QStringList _qs);
virtual bool saveFileToSend(const QString& _fileName);
virtual int getTotalScore();
virtual int getMultipliers();
virtual int getPoints();
*/
private:
// int points;
// int multipliers;
};
#endif // DATAPROXY_H

633
dataproxy_sqlite.cpp Normal file
View File

@ -0,0 +1,633 @@
/***************************************************************************
dataproxy_sqlite.cpp - description
-------------------
begin : sept 2014
copyright : (C) 2014 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
#include "dataproxy_sqlite.h"
//#include <QDebug>
DataProxy_SQLite::DataProxy_SQLite()
{
//qDebug() << "DataProxy_SQLite::DataProxy_SQLite " << endl;
db = new DataBase(0);
dbCreated = db->createBandModeMaps();
}
DataProxy_SQLite::~DataProxy_SQLite(){
//qDebug() << "DataProxy_SQLite::~DataProxy_SQLite" << endl;
}
void DataProxy_SQLite::createLogModel(){
//qDebug() << "DataProxy_SQLite::createLogModel" << endl;
}
void DataProxy_SQLite::createLogPanel(){
//qDebug() << "DataProxy_SQLite::createLogPanel" << endl;
}
int DataProxy_SQLite::getIdFromModeName(const QString& _modeName)
{
//qDebug() << "DataProxy_SQLite::getIdFromModeName: " << _modeName << "/" << QString::number(db->getModeIDFromName2(_modeName)) << endl;
if (_modeName.length()<2)
{
return -3;
}
return db->getModeIDFromName2(_modeName);
}
int DataProxy_SQLite::getIdFromBandName(const QString& _bandName)
{
//qDebug() << "DataProxy_SQLite::getIdFromBandName: " << _bandName << "/" << QString::number(db->getBandIDFromName2(_bandName))<< endl;
if (_bandName.length()<1)
{
return -3;
}
return db->getBandIDFromName2(_bandName);
}
QString DataProxy_SQLite::getNameFromBandId (const int _id)
{
//qDebug() << "DataProxy_SQLite::getNameFromBandId " << endl;
return db->getBandNameFromID2(_id);
}
QString DataProxy_SQLite::getNameFromModeId (const int _id)
{
//qDebug() << "DataProxy_SQLite::getNameFromModeId" << endl;
return db->getModeNameFromID2(_id);
}
int DataProxy_SQLite::getLastQSOid()
{
//qDebug() << "DataProxy_SQLite::getLastQSOid" << endl;
QSqlQuery query;
if (query.exec("SELECT MAX(id) from log"))
{
query.next();
if (query.isValid())
{
return (query.value(0)).toInt();
}
else
{
return -1;
}
}
else
{
return -1;
}
}
bool DataProxy_SQLite::clearLog()
{
//qDebug() << "DataProxy_SQLite::clearLog" << endl;
int errorCode = 0;
QSqlQuery query;
if (query.exec("DELETE FROM log"))
{
//qDebug() << "DataProxy_SQLite::clearLog: Log deleted!" << endl;
}
else
{
//qDebug() << "DataProxy_SQLite::clearLog: Log deleted FAILED" << endl;
errorCode = query.lastError().number();
//qDebug() << "DataProxy_SQLite::clearLog - query error: " << QString::number(errorCode) << endl;
//qDebug() << "DataProxy_SQLite::clearLog: LastQuery: " << query.lastQuery() << endl;
//qDebug() << "DataProxy_SQLite::clearLog: LastError-data: " << query.lastError().databaseText() << endl;
//qDebug() << "DataProxy_SQLite::clearLog: LastError-driver: " << query.lastError().driverText() << endl;
//qDebug() << "DataProxy_SQLite::clearLog: LastError-n: " << QString::number(query.lastError().number() ) << endl;
}
if (query.exec("DELETE FROM awarddxcc"))
{
//qDebug() << "DataProxy_SQLite::clearLog: Awarddxcc deleted!" << endl;
}
else
{
//qDebug() << "DataProxy_SQLite::clearLog: Awarddxcc deletedFAILED" << endl;
errorCode = query.lastError().number();
//qDebug() << "DataProxy_SQLite::clearLog - query error: " << QString::number(errorCode) << endl;
//qDebug() << "DataProxy_SQLite::clearLog: LastQuery: " << query.lastQuery() << endl;
//qDebug() << "DataProxy_SQLite::clearLog: LastError-data: " << query.lastError().databaseText() << endl;
//qDebug() << "DataProxy_SQLite::clearLog: LastError-driver: " << query.lastError().driverText() << endl;
//qDebug() << "DataProxy_SQLite::clearLog: LastError-n: " << QString::number(query.lastError().number() ) << endl;
}
if (query.exec("DELETE FROM awardwaz"))
{
//qDebug() << "DataProxy_SQLite::clearLog: Awardwaz deleted!" << endl;
}
else
{
//qDebug() << "DataProxy_SQLite::clearLog: Awardwaz deleted FAILED" << endl;
errorCode = query.lastError().number();
//qDebug() << "DataProxy_SQLite::clearLog - query error: " << QString::number(errorCode) << endl;
//qDebug() << "DataProxy_SQLite::clearLog: LastQuery: " << query.lastQuery() << endl;
//qDebug() << "DataProxy_SQLite::clearLog: LastError-data: " << query.lastError().databaseText() << endl;
//qDebug() << "DataProxy_SQLite::clearLog: LastError-driver: " << query.lastError().driverText() << endl;
//qDebug() << "DataProxy_SQLite::clearLog: LastError-n: " << QString::number(query.lastError().number() ) << endl;
}
query.finish();
//query.clear();
if (query.isActive())
{
//qDebug() << "DataProxy_SQLite::clearLog: Query Active!" << endl;
return false;
}
else
{
query.prepare("VACUUM;");
//qDebug() << "DataProxy_SQLite::clearLog: Query Not Active!" << endl;
if (query.exec())
{
//qDebug() << "DataProxy_SQLite::clearLog: VACUUM OK!" << endl;
return true;
}
else
{
//qDebug() << "DataProxy_SQLite::clearLog: VACUUM FAILED" << endl;
errorCode = query.lastError().number();
//qDebug() << "DataProxy_SQLite::clearLog - query error: " << QString::number(errorCode) << endl;
//qDebug() << "DataProxy_SQLite::clearLog: LastQuery: " << query.lastQuery() << endl;
//qDebug() << "DataProxy_SQLite::clearLog: LastError-data: " << query.lastError().databaseText() << endl;
//qDebug() << "DataProxy_SQLite::clearLog: LastError-driver: " << query.lastError().driverText() << endl;
//qDebug() << "DataProxy_SQLite::clearLog: LastError-n: " << QString::number(query.lastError().number() ) << endl;
}
}
return false;
}
bool DataProxy_SQLite::qslSentViaDirect(const int _qsoId, const QString _updateDate)
{
//qDebug() << "DataProxy_SQLite::qslSentViaDirect" << endl;
QSqlQuery query;
QString stringQuery;
stringQuery = QString("UPDATE log SET qsl_sent = 'Y', qsl_sent_via = 'D', qslsdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId);
//QDebug() << "DataProxy_SQLite::qslSentViaDirect: " << stringQuery << endl;
if (query.exec(stringQuery))
{
return true;
}
return false;
}
bool DataProxy_SQLite::qslSentViaBureau(const int _qsoId, const QString _updateDate)
{
//qDebug() << "DataProxy_SQLite::qslSentViaBureau" << endl;
QSqlQuery query;
QString stringQuery;
stringQuery = QString("UPDATE log SET qsl_sent = 'Y', qsl_sent_via = 'B', qslsdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId);
if (query.exec(stringQuery))
{
return true;
}
return false;
}
bool DataProxy_SQLite::qslRecViaBureau(const int _qsoId, const QString _updateDate)
{
//qDebug() << "DataProxy_SQLite::" << QString::number (_qsoId) << "/" << _updateDate << endl;
QSqlQuery query;
QString stringQuery;
stringQuery = QString("UPDATE log SET qsl_rcvd = 'Y', qsl_rcvd_via = 'B', qslrdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId);
if (query.exec(stringQuery))
{
//qDebug() << "DataProxy_SQLite:: TRUE" << endl;
return true;
}
//qDebug() << "DataProxy_SQLite:: FALSE" << endl;
return false;
}
bool DataProxy_SQLite::qslRecViaBureau(const int _qsoId, const QString _updateDate, const bool _queueSentQSL)
{
//qDebug() << "DataProxy_SQLite::qslRecViaBureau: " << _updateDate << endl;
QSqlQuery query;
QString stringQuery;
bool requestQSL = false;
if (_queueSentQSL)
{
stringQuery = QString("SELECT qsl_sent FROM log WHERE id = '%1'").arg(_qsoId);
if(query.exec(stringQuery))
{
query.next();
if (query.isValid())
{
stringQuery = (query.value(0)).toString();
if ((stringQuery == "Y") || (stringQuery == "R"))
{
// NO ACTION REQUIRED, QSL IS ALREADY SENT
//qDebug() << "DataProxy_SQLite::qslRecViaBureau: QSL already requested" << endl;
requestQSL = false;
stringQuery = QString("UPDATE log SET qsl_rcvd = 'Y', qsl_rcvd_via = 'B', qslrdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId);
}
else
{
//qDebug() << "DataProxy_SQLite::qslRecViaBureau: Request QSL-1" << endl;
requestQSL = true;
stringQuery = QString("UPDATE log SET qsl_rcvd = 'Y', qsl_rcvd_via = 'B', qsl_sent='R', qslrdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId);
}
}
else
{
//qDebug() << "DataProxy_SQLite::qslRecViaBureau: Request QSL-2" << endl;
stringQuery = QString("UPDATE log SET qsl_rcvd = 'Y', qsl_rcvd_via = 'B', qsl_sent='R', qslrdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId);
requestQSL = true;
}
}
else
{
//qDebug() << "DataProxy_SQLite::qslRecViaBureau: Request QSL-3" << endl;
stringQuery = QString("UPDATE log SET qsl_rcvd = 'Y', qsl_rcvd_via = 'B', qsl_sent='R', qslrdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId);
requestQSL = true;
}
}
else
{
requestQSL = false;
stringQuery = QString("UPDATE log SET qsl_rcvd = 'Y', qsl_rcvd_via = 'B', qslrdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId);
}
//stringQuery = QString("UPDATE log SET qsl_rcvd = 'Y', qsl_rcvd_via = 'B', qslrdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId);
if (query.exec(stringQuery))
{
//qDebug() << "DataProxy_SQLite::qslRecViaBureau TRUE" << endl;
return true;
}
//qDebug() << "DataProxy_SQLite::qslRecViaBureau FALSE" << endl;
return false;
}
bool DataProxy_SQLite::qslRecViaDirect(const int _qsoId, const QString _updateDate)
{
//qDebug() << "DataProxy_SQLite::qslRecViaDirect" << endl;
QSqlQuery query;
QString stringQuery;
stringQuery = QString("UPDATE log SET qsl_rcvd = 'Y', qsl_rcvd_via = 'D', qslrdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId);
if (query.exec(stringQuery))
{
return true;
}
return false;
}
bool DataProxy_SQLite::qslRecViaDirect(const int _qsoId, const QString _updateDate, const bool _queueSentQSL)
{
//qDebug() << "DataProxy_SQLite::qslRecViaDirect: " << _updateDate << endl;
QSqlQuery query;
QString stringQuery;
if (_queueSentQSL)
{
stringQuery = QString("SELECT qsl_sent FROM log WHERE id = '%1'").arg(_qsoId);
if(query.exec(stringQuery))
{
query.next();
if (query.isValid())
{
stringQuery = (query.value(0)).toString();
if ((stringQuery == "Y") || (stringQuery == "R"))
{
// NO ACTION REQUIRED, QSL IS ALREADY SENT
//qDebug() << "DataProxy_SQLite::qslRecViaDirect: QSL already requested" << endl;
stringQuery = QString("UPDATE log SET qsl_rcvd = 'Y', qsl_rcvd_via = 'D', qslrdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId);
}
else
{
//qDebug() << "DataProxy_SQLite::qslRecViaDirect: Request QSL-1" << endl;
stringQuery = QString("UPDATE log SET qsl_rcvd = 'Y', qsl_rcvd_via = 'D', qsl_sent='R', qslrdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId);
}
}
else
{
//qDebug() << "DataProxy_SQLite::qslRecViaDirect: Request QSL-2" << endl;
stringQuery = QString("UPDATE log SET qsl_rcvd = 'Y', qsl_rcvd_via = 'D', qsl_sent='R', qslrdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId);
}
}
else
{
//qDebug() << "DataProxy_SQLite::qslRecViaDirect: Request QSL-3" << endl;
stringQuery = QString("UPDATE log SET qsl_rcvd = 'Y', qsl_rcvd_via = 'D', qsl_sent='R', qslrdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId);
}
}
else
{
stringQuery = QString("UPDATE log SET qsl_rcvd = 'Y', qsl_rcvd_via = 'D', qslrdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId);
}
if (query.exec(stringQuery))
{
//qDebug() << "DataProxy_SQLite::qslRecViaDirect TRUE" << endl;
return true;
}
//qDebug() << "DataProxy_SQLite::qslRecViaDirect FALSE" << endl;
return false;
}
bool DataProxy_SQLite::qslSentAsRequested(const int _qsoId, const QString _updateDate)
{
//TODO: Add some protection to the data before modifying
//qDebug() << "DataProxy_SQLite::qslSentAsRequested" << endl;
QSqlQuery query;
QString stringQuery;
stringQuery = QString("UPDATE log SET qsl_sent = 'R', qslsdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId);
//qDebug() << "DataProxy_SQLite::qslSentAsRequested: " << stringQuery << endl;
if (query.exec(stringQuery))
{
//qDebug() << "DataProxy_SQLite::qslSentAsRequested" << endl;
return true;
}
return false;
}
bool DataProxy_SQLite::qslRecAsRequested(const int _qsoId, const QString _updateDate)
{
//TODO: Add some protection to the data before modifying
//qDebug() << "DataProxy_SQLite::qslRecAsRequested" << endl;
QSqlQuery query;
QString stringQuery;
stringQuery = QString("UPDATE log SET qsl_rcvd = 'R', qslsdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId);
//qDebug() << "DataProxy_SQLite::qslRecAsRequested: " << stringQuery << endl;
if (query.exec(stringQuery))
{
//qDebug() << "DataProxy_SQLite::qslRecAsRequested" << endl;
return true;
}
return false;
}
bool DataProxy_SQLite::isQSLReceived(const int _qsoId)
{
//qDebug() << "DataProxy_SQLite::isQSLReceived" << QString::number(_qsoId) << endl;
QSqlQuery query;
QString stringQuery;
stringQuery = QString("SELECT qsl_rcvd FROM log WHERE id = '%1'").arg(_qsoId);
query.exec(stringQuery);
query.next();
if (query.isValid())
{
stringQuery = (query.value(0)).toString();
if (stringQuery == "Y")
{
//qDebug() << "DataProxy_SQLitew::isQSLReceived: " << QString::number(_qsoId) << "QSL Received" << endl;
return true;
}
else
{
//qDebug() << "DataProxy_SQLite::isQSLReceived: " << QString::number(_qsoId) << "QSL NOT Received-1" << endl;
return false;
}
}
else
{
//qDebug() << "DataProxy_SQLite::isQSLReceived: " << QString::number(_qsoId) << "QSL NOT Received-2" << endl;
return false;
}
}
bool DataProxy_SQLite::isQSLSent(const int _qsoId)
{
//qDebug() << "DataProxy_SQLite::isQSLSent: " << QString::number(_qsoId) << endl;
QSqlQuery query;
QString stringQuery;
stringQuery = QString("SELECT qsl_sent FROM log WHERE id = '%1'").arg(_qsoId);
query.exec(stringQuery);
query.next();
if (query.isValid())
{
stringQuery = (query.value(0)).toString();
if (stringQuery == "Y")
{
//qDebug() << "DataProxy_SQLite::isQSLSent: " << QString::number(_qsoId) << "QSL Sent" << endl;
return true;
}
else
{
//qDebug() << "DataProxy_SQLite::isQSLSent: " << QString::number(_qsoId) << "QSL NOT Sent-1" << endl;
return false;
}
}
else
{
//qDebug() << "DataProxy_SQLite::isQSLSent: " << QString::number(_qsoId) << "QSL NOT Sent-2" << endl;
return false;
}
}
QString DataProxy_SQLite::getCallFromId(const int _qsoId)
{
//qDebug() << "DataProxy_SQLite::getCallFromId" << endl;
QSqlQuery query;
QString stringQuery = QString("SELECT call FROM log WHERE id='%1'").arg(_qsoId);
query.exec(stringQuery);
query.next();
if (query.isValid())
{
return (query.value(0)).toString();
}
else
{
return "";
}
}
bool DataProxy_SQLite::deleteQSO(const int _qsoId)
{
//qDebug() << "DataProxy_SQLite::deleteQSO" << endl;
QSqlQuery query;
QString stringQuery = QString("DELETE FROM log WHERE id='%1'").arg(_qsoId);
return query.exec(stringQuery);
}
int DataProxy_SQLite::isWorkedB4(const QString _qrz, const int _currentLog)
{
//qDebug() << "DataProxy_SQLite::isWorkedB4" << endl;
QSqlQuery query;
QString queryString;
queryString = QString("SELECT id FROM log WHERE call='%1' AND lognumber='%2'").arg(_qrz).arg(_currentLog);
//queryString = "SELECT id FROM log WHERE call='" + _qrz +"'";
//qDebug() << "World::checkIfWorkedB4: " << queryString << endl;
query.exec(queryString);
query.next();
if (query.isValid())
{
return (query.value(0)).toInt();
}
else
{
return -1;
}
}
bool DataProxy_SQLite::isDXCCConfirmed(const int _dxcc, const int _currentLog)
{
//qDebug() << "DataProxy_SQLite::isDXCCConfirmed: " << QString::number(_dxcc) << "/" << QString::number(_currentLog) << endl;
QString queryString = QString("SELECT confirmed from awarddxcc WHERE dxcc='%1' AND lognumber='%2'").arg(_dxcc).arg(_currentLog);
QSqlQuery query;
if (query.exec (queryString))
{
query.next();
if (query.isValid())
{
if ( (query.value(0)).toInt() == 1)
{
//qDebug() << "DataProxy_SQLite::isDXCCConfrmed: TRUE" << endl;
return true;
}
else
{
//qDebug() << "DataProxy_SQLite::isDXCCConfrmed: FALSE1" << endl;
return false;
}
}
else
{
//qDebug() << "DataProxy_SQLite::isDXCCConfrmed: FALSE2" << endl;
return false;
}
}
else
{
//qDebug() << "DataProxy_SQLite::isDXCCConfrmed: FALSE3" << endl;
return false;
}
//qDebug() << "DataProxy_SQLite::isDXCCConfrmed: FALSE4" << endl;
return false;
}
bool DataProxy_SQLite::isHF(const int _band)
{
if ((_band>=18) && (_band<=27))
{
//qDebug() << "DataProxy_SQLite::isHF: TRUE" << endl;
return true;
}
else
{
//qDebug() << "DataProxy_SQLite::isHF: FALSE" << endl;
return false;
}
}
bool DataProxy_SQLite::isWARC(const int _band)
{
if ((_band == 19) || (_band==21) ||(_band==23) )
{
//qDebug() << "DataProxy_SQLite::isWARC: tRUE" << endl;
return true;
}
else
{
//qDebug() << "DataProxy_SQLite::isWARC: FALSE" << endl;
return false;
}
}
bool DataProxy_SQLite::isVHF(const int _band)
{
if (_band<=17)
{
//qDebug() << "DataProxy_SQLite::isVHF: TRUE" << endl;
return true;
}
else
{
//qDebug() << "DataProxy_SQLite::isVHF: FALSE" << endl;
return false;
}
}
QStringList DataProxy_SQLite::getOperatingYears(const int _currentLog)
{
//qDebug() << "DataProxy_SQLite::getYearsOperating: " << QString::number(_currentLog) << endl;
QStringList years = QStringList();
QSqlQuery query;
QString queryString = QString("SELECT DISTINCT (substr (qso_date, 0, 5)) FROM log WHERE lognumber='%0'").arg(_currentLog);
QString year = QString();
bool sqlOk = query.exec(queryString);
if (sqlOk)
{
while (query.next())
{
if (query.isValid())
{
year = (query.value(0)).toString();
years << year;
year.clear();
}
}
return years;
//return years.sort();
}
else
{
return years;
}
}
void DataProxy_SQLite::compressDB()
{
db->compress();
}

58
dataproxy_sqlite.h Normal file
View File

@ -0,0 +1,58 @@
#ifndef DATAPROXY_SQLITE_H
#define DATAPROXY_SQLITE_H
#include <QString>
#include <QStringList>
#include "dataproxy.h"
#include "database.h"
class DataProxy_SQLite : public DataProxy {
public:
DataProxy_SQLite();
~DataProxy_SQLite();
void createLogModel();
void createLogPanel();
int getIdFromModeName(const QString& _modeName);
int getIdFromBandName(const QString& _bandName);
QString getNameFromBandId (const int _id);
QString getNameFromModeId (const int _id);
int getLastQSOid();
bool deleteQSO(const int _qsoId);
int isWorkedB4(const QString _qrz, const int _currentLog);
bool isDXCCConfirmed(const int _dxcc, const int _currentLog);
bool isQSLReceived(const int _qsoId);
bool isQSLSent(const int _qsoId);
bool qslSentViaDirect(const int _qsoId, const QString _updateDate);
bool qslSentViaBureau(const int _qsoId, const QString _updateDate);
bool qslRecViaBureau(const int _qsoId, const QString _updateDate);
bool qslRecViaBureau(const int _qsoId, const QString _updateDate, const bool _queueSentQSL);
bool qslRecViaDirect(const int _qsoId, const QString _updateDate);
bool qslRecViaDirect(const int _qsoId, const QString _updateDate, const bool _queueSentQSL);
bool qslSentAsRequested(const int _qsoId, const QString _updateDate);
bool qslRecAsRequested(const int _qsoId, const QString _updateDate);
bool isHF(const int _band);
bool isWARC(const int _band);
bool isVHF(const int _band);
QString getCallFromId(const int _qsoId);
QStringList getOperatingYears(const int _currentLog);
void compressDB();
bool clearLog();
private:
bool dbCreated;
DataBase *db;
//QSqlRelationalTableModel *logModel;
};
#endif // DATAPROXY_SQLITE_H

126
downloadcty.cpp Normal file
View File

@ -0,0 +1,126 @@
#include "downloadcty.h"
#include <QCoreApplication>
#include <QUrl>
#include <QNetworkRequest>
#include <QFile>
//#include <QDebug>
DownLoadCTY::DownLoadCTY(const QString _kontestDir) : QObject(0)
{
kontestDir = _kontestDir;
//qDebug() << "DownLoadCTY::DownLoadCTY(): " << kontestDir << endl;
result = -1; // Error unknown
//http://www.country-files.com/cty/cty.csv
this->setTarget("http://www.country-files.com/cty/cty.csv");
// this->setTarget("http://www.country-files.com/cty/cty.dat");
QObject::connect(&manager, SIGNAL(finished(QNetworkReply*)),this, SLOT(downloadFinished(QNetworkReply*)));
}
DownLoadCTY::~DownLoadCTY()
{
//qDebug() << "DownLoadCTY::~DownLoadCTY" << endl;
}
void DownLoadCTY::setTarget(const QString &t){
//qDebug() << "DownLoadCTY::setTarget: " << t << endl;
this->target = t;
}
void DownLoadCTY::downloadFinished(QNetworkReply *data)
{
//qDebug() << "DownLoadCTY::downloadFinished" << endl;
QFile localFile("cty.csv");
result = data->error();
//qDebug() << "DownLoadCTY::downloadFinished - Result = " << QString::number(result) << endl;
if (result == QNetworkReply::NoError)
{
if (!localFile.open(QIODevice::WriteOnly))
{
//qDebug() << "DownLoadCTY::downloadFinished: CTY file could not be created!" << endl;
emit actionReturnDownload(-1);
//return;
}
else
{
const QByteArray sdata = data->readAll();
localFile.write(sdata);
//qDebug() << sdata;
if (localFile.flush())
{
//qDebug() << "DownLoadCTY::downloadFinished: CTY file Flushed 100%!" << endl;
}
else
{
//qDebug() << "DownLoadCTY::downloadFinished: CTY file NOT flushed 100%!" << endl;
}
localFile.close();
//qDebug() << "DownLoadCTY::downloadFinished: and CTY file created!" << endl;
emit actionReturnDownload(result);
}
}
else
{
//qDebug() << "DownLoadCTY::downloadFinished - Result = UNDEFINED = " << QString::number(result) << endl;
}
//TODO: Check if the cty.csv file is already existing.
//qDebug() << "DownLoadCTY::downloadFinished - Result = " << QString::number(result) << endl;
emit done();
}
int DownLoadCTY::download()
{
//qDebug() << "DownLoadCTY::download " << endl;
QUrl url = QUrl::fromEncoded(this->target.toLocal8Bit());
QNetworkRequest request(url);
// QNetworkReply *reply= manager.get(request);
reply = manager.get(request);
QObject::connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(slotErrorManagement(QNetworkReply::NetworkError)), Qt::QueuedConnection);
QObject::connect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(downloadProgress(qint64,qint64)));
//qDebug() << "DownLoadCTY::download: " << QString::number(result) << endl;
return 1;
}
void DownLoadCTY::downloadProgress(qint64 received, qint64 total) {
//qDebug() << received << total;
//qDebug() << "DownLoadCTY::downloadProgress: " << QString::number(received) << "/" << QString::number(total) << endl;
emit actionShowProgres(received, total);
}
void DownLoadCTY::slotErrorManagement(QNetworkReply::NetworkError networkError)
{
//qDebug() << "DownLoadCTY::slotErrorManagement: " << QString::number(networkError) << endl;
result = networkError;
if (result == QNetworkReply::NoError)
{
}
else if (result == QNetworkReply::HostNotFoundError)
{
//qDebug() << "DownLoadCTY::downloadFinished: Host not found" << endl;
}
else
{
//qDebug() << "DownLoadCTY::downloadFinished: ERROR!" << endl;
}
actionError(result);
}

42
downloadcty.h Normal file
View File

@ -0,0 +1,42 @@
#ifndef DOWNLOADCTY_H
#define DOWNLOADCTY_H
#include <QObject>
#include <QString>
#include <QProgressDialog>
#include <QtNetwork/QNetworkAccessManager>
#include <QtNetwork/QNetworkReply>
class DownLoadCTY : public QObject {
Q_OBJECT
public:
explicit DownLoadCTY(const QString _kontestDir);
~DownLoadCTY();
int download();
private:
void setTarget(const QString& t);
QNetworkAccessManager manager;
QNetworkReply* reply;
QString target;
int result; // enum QNetworkReply::NetworkError
QString kontestDir;
private slots:
void downloadFinished(QNetworkReply* data);
void downloadProgress(qint64 received, qint64 total);
void slotErrorManagement(QNetworkReply::NetworkError networkError);
signals:
void actionReturnDownload(const int _i);
void done();
void actionShowProgres(qint64 received, qint64 total);
void actionError(const int _i);
};
#endif // DOWNLOADCTY_H

677
dxcluster.cpp Normal file
View File

@ -0,0 +1,677 @@
/***************************************************************************
dxcluster.cpp - description
-------------------
begin : oct 2011
copyright : (C) 2011 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
#include "dxcluster.h"
DXClusterWidget::DXClusterWidget(QWidget *parent)
: QWidget(parent)
{
//qDebug() << "DXClusterWidget::DXClusterWidget" << endl;
awards = new Awards();
dataProxy = new DataProxy();
initClass();
}
void DXClusterWidget::initClass()
{
dxClusterConnected = false;
dxClusterAlreadyConnected = false;
showhf = true;
showvhf = true;
showwarc = true;
showworked = true;
showconfirmed = true;
showann = true;
showwwv = true;
showwcy = true;
currentLog = 0;
}
DXClusterWidget::DXClusterWidget(const QString &clusterToConnect, const int portToConnect, QWidget *parent)
: QWidget(parent)
{
//qDebug() << "DXClusterWidget::DXClusterWidget" << clusterToConnect << QString::number(portToConnect) << endl;
initClass();
server = clusterToConnect;
port = portToConnect;
dxSpotColor.setNamedColor("slategrey");
//defaultColor.setNamedColor("slategrey");
//neededColor.setNamedColor("slategrey");
//workedColor.setNamedColor("slategrey");
//confirmedColor.setNamedColor("slategrey");
//newOneColor.setNamedColor("slategrey");
world = new World();
awards = new Awards();
dataProxy = new DataProxy_SQLite();
tcpSocket = new QTcpSocket(this);
dxClusterListWidget = new QListWidget();
inputCommand = new QLineEdit;
sendButton = new QPushButton;
clearButton = new QPushButton;
inputCommand->setDisabled(true);
inputCommand->setToolTip(tr("Click on Connect to connect to the DX-Cluster server"));
dxClusterListWidget->setMouseTracking(true);
sendButton->setText(tr("Connect"));
clearButton->setText(tr("Clear"));
QHBoxLayout *bottonLayout = new QHBoxLayout;
bottonLayout->addWidget(inputCommand);
bottonLayout->addWidget(sendButton);
bottonLayout->addWidget(clearButton);
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(dxClusterListWidget);
layout->addLayout(bottonLayout);
setLayout(layout);
connect(sendButton , SIGNAL(clicked()), this, SLOT(slotClusterSendToServer()) );
connect(inputCommand, SIGNAL(textChanged(QString)), this, SLOT(slotClusterInputTextChanged()) );
//connect(searchResultsTreeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(slotDoubleClickSearch(QTreeWidgetItem *, int)));
connect(dxClusterListWidget, SIGNAL(itemDoubleClicked ( QListWidgetItem *)), this, SLOT(slotClusterDXClusterWidgetItemDoubleClicked( QListWidgetItem * )) );
connect(dxClusterListWidget, SIGNAL(itemEntered ( QListWidgetItem *)), this, SLOT(slotClusterDXClusterWidgetItemEntered( QListWidgetItem * )) );
connect(dxClusterListWidget, SIGNAL(itemSelectionChanged()), this, SLOT(slotClusterDXClusterWidgetItemSelected() ) );
//void QListWidget::itemDoubleClicked ( QListWidgetItem * item ) [signal]
// TO BE DELETED
addData();
}
void DXClusterWidget::addData()
{
//qDebug() << "DXClusterWidget::addData " << endl;
dxClusterSpotItem * item = new dxClusterSpotItem(dxClusterListWidget, tr("Click on connect to connect to the DX-Cluster"), awards->getDefaultColor());
}
DXClusterWidget::~DXClusterWidget()
{
//qDebug() << "DXClusterWidget::~DXClusterWidget" << endl;
}
void DXClusterWidget::slotClusterDXClusterWidgetItemDoubleClicked( QListWidgetItem * item )
{
//qDebug() << "DXClusterWidget::slotClusterDXClusterWidgetItemDoubleClicked: " << endl;
QStringList ql;
ql.clear();
if (item)
{
ql = readItem(item);
if (ql.length()==2)
{
ql << "double";
emit dxspotclicked(ql);
}
else
{
}
}
else
{
}
}
void DXClusterWidget::connectToDXCluster()
{
//qDebug() << "DXClusterWidget::connectToDXCluster" << endl;
if (dxClusterConnected)
{
//qDebug() << "DXClusterWidget::connectToDXCluster: - Already connected!!" << endl;
return; // If we are connected we don't want to start another connection
}
connect(tcpSocket, SIGNAL(connected()), SLOT(slotClusterSocketConnected()) );
connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(slotClusterDataArrived() ));
connect(tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(slotClusterDisplayError(QAbstractSocket::SocketError)));
connect(tcpSocket, SIGNAL(disconnected()), SLOT(slotClusterSocketConnectionClosed()) );
connect(inputCommand, SIGNAL(returnPressed()), this, SLOT(slotClusterSendToServer()) );
connect(clearButton, SIGNAL(clicked()), this, SLOT(slotClusterClearLineInput()) );
tcpSocket->connectToHost( server, port );
dxClusterListWidget->setSortingEnabled (false);
dxClusterSpotItem * item = new dxClusterSpotItem(dxClusterListWidget, tr("Trying to connect to the server\n"), awards->getDefaultColor());
}
void DXClusterWidget::slotClusterDisplayError(QAbstractSocket::SocketError socketError)
{
//qDebug() << "DXClusterWidget:displayError:" << endl;
switch (socketError) {
case QAbstractSocket::RemoteHostClosedError:
break;
case QAbstractSocket::HostNotFoundError:
QMessageBox::warning(this, tr("KLog DXCluster"),
tr("The host was not found. Please check:\n\n"
"- your network connection;\n"
"- the host name and port settings."));
break;
case QAbstractSocket::ConnectionRefusedError:
QMessageBox::warning(this, tr("KLog DXCluster"),
tr("The connection was refused by the peer. "
"Make sure the DXCluster server is running, "
"and check that the host name and port "
"settings are correct."));
break;
default:
QMessageBox::warning(this, tr("KLog DXCluster"),
tr("The following error occurred: %1.")
.arg(tcpSocket->errorString()));
}
}
bool DXClusterWidget::checkIfNeedsToBePrinted(const QString _dxCall, int const _band, const int _mode)
{
//qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: " << _dxCall << "/" << dataProxy->getNameFromBandId(_band) << QString::number(_mode)<< endl;
QStringList qs;
qs.clear();
qs << _dxCall << QString::number(_band) << QString::number(_mode) << QString::number(currentLog);
bool isConfirmed = false;
int status = awards->getDXStatus (qs);
if (!showconfirmed)
{
//qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: is confirmed? ("<< QString::number(status)<< ")" << endl;
if (status == 3)
{
//qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: It is confirmed: DON'T' print: " << _dxCall <<"/" << dataProxy->getNameFromBandId(_band) << endl;
return false;
}
}
if (!showhf)
{
//qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: is HF?" << endl;
if (dataProxy->isHF(_band))
{
//qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: Not showing HF but... is it WARC?" << endl;
if ( (showwarc) && dataProxy->isWARC(_band) )
{
//qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: Not showing HF but... is WARC, print!" << endl;
return true;
}
//qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: is HF: DON'T print: "<< _dxCall << "/" << dataProxy->getNameFromBandId(_band) << QString::number(_mode)<< endl;
return false;
}
else
{
//qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: is NOT HF" << endl;
}
}
if (!showwarc)
{
//qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: is WARC?" << endl;
if (dataProxy->isWARC(_band))
{
//qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: is WARC, DON'T print: "<< _dxCall << "/" << dataProxy->getNameFromBandId(_band) << QString::number(_mode)<< endl;
return false;
}
else
{
//qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: is NOT WARC" << endl;
}
}
if (!showvhf)
{
//qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: is VHF?" << endl;
if (dataProxy->isVHF(_band))
{
//qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: is VHF, DON'T print: "<< _dxCall << "/" << dataProxy->getNameFromBandId(_band) << QString::number(_mode)<< endl;
return false;
}
else
{
//qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: is NOT VHF " << endl;
}
}
//qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: returns TRUE and will be printed: " << _dxCall << "/" << dataProxy->getNameFromBandId(_band) << QString::number(_mode)<< endl;
return true;
}
void DXClusterWidget::setCurrentLog(const int _log)
{
currentLog = _log;
}
void DXClusterWidget::slotClusterDataArrived()
{
//qDebug() << "DXClusterWidget::slotClusterDataArrived" << endl;
QStringList qs;
QString dxClusterString;
QString dxCall;
QString dxFrequency;
QString spotBand;
spotBand = "-1";
bool isADXSpot = false;
while ( tcpSocket->canReadLine() ) {
dxClusterString = tcpSocket->readLine();
dxClusterString = dxClusterString.trimmed();
QStringList tokens = dxClusterString.split(" ", QString::SkipEmptyParts);
if (tokens.size()<2){
return;
}
// It is a "DX de SP0TTER FREC DXCALL"
//0 = DX, 1 = de, 2 = spotter, 3 = Freq, 4 = dxcall, 5 = comment
//qDebug() << "DXClusterWidget::slotClusterDataArrived: " << "DXCLUSTER->" << dxClusterString << "\nTOKENS: " << tokens << endl;
if ((tokens[0] == "DX") && (tokens[1] == "de"))
{
//qDebug() << "DXClusterWidget::slotClusterDataArrived: DX DE" << endl;
isADXSpot = true;
QString spotter = tokens[2];
spotter.truncate(spotter.size() - 1);
dxFrequency = tokens[3];
// Convert KHz to MHz...
//dxFrequency = QString::number(abs (dxFrequency.toFloat())/1000);
dxFrequency = QString::number( (dxFrequency.toFloat())/1000);
//
spotBand = QString::number(world->getBandIdFromFreq( dxFrequency ) );
dxCall = tokens[4];
qs.clear();
spotBand = QString::number(world->getBandIdFromFreq( dxFrequency ) );
qs << dxCall << spotBand << "-1" << "0";
dxSpotColor = awards->getQRZDXStatusColor(qs);
//qDebug() << "DX de ->" << spotter << dxFrequency << dxCall << endl;
}
else if ((tokens[0] == "To") && (tokens[1] == "ALL"))
{
//qDebug() << "DXClusterWidget::slotClusterDataArrived: TO ALL" << endl;
dxSpotColor = awards->getDefaultColor();
}
else if ( (dxClusterString.length()>=5) && (world->checkQRZValidFormat(tokens[1])) )
{ // Freq / DXCall / Date // time
//_qs << QRZ << Freq in MHz << lognumber;
//qDebug() << "DXClusterWidget::slotClusterDataArrived: LENGTH >= 5" << endl;
isADXSpot = true;
dxCall = tokens[1];
dxFrequency = tokens[0];
dxFrequency = QString::number( (dxFrequency.toFloat())/1000);
qs.clear();
spotBand = QString::number(world->getBandIdFromFreq( dxFrequency ) );
qs << dxCall << spotBand << "-1" << "0";
dxSpotColor = awards->getQRZDXStatusColor(qs);
}
else
{
//qDebug() << "DXClusterWidget::slotClusterDataArrived: DEFAULT" << endl;
dxSpotColor = awards->getDefaultColor();
}
// qs.clear();
//spotBand = QString::number(world->getBandIdFromFreq( dxFrequency ) );
//qs << dxCall << spotBand << "0";
//dxSpotColor = awards->getQRZDXStatusColor(qs);
//qDebug() << "DXClusterWidget::slotClusterDataArrived: Call/dxSpotColor: " << dxCall <<"/"<< dxSpotColor.name() << endl;
//dxClusterSpotItem * item = new dxClusterSpotItem(dxClusterListWidget, dxClusterString, dxSpotColor);
//TODO: Change the "-1" by the mode
if (!checkIfNeedsToBePrinted(dxCall, spotBand.toInt(), -1))
{
//qDebug() << "DXClusterWidget::slotClusterDataArrived - Not to be printed!: " << dxCall << endl;
return;
}
QListWidgetItem *item = new QListWidgetItem();
item->setForeground(QBrush(dxSpotColor));
item->setText(dxClusterString);
dxClusterListWidget->insertItem(0,item);
//dxClusterListWidget->insertItem(0,item);
//QListWidgetItem *item = new QListWidgetItem();
//item->setForeground(QBrush(awards->getQRZDXStatusColor(qs)));
//item->setText(dxClusterString);
//dxClusterListWidget->insertItem(0,item);
}
//qDebug() << "DXClusterWidget::slotClusterDataArrived: " << dxClusterString << endl;
}
void DXClusterWidget::slotClusterSocketConnected()
{
//qDebug() << "DXClusterWidget::slotClusterSocketConnected" << endl;
QListWidgetItem *item = new QListWidgetItem();
item->setForeground(QBrush(awards->getDefaultColor()));
item->setText(tr("Connected to server"));
dxClusterListWidget->insertItem(0,item);
// dxClusterSpotItem * item = new dxClusterSpotItem(dxclusterListWidget, i18n("Connected to server"), awards->getDefaultColor());
dxClusterConnected = true;
inputCommand->setFocus(Qt::OtherFocusReason);
if (( dxClusterConnected ) && (!dxClusterAlreadyConnected) ){
bool ok;
QString callsignText = QInputDialog::getText(this, tr("KLog message"), tr("Enter your callsign to connect to the cluster:"), QLineEdit::Normal, "", &ok);
QString passwordText = QInputDialog::getText(this, tr("KLog message"), tr("Enter your password to connect to the cluster:"), QLineEdit::Normal, "", &ok);
QTextStream os(tcpSocket);
if ( callsignText.length() > 2 && ok ) {
os << callsignText << "\n";
//TODO: Check the DXCluster answer and enter the password if needed.
sendButton->setText(tr("Disconnect"));
clearButton->setText(tr("Clear"));
dxClusterAlreadyConnected = true;
} else {
os << tr("Not logged on, you may to enter your callsign again.") << "\n";
dxClusterAlreadyConnected = false;
}
inputCommand->setEnabled(true);
inputCommand->setToolTip(tr("Enter here the commands to be sent to the DX-Cluster server"));
}
}
void DXClusterWidget::slotClusterSocketConnectionClosed()
{
//qDebug() << "DXClusterWidget::slotClusterSocketConnectionClosed" << endl;
QListWidgetItem *item = new QListWidgetItem();
item->setForeground(QBrush(awards->getDefaultColor()));
item->setText(tr("Connection closed by the server"));
dxClusterListWidget->insertItem(0,item);
dxClusterConnected = false;
dxClusterAlreadyConnected = false;
sendButton->setText(tr("Connect"));
inputCommand->setDisabled(true);
inputCommand->setToolTip(tr("Click on Connect to connect to the DX-Cluster server"));
//connect(inputCommand, SIGNAL(returnPressed()), this, SLOT(slotClusterSendToServer()) );
disconnect (inputCommand, SIGNAL(returnPressed()), this, SLOT(slotClusterSendToServer()) );
}
void DXClusterWidget::slotClusterSendToServer()
{
//qDebug() << "DXClusterWidget::slotClusterSendToServer()" << endl;
if (!dxClusterConnected)
{
connectToDXCluster();
return; // If we try to connect...
}
if ( inputCommand ->text().length() < 1 )
{
//qDebug() << "DXClusterWidget::slotClusterSendToServer() - Vacio..." << endl;
QTextStream os(tcpSocket);
os << "bye\n";
return;
}
// write to the server
QTextStream os(tcpSocket);
os << inputCommand ->text() << "\n";
inputCommand ->clear();
}
void DXClusterWidget::slotClusterClearLineInput()
{
//qDebug() << "DXClusterWidget::slotClusterClearLineInput" << endl;
if ( ((inputCommand->text()).length()) <= 0 )
{
if ( dxClusterConnected )
{
QTextStream os(tcpSocket);
os << "bye\n";
}
else
{
}
}
else
{
inputCommand->clear();
}
}
void DXClusterWidget::slotClusterInputTextChanged()
{
//qDebug() << "DXClusterWidget::slotClusterInputTextChanged" << endl;
if ( ((inputCommand->text()).length()) <= 0 )
{
sendButton->setText(tr("Disconnect"));
clearButton->setText(tr("Clear"));
}
else if (dxClusterConnected)
{
sendButton->setText(tr("Send"));
clearButton->setText(tr("Clear"));
}
else
{}
}
void DXClusterWidget::setColors (const QString _newOne, const QString _needed, const QString _worked, const QString _confirmed, const QString _default)
{
//qDebug() << "DXClusterWidget::setColors: " << _newOne << "/" << _needed << "/" << _worked << "/" << _confirmed << "/" << _default << endl;
// Just to pass the colors to the awards class
awards->setColors(_newOne, _needed, _worked, _confirmed, _default);
}
void DXClusterWidget::setDXClusterSpotConfig(bool _showhf, bool _showvhf, bool _showwarc, bool _showworked, bool _showconfirmed, bool _showann, bool _showwwv, bool _showwcy )
{
//qDebug() << "DXClusterWidget::setDXClusterSpotConfig " << endl;
showhf = _showhf;
showvhf = _showvhf;
showwarc = _showwarc;
showworked = _showworked;
showconfirmed = _showconfirmed;
showann = _showann;
showwwv = _showwwv;
showwcy = _showwcy;
}
void DXClusterWidget::slotClusterDXClusterWidgetItemSelected()
{
//qDebug() << "DXClusterWidget::slotClusterDXClusterWidgetItemSelected " << endl;
QListWidgetItem * item = dxClusterListWidget->currentItem();
QStringList ql;
ql.clear();
ql = readItem(item);
if (ql.length()==2)
{
ql << "selected";
emit dxspotclicked(ql);
}
else
{
}
}
void DXClusterWidget::slotClusterDXClusterWidgetItemEntered( QListWidgetItem * item )
{
//qDebug() << "DXClusterWidget::slotClusterDXClusterWidgetItemEntered" << endl;
/*
This code comes from slotClusterDXClusterWidgetItemDoubleClicked
*/
QString tip;
tip.clear();
QStringList ql;
ql.clear();
if (item)
{
ql = readItem(item);
if (ql.length()==2)
{
tip = world->getQRZEntityName(ql.at(0));
item->setToolTip(tip);
}
else
{
}
}
else
{
}
}
QStringList DXClusterWidget::readItem(QListWidgetItem * item)
{
//qDebug() << "DXClusterWidget::readItem" << endl;
QStringList fields;
QString dxClusterString;
//int currentEntity;
QString dxCallsign, dxFreq;
bool FirstFrecOK;
if (item) {
fields.clear();
dxClusterString = ((item->data(0)).toString()).simplified();
fields << dxClusterString.split(" ");
(fields.at(0)).toFloat(&FirstFrecOK); // Just to see if the first string is a frecuency
if ( (fields.at(0) == "DX" ) && (fields.at(1) == "de" ) )
{ // DX de EA4TV: 21200.1 EA0JC The comment 1550
if ( world->getQRZARRLId(fields.at(4))> 0 )
{
//qDebug() << "DXClusterWidget::slotClusterDXClusterWidgetItemDoubleClicked: ARRLid: " << QString::number(world->getQRZARRLId(fields.at(4))) << endl;
dxCallsign = (fields.at(4)).toUpper();
(fields.at(3)).toFloat(&FirstFrecOK);
if (FirstFrecOK)
{ // The frecuency is valid
dxFreq = fields.at(3);
fields.clear();
//TODO: Change FREQ into bandId
fields << dxCallsign << dxFreq;
return fields;
}
else
{ // the frecuency is not a number!
dxCallsign.clear();
dxFreq.clear();
fields.clear();
}
}
else
{ // The call is not from a valid country
// TODO: if it is from a new entity/prefix it would not work.
//qDebug() << "DXClusterWidget::slotClusterDXClusterWidgetItemDoubleClicked: Entity not valid" << endl;
dxCallsign.clear();
dxFreq.clear();
fields.clear();
}
}
//else if (( isAFrecuency(fields.at(0) ) ) && ( isACall(fields.at(1)) ) )
else if ( (((fields.at(0)).toFloat()) > 0.0 )&& ( world->getQRZARRLId(fields.at(1))> 0 ) )
{ // 14205.0 EA0JC 5-Mar-2012 1500Z <EA4TV>
dxCallsign = (fields.at(1)).toUpper();
dxFreq = fields.at(0);
fields.clear();
fields << dxCallsign << dxFreq;
return fields;
}
else
{
dxCallsign.clear();
dxFreq.clear();
fields.clear();
}
}
else
{ // No Item
}
return fields;
}
void DXClusterWidget::setDXClusterServer(const QString &clusterToConnect, const int portToConnect)
{
server = clusterToConnect;
port = portToConnect;
//qDebug() << "DXClusterWidget::setDXClusterServer: " << server << ":"<< QString::number(port) << endl;
}
/***************************************************************************
** This is an auxiliary class intended to provide color to the DX-Cluster **
** spots. **
** It may be moved to a self .h & .cpp archives **
****************************************************************************/
dxClusterSpotItem::dxClusterSpotItem( QListWidget *parent, const QString& spot, const QColor& color ) : QListWidgetItem( parent ){
//qDebug() << "dxClusterSpotItem::dxClusterSpotItem - Constructor" << endl;
spotColor = color;
setText(spot);
// Experimenting with fonts for the cluster
QFont f("Helvetica");
f.setFixedPitch(true);
setFont(f);
}
dxClusterSpotItem::~dxClusterSpotItem()
{
//qDebug() << "dxClusterSpotItem::dxClusterSpotItem - Destructor" << endl;
}

124
dxcluster.h Normal file
View File

@ -0,0 +1,124 @@
#ifndef DXCLUSTER_H
#define DXCLUSTER_H
/***************************************************************************
dxcluster.h - description
-------------------
begin : oct 2011
copyright : (C) 2011 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
#include <QWidget>
//#include <QtWidgets>
#include <QtGui>
#include <QTcpSocket>
#include <QObject>
#include "awards.h"
#include "world.h"
#include "dataproxy.h"
#include "dataproxy_sqlite.h"
class QWidget;
class QTcpSocket;
class DXClusterWidget : public QWidget
{
Q_OBJECT
public:
DXClusterWidget(QWidget *parent );
//DXClusterWidget(QWidget *parent);
DXClusterWidget(const QString &clusterToConnect, const int portToConnect, QWidget *parent );
void setColors (const QString _newOne, const QString _needed, const QString _worked, const QString _confirmed, const QString _default);
void setDXClusterSpotConfig(bool _showhf, bool _showvhf, bool _showwarc, bool _showworked, bool _showconfirmed, bool _showann, bool _showwwv, bool _showwcy );
void setDXClusterServer(const QString &clusterToConnect, const int portToConnect);
void setCurrentLog(const int _log);
~DXClusterWidget();
private slots:
void slotClusterDisplayError(QAbstractSocket::SocketError socketError);
void slotClusterDataArrived();
void slotClusterSocketConnected();
void slotClusterSocketConnectionClosed();
void slotClusterSendToServer();
void slotClusterClearLineInput();
void slotClusterInputTextChanged();
void slotClusterDXClusterWidgetItemDoubleClicked( QListWidgetItem * item );
void slotClusterDXClusterWidgetItemEntered( QListWidgetItem * item);
void slotClusterDXClusterWidgetItemSelected();
signals:
void dxspotclicked(const QStringList _qs); // DXSpotCall, DX-Freq, doubleClicked
private:
void initClass();
void connectToDXCluster();
QStringList readItem(QListWidgetItem * item);
bool checkIfNeedsToBePrinted(const QString _dxCall, const int _band, const int _mode);
void addData(); //TO BE DELETED, JUST FOR TESTING PURPOSES
QTcpSocket *tcpSocket;
QListWidget *dxClusterListWidget;
QLineEdit *inputCommand;
QPushButton *sendButton;
QPushButton *clearButton;
bool dxClusterConnected;
bool dxClusterAlreadyConnected;
QString server;
quint16 port;
quint16 blockSize;
QColor dxSpotColor;
World *world;
Awards *awards;
DataProxy *dataProxy;
bool showhf, showvhf, showwarc, showworked, showconfirmed, showann, showwwv, showwcy;
bool dxClusterShowHF, dxClusterShowVHF, dxClusterShowWARC, dxClusterShowWorked, dxClusterShowConfirmed, dxClusterShowAnn, dxClusterShowWWV, dxClusterShowWCY;
int currentLog;
};
class dxClusterSpotItem : public QListWidgetItem {
public:
dxClusterSpotItem( QListWidget* parent, const QString& spot, const QColor& color );
~dxClusterSpotItem();
protected:
QColor spotColor;
};
#endif // DXCLUSTER_H

3388
filemanager.cpp Normal file

File diff suppressed because it is too large Load Diff

99
filemanager.h Normal file
View File

@ -0,0 +1,99 @@
#ifndef FILEMANAGER_H
#define FILEMANAGER_H
/***************************************************************************
filemanager.h - description
-------------------
begin : sept 2011
copyright : (C) 2011 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
#include <QObject>
//#include <QtWidgets>
#include <QString>
#include <QFileDialog>
#include <QFile>
#include <QSqlQuery>
#include <QStringList>
#include <QSqlRecord>
#include <QProgressDialog>
#include <QMessageBox>
#include <QDateTime>
#include "world.h"
#include "awards.h"
#include "database.h"
enum
{
CQZones = 40,
ITUZones = 90,
DXCCEntities = 521 // http://www.adif.org/adif302.htm#Country%20Codes
};
class FileManager : public QWidget
{
public:
FileManager();
FileManager(const QString _kontestDir);
FileManager(const QString _kontestDir, const QString _softVersion, DataBase _db);
~FileManager();
bool readAdif(const QString& tfileName, const int logN);
bool adifReadLog(const QString& tfileName, const int logN);
bool adifLogExport(const QString& _fileName);
bool adifLogExportMarked(const QString& _fileName);
bool adifReqQSLExport(const QString& _fileName);
bool cabrilloLogExport(const QString& _fileName, const int _contestType, const int logNconst);
private:
bool adifLogExportToFile(const QString& _fileName, bool justMarked = false, bool _qslRequested = false);
bool cabrilloLogExportToFile(const QString& _fileName, const int logNconst);
bool cabrilloLogExportCQWWToFile(const QString& _fileName, const int logNconst);
QString checkAndFixASCIIinADIF(const QString _data);
bool processQsoReadingADIF(const QStringList _line, const int logNumber);
int getProgresStepForDialog(int totalSteps);
void queryPreparation(const int _logN);
bool checkADIFValidFormat(const QStringList _qs);
DataBase *db;
//float softwareVersion;
bool printQs(const QString _q, const QStringList _line);
//int confirmed;
QString kontestDir;
QString kontestVersion;
//QProgressBar *progressBar;
bool ignoreUnknownAlways; // When importing ADIF, ignore all unknown fields.
World *world;
Awards *awards;
QSqlQuery preparedQuery;
};
#endif // FILEMANAGER_H

693
gpl-3.0-standalone.html Normal file
View File

@ -0,0 +1,693 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GNU General Public License v3.0 - GNU Project - Free Software Foundation (FSF)</title>
<link rel="alternate" type="application/rdf+xml" href="http://www.gnu.org/licenses/gpl-3.0.rdf">
</head>
<body>
<h3 style="text-align: center;">GNU GENERAL PUBLIC LICENSE</h3>
<p style="text-align: center;">Version 3, 29 June 2007</p>
<p>Copyright © 2007 Free Software Foundation, Inc.
&lt;<a href="http://fsf.org/">http://fsf.org/</a>&gt;</p><p>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.</p>
<h3><a name="preamble"></a>Preamble</h3>
<p>The GNU General Public License is a free, copyleft license for
software and other kinds of works.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>The precise terms and conditions for copying, distribution and
modification follow.</p>
<h3><a name="terms"></a>TERMS AND CONDITIONS</h3>
<h4><a name="section0"></a>0. Definitions.</h4>
<p>“This License” refers to version 3 of the GNU General Public License.</p>
<p>“Copyright” also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.</p>
<p>“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.</p>
<p>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.</p>
<p>A “covered work” means either the unmodified Program or a work based
on the Program.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<h4><a name="section1"></a>1. Source Code.</h4>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.</p>
<p>The Corresponding Source for a work in source code form is that
same work.</p>
<h4><a name="section2"></a>2. Basic Permissions.</h4>
<p>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.</p>
<p>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.</p>
<p>Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.</p>
<h4><a name="section3"></a>3. Protecting Users' Legal Rights From Anti-Circumvention Law.</h4>
<p>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.</p>
<p>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.</p>
<h4><a name="section4"></a>4. Conveying Verbatim Copies.</h4>
<p>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.</p>
<p>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.</p>
<h4><a name="section5"></a>5. Conveying Modified Source Versions.</h4>
<p>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:</p>
<ul>
<li>a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.</li>
<li>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”.</li>
<li>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.</li>
<li>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.</li>
</ul>
<p>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.</p>
<h4><a name="section6"></a>6. Conveying Non-Source Forms.</h4>
<p>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:</p>
<ul>
<li>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.</li>
<li>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.</li>
<li>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.</li>
<li>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.</li>
<li>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.</li>
</ul>
<p>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.</p>
<p>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.</p>
<p>“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.</p>
<p>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).</p>
<p>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.</p>
<p>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.</p>
<h4><a name="section7"></a>7. Additional Terms.</h4>
<p>“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.</p>
<p>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.</p>
<p>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:</p>
<ul>
<li>a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or</li>
<li>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</li>
<li>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</li>
<li>d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or</li>
<li>e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or</li>
<li>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.</li>
</ul>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<h4><a name="section8"></a>8. Termination.</h4>
<p>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).</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<h4><a name="section9"></a>9. Acceptance Not Required for Having Copies.</h4>
<p>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.</p>
<h4><a name="section10"></a>10. Automatic Licensing of Downstream Recipients.</h4>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<h4><a name="section11"></a>11. Patents.</h4>
<p>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”.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<h4><a name="section12"></a>12. No Surrender of Others' Freedom.</h4>
<p>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.</p>
<h4><a name="section13"></a>13. Use with the GNU Affero General Public License.</h4>
<p>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.</p>
<h4><a name="section14"></a>14. Revised Versions of this License.</h4>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<h4><a name="section15"></a>15. Disclaimer of Warranty.</h4>
<p>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.</p>
<h4><a name="section16"></a>16. Limitation of Liability.</h4>
<p>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.</p>
<h4><a name="section17"></a>17. Interpretation of Sections 15 and 16.</h4>
<p>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.</p>
<p>END OF TERMS AND CONDITIONS</p>
<h3><a name="howto"></a>How to Apply These Terms to Your New Programs</h3>
<p>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.</p>
<p>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.</p>
<pre> &lt;one line to give the program's name and a brief idea of what it does.&gt;
Copyright (C) &lt;year&gt; &lt;name of author&gt;
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 &lt;http://www.gnu.org/licenses/&gt;.
</pre>
<p>Also add information on how to contact you by electronic and paper mail.</p>
<p>If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:</p>
<pre> &lt;program&gt; Copyright (C) &lt;year&gt; &lt;name of author&gt;
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.
</pre>
<p>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”.</p>
<p>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
&lt;<a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>&gt;.</p>
<p>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
&lt;<a href="http://www.gnu.org/philosophy/why-not-lgpl.html">http://www.gnu.org/philosophy/why-not-lgpl.html</a>&gt;.</p>
</body></html>

74
helpaboutdialog.cpp Normal file
View File

@ -0,0 +1,74 @@
#include "helpaboutdialog.h"
//#include <QDebug>
HelpAboutDialog::HelpAboutDialog(const QString tversion)
{
//qDebug() << "HelpAboutDialog::HelpAboutDialog" << endl;
QString text;
QString _version = tversion;
text = "<center><h2>KLog " + _version + "</h2><h4>By EA4TV - 2002-2015</h4></center><br>KLog is a free logging software for hamradio operators.<br><br><b>Please know that this is an BETA release and it may contain many bugs.<br>Backup your data before using this software!</b><br><br>KLog has been fully rewritten from the 0.6.2 to be able to provide a cross-platform application that runs in the main operating systems (Linux, OSX & Windows) and provide new functionalities that KLog was not providing. <br><br>Find more information and latest release at<br><a href=http://jaime.robles.es/klog>http://jaime.robles.es/klog</a><br><br>Author: Jaime Robles, EA4TV<br><a href=mailto:jaime@robles.es>jaime@robles.es</a>";
textBrowser = new QTextBrowser;
textBrowser->setOpenLinks(true);
textBrowser->setOpenExternalLinks(true);
textBrowser->setHtml(text);
QPushButton *acceptButton = new QPushButton(tr("Ok"));
textBrowser->setOpenExternalLinks(true);
//textBrowser->setHTML(url);
QHBoxLayout *buttonsLayout = new QHBoxLayout;
buttonsLayout->addWidget(acceptButton);
///
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(textBrowser);
mainLayout->addLayout(buttonsLayout);
setLayout(mainLayout);
setWindowTitle(tr("About KLog"));
///
connect(acceptButton, SIGNAL(clicked()), this, SLOT(slotAcceptButtonClicked()));
}
HelpAboutDialog::~HelpAboutDialog()
{
//qDebug() << "HelpAboutDialog::~HelpAboutDialog" << endl;
}
void HelpAboutDialog::slotAcceptButtonClicked()
{
//qDebug() << "HelpAboutDialog::slotAcceptButtonClicked" << endl;
accept();
}
void HelpAboutDialog::keyPressEvent(QKeyEvent *event){
switch (event->key()) {
//case Qt::Key_Return:
// ENTER PRESSED
//slotQRZReturnPressed();
// break;
//case Qt::Key_Enter:
// ENTER PRESSED
// slotQRZReturnPressed();
break;
default:
//QFrame::keyPressEvent(event)
slotAcceptButtonClicked();
}
}

29
helpaboutdialog.h Normal file
View File

@ -0,0 +1,29 @@
#ifndef HELPABOUTDIALOG_H
#define HELPABOUTDIALOG_H
//#include <QtWidgets>
#include <QtGui>
#include <QDialog>
#include <QTextBrowser>
class HelpAboutDialog : public QDialog
{
Q_OBJECT
public:
HelpAboutDialog(const QString tversion);
~HelpAboutDialog();
private slots:
void slotAcceptButtonClicked();
//void slotCancelButtonClicked();
private:
void keyPressEvent(QKeyEvent *event);
QTextBrowser *textBrowser;
};
#endif // HELPABOUTDIALOG_H

54
helphelpdialog.cpp Normal file
View File

@ -0,0 +1,54 @@
#include "helphelpdialog.h"
HelpHelpDialog::HelpHelpDialog(const QString tversion)
{
//http://www.gnu.org/licenses/gpl.txt
QString text;
QString _version = tversion;
text = "<center><h2>KLog " + _version + tr("</h2><h4>By EA4TV - 2002-2015</h4></center><br>KLog is a free logging software for hamradio operators.<br><br><b>Please know that this is an BETA release and it may contain many bugs.<br>Backup your data before using this software!</b><br><br>KLog has been fully rewritten from the 0.6.2 to be able to provide a cross-platform application that runs in the main operating systems (Linux, OSX & Windows) and provide new functionalities that KLog was not providing. <br><br>Find more information and latest release at<br><a href=http://jaime.robles.es/klog>http://jaime.robles.es/klog</a><br><br>Author: Jaime Robles, EA4TV<br><a href=mailto:jaime@robles.es>jaime@robles.es</a>");
textBrowser = new QTextBrowser;
textBrowser->setOpenLinks(true);
textBrowser->setOpenExternalLinks(true);
textBrowser->setHtml(text);
QPushButton *acceptButton = new QPushButton(tr("Ok"));
textBrowser->setOpenExternalLinks(true);
//textBrowser->setHTML(url);
QHBoxLayout *buttonsLayout = new QHBoxLayout;
buttonsLayout->addWidget(acceptButton);
///
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(textBrowser);
mainLayout->addLayout(buttonsLayout);
setLayout(mainLayout);
setWindowTitle(tr("Help"));
///
connect(acceptButton, SIGNAL(clicked()), this, SLOT(slotAcceptButtonClicked()));
}
HelpHelpDialog::~HelpHelpDialog()
{
}
void HelpHelpDialog::slotAcceptButtonClicked()
{
accept();
}

28
helphelpdialog.h Normal file
View File

@ -0,0 +1,28 @@
#ifndef HELPHELPDIALOG_H
#define HELPHELPDIALOG_H
//#include <QtWidgets>
#include <QtGui>
#include <QDialog>
#include <QTextBrowser>
class HelpHelpDialog : public QDialog
{
Q_OBJECT
public:
HelpHelpDialog(const QString tversion);
~HelpHelpDialog();
private slots:
void slotAcceptButtonClicked();
//void slotCancelButtonClicked();
private:
//void keyPressEvent(QKeyEvent *event);
QTextBrowser *textBrowser;
};
#endif // HELPHELPDIALOG_H

56
klog.1 Normal file
View File

@ -0,0 +1,56 @@
.TH KLog 1 "version 0.9.0.3" "Jaime Robles, EA4TV" "Hamradio"
.SH "NAME"
klog \- The Ham Radio Logging program
.SH SYNOPSIS
\fBklog\fR \fI[option]\fR
.SH OPTIONS
A summary of options is included below.
.TP
\fB\-\-help\fR Show summary of options.
.TP
\fB\-\-version\fR Output version information and exit.
.SH DESCRIPTION
\fBklog\fR
is a ham radio logging program for Linux, OSX and Windows.
With KLog you can log your QSOs and save it in ADIF format. KLog
helps you to manage DXCC, WAZ and IOTA award.
.SH USAGE
Enter you QSO data in the top left box while entity data, direction and
other usefull information will be shown in the top right box.
.P
Previous QSOs are shown in the botton box where you can click to edit them.
.P
Here is a list of keys that can be used to navigate
through klog:
.TP
\fIControl a\fR: Add a QSO.
.TP
\fIControl d\fR: Delete a selected QSO.
.SH PRINTING
KLog has a very basic printing feature implemented.
.SH PREFERENCES
You can edit the ~/.klog/klogrc file to setup you call and locator.
.P
All the data files are saved in the KLog home directory (~/.klog) by
default.
.SH FILES
\fI/usr/share/klog/cty.csv\fR
contains the DXCC entries read by KLog.
\fI~/.klog/logbook.dat.\fR
contains all the logbook and information of KLog.
.SH AUTHORS
KLog was written by Jaime Robles, EA4TV
<jaime at robles.es> aka <jaime at kde.org>
Download the last version from: http://jaime.robles.es
Calculation of heading and distance was taken from Loccalc code
by Marco Bersani, IK2PIH.

97
klog.pro Normal file
View File

@ -0,0 +1,97 @@
# -------------------------------------------------
# Project created by QtCreator 2011-04-23T14:06:58
# -------------------------------------------------
QT += core \
gui \
sql \
network
greaterThan(QT_MAJOR_VERSION, 4) {
QT *= printsupport
QT += widgets
}
unix {
macx {
TARGET = KLog
#QMAKE_LFLAGS += -F/Library/Frameworks
#LIBS += -framework TheFramework
#SOURCES += windowinfo_mac.cpp
} else {
#SOURCES += windowinfo_x11.cpp
TARGET = klog
}
} else {
TARGET = klog
}
# greaterThan(QT_MAJOR_VERSION, 4): QT += widgets core gui sql network
#TARGET = klog
CONFIG += app_bundle
CONFIG += static
TEMPLATE = app
SOURCES += main.cpp \
setupdialog.cpp \
mainwindow.cpp \
world.cpp \
logwindow.cpp \
filemanager.cpp \
contest.cpp \
contest_cqwwdxssb.cpp \
database.cpp \
dataproxy.cpp \
dataproxy_sqlite.cpp \
downloadcty.cpp \
dxcluster.cpp \
setuppagebandsmodes.cpp \
setuppagemisc.cpp \
locator.cpp \
awards.cpp \
setuppageuserdata.cpp \
setuppagedxcluster.cpp \
setuppagecolors.cpp \
setuppagelogs.cpp \
helphelpdialog.cpp \
helpaboutdialog.cpp \
setuppageworldeditor.cpp \
setupentitydialog.cpp \
startwizard.cpp
HEADERS += setupdialog.h \
mainwindow.h \
world.h \
logwindow.h \
filemanager.h \
contest.h \
database.h \
setuppagebandsmodes.h \
setuppagemisc.h \
locator.h \
dxcluster.h \
awards.h \
setuppageuserdata.h \
setuppagedxcluster.h \
setuppagecolors.h \
contest_cqwwdxssb.h \
setuppagelogs.h \
helphelpdialog.h \
helpaboutdialog.h \
setuppageworldeditor.h \
setupentitydialog.h \
startwizard.h \
downloadcty.h \
dataproxy.h \
dataproxy_sqlite.h
OTHER_FILES += TODO\
README-DEVEL\
tips-for-devel.txt \
INSTALL.txt \
INSTALL-linux\
INSTALL-win.txt \
Changelog \
INSTALL-osx.txt \
NEWS \
klog.1 \
COPYING \
AUTHORS \
README
TRANSLATIONS = klog_es.ts \
klog_fr.ts
CODECFORTR = UTF-8
FORMS +=

2843
klog_es.ts Normal file

File diff suppressed because it is too large Load Diff

2634
klog_fr.ts Normal file

File diff suppressed because it is too large Load Diff

359
locator.cpp Normal file
View File

@ -0,0 +1,359 @@
/***************************************************************************
locator.cpp - description
-------------------
begin : vie feb 7 2003
copyright : (C) 2003 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
#include "locator.h"
#include <QtDebug>
Locator::Locator(){
ideg = 0;
imin = 0;
isec = 0;
}
Locator::~Locator(){
}
bool Locator::isValidLocator(const QString& tlocator){
/* -------------- Subroutine -----------------------
Check valid locator (VALID: AA00AA -> RR99XX
Input : char *locator = 4 or 6 characters word wide locator.
returned value == -1 No error. (Valid locator).
returned value == 0 Error. (Invalid locator).
Note: also string "END" is considered a valid locator, but returned value is -2.
------------------------------------------------- */
//qDebug() << "Locator::isValidLocator: " << tlocator << endl;
int lenght_of_locator;
testLocator ="A";
testLocator = tlocator.toUpper();
lenght_of_locator = testLocator.length();
if (lenght_of_locator == 4){
testLocator = testLocator +"LM";
lenght_of_locator = 6;
}
if (lenght_of_locator != 6) {
return false;
}else{
theChar = testLocator.at(0);
if (!theChar.isLetter()){ //First letter is not a valid letter
return false;
}
if ((theChar<'A') && (theChar>'R') ){ //First letter is not a valid letter
return false;
}
theChar = testLocator.at(1);
if (!theChar.isLetter()){ //Second letter is not a valid letter
return false;
}
if ((theChar<'A') && (theChar>'R') ){ //Second letter is not a valid letter
return false;
}
theChar = testLocator.at(2);
if (!theChar.isDigit()){ //Second letter is not a number
return false;
}
theChar = testLocator.at(3);
if (!theChar.isDigit()){ //Second letter is not a number
return false;
}
theChar = testLocator.at(4);
if (!theChar.isLetter()){ //First letter is not a valid letter
return false;
}
if ((theChar<'A') && (theChar>'X') ){ //First letter is not a valid letter
return false;
}
theChar = testLocator.at(5);
if (!theChar.isLetter()){ //Second letter is not a valid letter
return false;
}
if ((theChar<'A') && (theChar>'X') ){ //Second letter is not a valid letter
return false;
}
}
return true;
}
double Locator::getLat(const QString& tlocator){
//qDebug() << "Locator::getLat: " << tlocator;
if (!isValidLocator(tlocator))
{
return 0.0;
}
if (tlocator.length() == 2)
{
return (((tlocator.at(1)).toLatin1() - 65) * 10) - 90;
}
if (tlocator.length() == 4)
{
return (((tlocator.at(1)).toLatin1() - 65) * 10) + ((tlocator.at(3)).toLatin1() - 48) - 90;
}
else if (tlocator.length()== 6)
{
return (((tlocator.at(1)).toLatin1() - 65) * 10) + ((tlocator.at(3)).toLatin1() - 48) + (((tlocator.at(5)).toLatin1() - 65 + 0.5) / 24) - 90;
}
else
{
return 0.0;
}
}
double Locator::getLon(const QString& tlocator)
{
//qDebug() << "Locator::getLon: " << tlocator;
if (!isValidLocator(tlocator))
{
return 0.0;
}
if (tlocator.length() == 2)
{
return (((tlocator.at(0)).toLatin1() - 65) * 20) - 180;
}
if (tlocator.length() == 4)
{
return (((tlocator.at(0)).toLatin1() - 65) * 20) + (((tlocator.at(2)).toLatin1() - 48) * 2) - 180;
}
else if (tlocator.length()== 6)
{
return (((tlocator.at(0)).toLatin1() - 65) * 20) + (((tlocator.at(2)).toLatin1() - 48) * 2) + (((tlocator.at(4)).toLatin1() - 65 + 0.5) / 12) - 180;
}
else
{
return 0.0;
}
}
int Locator::getBeam(const double lon1, const double lat1, const double lon2, const double lat2){
double lon_a,lat_a,lon_b,lat_b, bearing;
//qDebug() << "Locator::getBeam1: " << QString::number(lon1) << "/" << QString::number(lat1) << endl;
//qDebug() << "Locator::getBeam2: " << QString::number(lon2) << "/" << QString::number(lat2) << endl;
lon_a=lon1*PI/180; // Convert degrees to radians
lat_a=lat1*PI/180;
lon_b=lon2*PI/180;
lat_b=lat2*PI/180;
//earing_Distance( double lon_a, double lat_a, /* Lon/Lat of point A */
// double lon_b, double lat_b, /* Lon/Lat of point B */
// double *bearing, double *distance )/* From A to B */
//{
double
gc_arc, cos_gc_arc, /* Great circle arc A to B */
cos_bearing, sin_bearing, /* cos/sin of bearing A to B */
lon_diff; /* Difference in longitude of B from A */
/* Longitude differnce of B from A */
lon_diff = lon_b - lon_a;
/* Calculate great circle distance A to B */
cos_gc_arc = cos(lon_diff)*cos(lat_a)*cos(lat_b) + sin(lat_a)*sin(lat_b);
gc_arc = acos( cos_gc_arc );
/* Distance in km */
// *distance = eradius * gc_arc;
/* Calculate bearing A to B */
cos_bearing = sin(lat_b) - sin(lat_a) * cos_gc_arc;
sin_bearing = sin(lon_diff) * cos(lat_a) * cos(lat_b);
bearing = atan2(sin_bearing, cos_bearing);
/* Correct negative (anticlockwise) bearings */
if( bearing < 0.0 )
{
bearing = (2*PI) + bearing;
}
bearing = 360 - (180/PI*bearing);
bearing = 360 - bearing;
//qDebug() << "Locator::getBeam: " << QString::number(bearing) << endl;
/* Convert to degrees */
return (int)bearing;
}
int Locator::getDistance(const double lon1, const double lat1, const double lon2, const double lat2, const bool _imperialSystem){
//http://en.wikipedia.org/wiki/Haversine_formula
//qDebug() << "Locator::getDistanceKilometres: MyPos("<< QString::number(lon1) << "/"
// << QString::number(lat1) << ") - DxPos(" << QString::number(lon2) << "/" << QString::number(lat2) << ")" << endl;
double lo1,la1,lo2,la2;
// TODO: Is it needed to check if the longitude and latitude are correct and/or between the magins?
// if (!( (checkCoords(lon1, lat1) ) && (checkCoords(lon2, lat2)) ))
// return 0;
lo1=lon1* DEG_TO_RAD; // Convert degrees to radians
la1=lat1* DEG_TO_RAD;
lo2=lon2* DEG_TO_RAD;
la2=lat2* DEG_TO_RAD;
if (!_imperialSystem){
//qDebug() << "Locator::getDistance (Km): " << QString::number((int)(acos(cos(la1)*cos(lo1)*cos(la2)*cos(lo2)+cos(la1)*sin(lo1)*cos(la2)*sin(lo2)+sin(la1)*sin(la2)) * EARTH_RADIUS)) << endl;
return (int)(acos(cos(la1)*cos(lo1)*cos(la2)*cos(lo2)+cos(la1)*sin(lo1)*cos(la2)*sin(lo2)+sin(la1)*sin(la2)) * EARTH_RADIUS);
}else{ // In milles
//qDebug() << "Locator::getDistance (Milles): " << QString::number(((int)(acos(cos(la1)*cos(lo1)*cos(la2)*cos(lo2)+cos(la1)*sin(lo1)*cos(la2)*sin(lo2)+sin(la1)*sin(la2)) * EARTH_RADIUS))* 0.62137) << endl;
return ((int)(acos(cos(la1)*cos(lo1)*cos(la2)*cos(lo2)+cos(la1)*sin(lo1)*cos(la2)*sin(lo2)+sin(la1)*sin(la2)) * EARTH_RADIUS)) * 0.62137;
}
}
bool Locator::checkCoords(const double lon1, const double lat1){
//qDebug() << "Locator::checkCoords" ;
// Checks if a coordinates is correct.
if ((lat1 > 90.0 || lat1 < -90.0) && (lon1 > 180.0 || lon1 < -180.0)){
return true;
}else{
return false;
}
}
QString Locator::getLocator(const double lon1, const double lat1) const{
/* -------------- Subroutine -----------------------
Calculate locator from longitude and latitude
Input : lon = Longitude in decimal degrees (+ = West; - = East).
lat = Latitude in decimal degrees (+ = North; - = South).
Output: locator = 6 characters world wide locator.
------------------------------------------------- */
//qDebug() << "Locator::getLocator: (" << QString::number(lon1) << "/" << QString::number(lat1) << ")" << endl;
QString locat = ""; //NO locator
double lo, la;
int alo,bla,clo,dla,elo,fla;
lo=(-lon1+180)/20;
la = (lat1+90)/10;
alo=(int)floor(lo);
bla=(int)floor(la);
lo=(lo-(double)alo)*10;
la=(la-(double)bla)*10;
clo = (int)floor(lo);
dla = (int)floor(la);
elo = (int)floor((lo-(double)clo)*24);
fla = (int)floor((la-(double)dla)*24);
//TODO: Test if locators are calculated correctly.
// generation function has been changed because of the QT4 migration
locat = locat + QChar(alo+'A');
locat = locat + QChar(bla+'A');
locat = locat + QChar(clo+'0');
locat = locat + QChar(dla+'0');
locat = locat + QChar(elo+'A');
locat = locat + QChar(fla+'A');
// locat.at(0)=QChar(alo+'A');
// locat.at(1)=QChar(bla+'A');
// locat.at(2)=QChar(clo+'0');
// locat.at(3)=QChar(dla+'0');
// locat.at(4)=QChar(elo+'A');
// locat.at(5)=QChar(fla+'A');
return locat;
}
void Locator::degTodms(const double deg){
double temp;
double ddeg;
ddeg = 0;
ddeg += 1.0/7200.0; /* Round-up to 0.5 sec */
ideg = (int)ddeg;
temp = ( deg - (double)ideg ) * 60.0;
imin = (int)temp;
temp = ( temp - (double)imin ) * 60.0;
isec = (int)(temp);
}
double Locator::dmsTodeg (int deg, int min, int sec){
return (double)deg + (double)min/60.0 + (double)sec/3600.0;
}
int Locator::getBeamBetweenLocators (const QString& tlocator1, const QString& tlocator2)
{
//qDebug() << "Locator::getBeamBetweenLocators: " << tlocator1 << "/" << tlocator2 << endl;
if ( !(isValidLocator(tlocator1) && isValidLocator(tlocator2) ) )
{
return -1;
}
else
{
double lon1 = getLon(tlocator1);
double lon2 = getLon(tlocator2);
double lat1 = getLat(tlocator1);
double lat2 = getLat(tlocator2);
return getBeam(lon1, lat1, lon2, lat2);
}
}
int Locator::getDistanceBetweenLocators (const QString& tlocator1, const QString& tlocator2, const bool _imperialSystem)
{
if ( !(isValidLocator(tlocator1) && isValidLocator(tlocator2) ) )
{
return -1;
}
else
{
double lon1 = getLon(tlocator1);
double lon2 = getLon(tlocator2);
double lat1 = getLat(tlocator1);
double lat2 = getLat(tlocator2);
return getDistance(lon1, lat1, lon2, lat2, _imperialSystem);
//return getBeam(lon1, lat1, lon2, lat2);
}
}

78
locator.h Normal file
View File

@ -0,0 +1,78 @@
/***************************************************************************
locator.h - description
-------------------
begin : vie feb 7 2003
copyright : (C) 2003 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
#ifndef LOCATOR_H
#define LOCATOR_H
#include <math.h>
#include <QString>
const double PI = 3.141592654; //http://en.wikipedia.org/wiki/Pi
const bool LATITUDE = false;
const bool LONGITUDE = true;
const double EARTH_RADIUS = 6371; //http://en.wikipedia.org/wiki/Earth_radius
const bool RADIAN = 180.0/PI;
const double DEG_TO_RAD = PI/180.0;
const double KM_IN_A_MILE = 1.609344;
class Locator{
public:
Locator();
~Locator();
bool isValidLocator(const QString& tlocator);
double getLat(const QString& tlocator);
double getLon(const QString& tlocator);
QString getLocator(const double lon1, const double lat1) const;
int getBeam(const double lon1, const double lat1, const double lon2, const double lat2);
int getBeamBetweenLocators (const QString& tlocator1, const QString& tlocator2);
int getDistance(const double lon1, const double lat1, const double lon2, const double lat2, const bool _imperialSystem);
int getDistanceBetweenLocators (const QString& tlocator1, const QString& tlocator2, const bool _imperialSystem);
//int getDistanceMilles(const double lon1, const double lat1, const double lon2, const double lat2);
void degTodms(const double deg);
double dmsTodeg (int deg, int min, int sec);
bool checkCoords(const double lon1, const double lat1);
private:
bool valid;
QString myLocator;
QString testLocator;
QString otherLocator;
QChar theChar;
double my_lon, my_lat, other_lon, other_lat, beam, testNumb;
int ideg, imin, isec;
};
#endif

43
logwindow.cpp Normal file
View File

@ -0,0 +1,43 @@
/***************************************************************************
logwindow.cpp - description
-------------------
begin : sept 2011
copyright : (C) 2011 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
#include "logwindow.h"
LogWindow::LogWindow()
{
}
LogWindow::~LogWindow()
{
}
void LogWindow::createlogPanel()
{
}

74
logwindow.h Normal file
View File

@ -0,0 +1,74 @@
#ifndef LOGWINDOW_H
#define LOGWINDOW_H
/***************************************************************************
logwindow.h - description
-------------------
begin : sept 2011
copyright : (C) 2011 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
//#include <QtWidgets>
#include <QWidget>
#include <QSqlRelationalTableModel>
#include <QTableView>
#include <QAction>
class QStringList;
class QLabel;
class QVBoxLayout;
enum {
Log_Id = 0,
Log_Name = 1,
Log_BandId = 2,
Log_ModeId = 3,
Log_DateId = 4,
Log_TimeId = 5
};
class LogWindow : public QWidget
{
Q_OBJECT
public:
LogWindow();
~LogWindow();
private:
QSqlRelationalTableModel *logModel;
QWidget *logPanel;
QTableView *logView;
QLabel *logLabel;
QAction *logWinAct;
QAction *loggWinAct;
void createlogPanel();
};
#endif // LOGWINDOW_H

165
main.cpp Normal file
View File

@ -0,0 +1,165 @@
/* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
#include <QtGui>
#include <QtSql>
#include <QTranslator>
#include <cstdlib>
//#include <QDebug>
#include "startwizard.h"
#include "mainwindow.h"
int main(int argc, char *argv[])
{
QString version = "0.9.0.3";
QDir d1 = QDir();
QApplication app(argc, argv);
// Translations begin
QTranslator qtTranslator;
qtTranslator.load("qt_" + QLocale::system().name(),
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
app.installTranslator(&qtTranslator);
QTranslator myappTranslator;
myappTranslator.load("klog_" + QLocale::system().name());
app.installTranslator(&myappTranslator);
// Translations end
QString configFileName, kontestDir;
int inMemory;
//bool dbInMemory = true;
#ifdef Q_OS_WIN
//qDebug() << "WINDOWS DETECTED!" << endl;
kontestDir = QDir::homePath()+"/klog"; // We create the \klog for the logs and data
configFileName = kontestDir+"/klogrc.cfg";
#else
//qDebug() << "NO WINDOWS DETECTED!" << endl;
kontestDir = QDir::homePath()+"/.klog"; // We create the ~/.kontest for the logs and data
configFileName = kontestDir+"/klogrc";
#endif
//if (!QDir::setCurrent (kontestDir) )
if (!QDir::setCurrent (kontestDir) )
{
//qDebug() << "MAIN: KLogDir does not exist.... creating " << endl;
//QDir d1(kontestDir);
//d1.setCurrent()
if (d1.mkdir(kontestDir))
{
if (QDir::setCurrent (kontestDir) )
{
//qDebug() << "MAIN: KLogDir has just been created and pointed " << endl;
}
else
{
//qDebug() << "MAIN: KLogDir has just been created and pointed FAILED! " << endl;
}
}
else
{
//qDebug() << "MAIN: KLogDir can not be created?? " << endl;
}
}
else
{
//qDebug() << "MAIN: KLogDir already existed!! " << endl;
}
if(!QFile::exists(configFileName))
{
//qDebug() << "MAIN: Starting wizard... " << endl;
StartWizard *wizard = new StartWizard(kontestDir, version);
wizard->setModal(true);
inMemory = wizard->exec();
if (inMemory == 1)
{
//qDebug() << "MAIN: Wizard accepted " << QString::number(inMemory) << " ... Will run in Memory " << endl;
MainWindow mw(kontestDir, version);
mw.show();
return app.exec();
}
else if (inMemory == 2)
{
//qDebug() << "MAIN: Wizard accepted " << QString::number(inMemory) << " ... Will run in file " << endl;
MainWindow mw(kontestDir, version);
mw.show();
return app.exec();
}
else
{
//qDebug() << "MAIN: Wizard cancelled " << QString::number(inMemory) << " ... should close " << endl;
QMessageBox msgBox;
msgBox.setText("Install wizard was cancelled before completing...");
msgBox.setInformativeText("Do you want to remove the KLog dir from your disk?");
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No );
msgBox.setDefaultButton(QMessageBox::Yes);
int ret = msgBox.exec();
switch (ret)
{
case QMessageBox::Yes:
if (QDir::setCurrent (QDir::homePath()) )
{
if (d1.remove(kontestDir))
{
QMessageBox msgBox;
msgBox.setText("Your KLog dir has been removed\n\nThank you for running KLog!.");
msgBox.exec();
}
else
{
QMessageBox msgBox;
msgBox.setText("I could not remove your KLog dir. You should do it manually if you want it removed from your hard disk.\n\nThank you for running KLog!.");
msgBox.exec();
}
}
else
{
QMessageBox msgBox;
msgBox.setText("Your KLog dir could not be removed. You should do it manually if you want it removed from your hard disk.\n\nThank you for running KLog!.");
msgBox.exec();
}
break;
case QMessageBox::No:
QMessageBox msgBox;
msgBox.setText("Remember that your KLog dir is in your system...\n\nThank you for running KLog!.");
msgBox.exec();
break;
}
return 0;
}
}
else
{
MainWindow mw(kontestDir, version);
mw.show();
return app.exec();
}
//return app.exec();
}

8381
mainwindow.cpp Normal file

File diff suppressed because it is too large Load Diff

531
mainwindow.h Normal file
View File

@ -0,0 +1,531 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
/***************************************************************************
mainwindow.h - description
-------------------
begin : sept 2011
copyright : (C) 2011 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
#include <QtGui>
//#include <QtWidgets>
#include <QPrinter>
#include <QPrintDialog>
#include <QNetworkRequest>
#include <QNetworkReply>
#include "database.h"
#include "setupdialog.h"
#include "helpaboutdialog.h"
#include "helphelpdialog.h"
#include "world.h"
#include "filemanager.h"
#include "contest.h"
#include "contest_cqwwdxssb.h"
#include "dataproxy.h"
#include "dataproxy_sqlite.h"
#include "locator.h"
#include "dxcluster.h"
#include "awards.h"
class QTimer;
class QDateTime;
class QPushButton;
class QLineEdit;
class QComboBox;
class QTimeEdit;
class QDateEdit;
//class QStatusBar;
class QMenuBar;
class QMenu;
class QMessageBox;
class QTextEdit;
class QProgressDialog;
class QPoint;
class QGroupBox;
class QTabWidget;
class QFrame;
class QTableView;
class QLabel;
enum
{
Log_Id = 0,
Log_Name = 1,
Log_BandId = 2,
Log_ModeId = 3,
Log_DateId = 4,
Log_TimeId = 5
};
enum
{
NoContest = 0,
CQ_WW_SSB = 1,
CQ_WW_CW = 2,
CQ_WPX_SSB = 3,
CQ_WPX_CW = 4,
CQ_WPX_RTTY = 5
};
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(const QString _kontestDir, const QString tversion);
private slots:
void slotQRZReturnPressed();
void slotQRZSpacePressed();
void slotQRZTextChanged();
void slotSRXTextChanged();
void slotSTXTextChanged();
void slotLocatorTextChanged();
void slotMyLocatorTextChanged();
void slotSearchBoxTextChanged();
void slotSearchExportButtonClicked();
void slotSearchBoxSelectAllButtonClicked();
void slotSearchClearButtonClicked();
void slotSearchBoxSelectionChanged();
void slotSearchBoxReSearchButtonClicked();
//void slotSearchBoxOnItemChanged( QTreeWidgetItem * item, int column);
void slotModeComboBoxChanged();
void slotBandComboBoxChanged();
void slotIOTAComboBoxChanged();
void slotOperatingYearComboBoxChanged();
void slotOKButtonClicked();
void slotSpotItButtonClicked();
void slotClearButtonClicked();
void slotUpdateTime();
void slotLogWinShow();
void slotScoreWinShow();
void slotSetup(const int _page=0);
void slotQsoDeleteFromLog();
void slotQSLSentViaBureauFromLog();
void slotQSLSentViaDirectFromLog();
void slotQSLRecViaDirectFromLog();
void slotQSLRecViaBureauFromLog();
void slotQSOToEditFromLog();
void slotQsoDeleteFromSearch();
void slotQSLSentViaBureauFromSearch();
void slotQSLSentViaDirectFromSearch();
void slotQSLRecViaDirectFromSearch();
void slotQSLRecViaBureauFromSearch();
void slotQSLRecViaDirectMarkReqFromSearch();
void slotQSLRecViaBureauMarkReqFromSearch();
void slotQSLSentMarkAsRequested();
void slotQSLRecMarkAsRequested();
void slotQSOToEditFromSearch();
void slotrstTXTextChanged();
void slotrstRXTextChanged();
void slotADIFExport();
void slotADIFImport();
void slotRQSLExport();
void slotCabrilloExport();
void slotQSLRecvComboBoxChanged();
void slotQSLSentComboBoxChanged();
void sloteQSLRecvComboBoxChanged();
void sloteQSLSentComboBoxChanged();
void slotQSLViaTextChanged();
void slotUpdateCTYDAT();
void slotToolSearchNeededQSLToSend();
void slotToolSearchRequestedQSLToSend();
void slotToolSearchNeededQSLPendingToReceive();
void slotToolSearchQSL(const int actionQSL);
void slotExitFromSlotDialog(const int exitID);
void slotDownloadFinished(QNetworkReply *reply);
void fillQSOData();
void newFile();
void openFile();
bool saveFile(const QString _fileName);
bool saveFileAs();
void slotFilePrint();
//void slotFileClose();
void slotHelpHelpAction();
void slotHelpAboutAction();
void slotAboutQt();
// logpanel
void slotRighButtonFromLog( const QPoint& pos);
void slotDoubleClickLog( const QModelIndex & index);
void slotDoubleClickSearch( QTreeWidgetItem* item, int); // Double click on a QSO in the search box
void slotRecalculateAwardsButtonClicked();
//SEARCH
void slotRighButtonSearch(const QPoint& pos);
///SEARCH
// CLUSTER
void slotAnalyzeDxClusterSignal(const QStringList _qs);
// CLUSTER
private:
//UPDATE CTY.DAT
bool downloadCTYFile();
bool downloadCtyDatFile();
bool saveToDisk(const QString &filename, QIODevice *data);
bool maybeSave();
QString saveFileName(const QUrl &url);
QNetworkAccessManager manager;
QNetworkRequest request;
//</UPDATE CTY.DAT>
void createStatusBar();
void createUI();
void createUICQWW();
void createUIDX();
//void createDXClusterUI();
void clearBandLabels();
void createMenusCommon();
void createMenusCQWW();
void createActionsCommon();
void createActionsCQWW();
void createActionsDX();
void createlogPanel();
void createlogModel();
void createScorePanel();
void createSearchResultsPanel();
void initialContestModeConfiguration();
void createKeyEvents();
void updateStatusBar(const QString statusm);
bool readCtyFile();
void showMenuRightButtonFromLogCreateActions();
void righButtonFromLogMenu(const int trow);
void showMenuRightButtonSearchCreateActions();
void righButtonSearchMenu(const int trow);
void qslSentViaBureau(const int _qsoId);
//void qslSentViaDirect(const int _qsoId);
void qslRecViaBureau(const int _qsoId);
void qslRecViaDirect(const int _qsoId);
void qslRecViaBureauMarkReq(const int _qsoId);
void qslRecViaDirectMarkReq(const int _qsoId);
bool isQSLReceived(const int _qsoId);
bool isQSLSent(const int _qsoId);
bool validCharactersInCall(const QString _qrz); // Looks for SQLi and no valid chars in the QRZ
QString readDataFromUI(); // Reads the QSO data from the UI and returns the SQL Query
QString readDataFromUIDX();
QString readDataFromUIDXModifying();
int getDXCCFromComboBox();
//QString readDataFromUICQWW();
void setAwardDXCC(const int _qsoId, bool modifying); // Adds or modify the status of a DXCC entity
// data << dxcc(id) << band(id) << mode(id) << confirmed(0/1) << qsoid(id) << modify(0/1);
int checkIfWorkedB4(const QString _qrz);
bool checkContest();
void showStatusOfDXCC(const QStringList _qs);
bool createConnection();
void createData();
bool processConfigLine(const QString _line);
void readConfigData();
void checkIfNewBandOrMode();
void readActiveBands (const QStringList actives);
void readActiveModes (const QStringList actives);
void qsoToEdit (const int _qso);
void showInfoFromLocators(const QString _loc1, const QString _loc2);
void clearInfoFromLocators();
//void showQRZEntityInfo(const QString _qrz);
void showEntityInfo(const int _enti);
QString getStyleColorToLabelFromBand(const QString _b, const QString _q);
void showAwards();
void showDXMarathon(const int _year);
void updateQSLRecAndSent();
double checkFreqRanges(double _f);
void selectCorrectComboBoxEntity(const int _ent); // Select the appropriate entity in the ComboBox
//int Km2Mile(const bool _imperialSystemSelected, const bool _dataInMiles, const int _km);
// CLUSTER
void clusterSpotToLog(const QString _call, const QString _freq);
QStringList dxclusterServersList;
QString dxclusterServerToConnect;
int dxclusterServerPort;
// CLUSTER
QWidget *mainWidget;
QWidget *dxClusterTabWidget, *searchTabWidget;
World *world;
FileManager *filemanager;
Locator *locator;
Awards *awards;
//WorldEditorWidget *worldEditor;
HelpHelpDialog *helpHelpDialog;
HelpAboutDialog *helpAboutDialog;
QPushButton *addButton;
QLabel *distShortLabelN;
QLabel *distLongLabelN;
//QLabel distShortLabelN;
//QLabel distLongLabelN;
QSqlRelationalTableModel *logModel;
QWidget *logPanel;
QTableView *logView;
QTreeWidget *searchResultsTreeWidget;
QLabel *logLabel;
QWidget *scoreWindow; //, dxWindow;
QTextEdit *scoreTextEdit;
// <UI>
QGroupBox *gridGroupBox, *qrzgroupBox, *searchgroupBox;
QFrame *dxUpLeftInputFrame;//, *dxUpRightOutputFrame;
QLineEdit *qrzLineEdit, *nameLineEdit, *qthLineEdit, *locatorLineEdit;
QComboBox *bandComboBox, *modeComboBox;
QDateEdit *dateEdit;
QTimeEdit *timeEdit;
//QStatusBar *statusBar, *qsoStatusBar;
QString statusBarMessage;
QTabWidget *dxBottonTab, *dxUpLeftTab, *dxUpRightTab;
QMenu *fileMenu;
QMenu *toolMenu;
QMenu *viewMenu;
QMenu *setupMenu;
QMenu *helpMenu;
QAction *openAct;
QAction *saveAct;
QAction *exitAct;
QAction *printLogAct;
QAction *addAct;
QAction *editAct;
QAction *removeAct;
QAction *logWinAct;
QAction *setupAct;
QAction *helpAct;
QAction *aboutAct;
QAction *aboutQtAct;
QAction *scoreWinAct;
QAction *scoreeWinAct;
QAction *ADIFExport;
QAction *ADIFImport;
QAction *ReqQSLExport;
QAction *CabrilloExport;
QAction *fillQsoAct;
QAction *findQSO2QSLAct;
QAction *findRequestedQSLAct;
QAction *findQSLPendingToReceiveAct;
QAction *downloadCTYAct;
QAction *loggWinAct;
QAction *delQSOFromLogAct;
QAction *qsoToEditFromLogAct;
QAction *qslSentViaBureauFromLogAct;
QAction *qslSentViaDirectFromLogAct;
QAction *qslRecViaBureauFromLogAct;
QAction *qslRecViaDirectFromLogAct;
QAction *qslSentRequestedAct;
QAction *qslRecRequestedAct;
QAction *delQSOFromSearchAct;
QAction *qsoToEditFromSearchAct;
QAction *qslSentViaBureauFromSearchAct;
QAction *qslSentViaDirectFromSearchAct;
QAction *qslRecViaBureauFromSearchAct;
QAction *qslRecViaDirectFromSearchAct;
QAction *qslRecViaBureauMarkReqFromSearchAct;
QAction *qslRecViaDirectMarkReqFromSearchAct;
QLineEdit *rstTXLineEdit;
QLineEdit *rstRXLineEdit;
QLineEdit *STXLineEdit;
QLineEdit *SRXLineEdit;
QPushButton *OKButton, *spotItButton, *clearButton;
QStringList bands;
QStringList modes;
QStringList entitiesList;
// UI DX
QLabel *entityPrimLabel, *entitySecLabel, *iotaAwardLabel, *entityNameLabel;
QLabel *infoLabel1, *infoLabel2;
QLabel *bandLabel1, *bandLabel2, *bandLabel3, *bandLabel4;
QLabel *bandLabel5, *bandLabel6, *bandLabel7, *bandLabel8;
QLabel *bandLabel9, *bandLabel10, *bandLabel11, *bandLabel12;
QLabel *continentLabel, *prefixLabel, *cqzLabel, *ituzLabel;
QLabel *gradShortLabel, *distShortLabel;
QLabel *gradLongLabel, *distLongLabel;
QComboBox *iotaContinentComboBox, *entityPrimDivComboBox, *entitySecDivComboBox, *entityNameComboBox;
QComboBox *operatingYearsComboBox;
QLineEdit *iotaNumberLineEdit, *operatorLineEdit, *stationCallSignLineEdit, *myLocatorLineEdit, *commentLineEdit;
QTextEdit *notesTextEdit;
QDoubleSpinBox *myPowerSpinBox, *rxPowerSpinBox, *txFreqSpinBox, *rxFreqSpinBox;
QLCDNumber *freqQLCDNumber;
QLCDNumber *dxccConfirmedQLCDNumber, *dxccWorkedQLCDNumber,
*wazConfirmedQLCDNumber, *wazWorkedQLCDNumber,
*localConfirmedQLCDNumber, *localWorkedQLCDNumber,
*qsoConfirmedQLCDNumber, *qsoWorkedQLCDNumber,
*dxMarathonDXCC, *dxMarathonCQ, *dxMarathonPoints;
QComboBox *eqslSentComboBox, *eqslRecComboBox, *lotwSentComboBox, *lotwRecComboBox;
QDateEdit *eqslSentQDateEdit, *eqslRecQDateEdit, *lotwSentQDateEdit, *lotwRecQDateEdit;
QComboBox *qslSentComboBox, *qslRecComboBox, *qslSentViaComboBox, *qslRecViaComboBox;
QDateEdit *qslSentQDateEdit, *qslRecQDateEdit;
QTextEdit *qslmsgTextEdit;
QLineEdit *qslViaLineEdit;
QLineEdit *searchBoxLineEdit;
QPushButton *searchBoxClearButton, *searchBoxExportButton, *searchBoxSelectAllButton, *searchBoxReSearchButton;
QPushButton *recalculateAwardsButton;
bool searchSelectAllClicked, stationCallSignShownInSearch;
bool qslingNeeded;
// UI DX
SetupDialog *setupDialog;
// <CLUSTER>
DXClusterWidget *dxClusterWidget;
bool dxClusterShowHF, dxClusterShowVHF, dxClusterShowWARC, dxClusterShowWorked, dxClusterShowConfirmed, dxClusterShowAnn, dxClusterShowWWV, dxClusterShowWCY;
//QWidget *dxClusterWidget;
//QListWidget *dxClusterListWidget;
//QPushButton *sendDXClusterButton;
//QLineEdit *inputDXClusterLineEdit;
// </CLUSTER>
// </UI>
QTimer *timer;
QDateTime *dateTime;
QString kontestDir, defaultADIFLogFile, configFileName;
QString softwareVersion;
QString currentQrz;
QString previousQrz;
QString stx;
QString srx;
bool realTime, UTCTime, alwaysADIF, needToSave, useDefaultLogFileName, upAndRunning, qrzSmallModDontCalculate, imperialSystem, sendQSLWhenRec, keepMyData;
bool cleaning;
// Station Setup
bool configured, modify;
bool needToEnd; // Just to control if the software needs to end.
QString stationQRZ, operatorQRZ, myLocator, dxLocator;
QString lastOperatorQRZ, lastStationQRZ, lastMyLocator;
double myPower, lastPower;
int my_CQz, my_ITUz, defaultMode, defaultBand, currentMode, currentModeShown, currentBand, currentBandShown;
int currentEntity, previousEntity;
bool InValidCharsInPrevCall;
int currentLog; // This is to be able to manage multiple logs without showing
// them all at the same time.
int modifyingQSO; // When modifying, the QSO is saved here.
int selectedYear;
// Station Setup
QColor defaultColor;
QColor neededColor;
QColor workedColor;
QColor confirmedColor;
QColor newOneColor;
// Contest
int contestMode, points, qsoPoints, multipliers, qsoMultiplier;
Contest *contest;
// Contest
DataProxy *dataProxy;
DataBase *db;
bool DBinMemory;
QTextDocument *doc;
protected:
void keyPressEvent(QKeyEvent *event);
void closeEvent(QCloseEvent *event);
};
#endif

787
setupdialog.cpp Normal file
View File

@ -0,0 +1,787 @@
/***************************************************************************
setupdialog.cpp - description
-------------------
begin : sept 2011
copyright : (C) 2011 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
#include "setupdialog.h"
#include <QDebug>
/*
This class calls all the othet "Setup..." to manage the configuration
*/
SetupDialog::SetupDialog(const bool _firstTime)
{
//qDebug() << "SetupDialog::SetupDialog 1" << endl;
configFileName = "klogrc";
version = ".";
pageRequested = 0;
firstTime = _firstTime;
if (firstTime)
{
//qDebug() << "SetupDialog::SetupDialog FIRST TIME = TRUE" << endl;
}
else
{
//qDebug() << "SetupDialog::SetupDialog FIRST TIME = FALSE" << endl;
}
int logsPageTabN=-1;
locator = new Locator();
tabWidget = new QTabWidget;
userDataPage = new SetupPageUserDataPage();
bandsModesPage = new SetupPageBandsModes(this);
dxClusterPage = new SetupPageDxCluster(this);
colorsPage = new SetupPageColors(this);
miscPage = new SetupPageMisc(this);
worldEditorPage = new SetupPageWorldEditor (this);
logsPage = new SetupPageLogs(this);
tabWidget->addTab(userDataPage, tr("My Data"));
tabWidget->addTab(bandsModesPage, tr("Bands/Modes"));
tabWidget->addTab(dxClusterPage, tr("DX-Cluster"));
tabWidget->addTab(colorsPage, tr("Colors"));
tabWidget->addTab(miscPage, tr("Misc"));
tabWidget->addTab(worldEditorPage, tr("World Editor"));
logsPageTabN = tabWidget->addTab(logsPage, tr("Logs"));
QPushButton *closeButton = new QPushButton(tr("Cancel"));
QPushButton *okButton = new QPushButton(tr("OK"));
connect(closeButton, SIGNAL(clicked()), this, SLOT(slotCancelButtonClicked()));
connect(okButton, SIGNAL(clicked()), this, SLOT(slotOkButtonClicked()));
QHBoxLayout *horizontalLayout = new QHBoxLayout;
horizontalLayout->addWidget(tabWidget);
QHBoxLayout *buttonsLayout = new QHBoxLayout;
buttonsLayout->addStretch(1);
buttonsLayout->addWidget(okButton);
buttonsLayout->addWidget(closeButton);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addLayout(horizontalLayout);
mainLayout->addLayout(buttonsLayout);
setLayout(mainLayout);
setWindowTitle(tr("Config Dialog"));
slotReadConfigData();
if ((pageRequested==6) && (logsPageTabN>0))// The user is opening a new log
{
tabWidget->setCurrentIndex(logsPageTabN);
}
}
SetupDialog::SetupDialog(const QString _configFile, const QString _softwareVersion, const int _page, const bool _firstTime)
{
//qDebug() << "SetupDialog::SetupDialog 2" << endl;
firstTime = _firstTime;
configFileName = _configFile;
version = _softwareVersion;
pageRequested = _page;
int logsPageTabN=-1;
locator = new Locator();
tabWidget = new QTabWidget;
userDataPage = new SetupPageUserDataPage();
bandsModesPage = new SetupPageBandsModes(this);
dxClusterPage = new SetupPageDxCluster(this);
colorsPage = new SetupPageColors(this);
miscPage = new SetupPageMisc(this);
worldEditorPage = new SetupPageWorldEditor (this);
logsPage = new SetupPageLogs(this);
tabWidget->addTab(userDataPage, tr("User data"));
tabWidget->addTab(bandsModesPage, tr("Bands/Modes"));
tabWidget->addTab(dxClusterPage, tr("DX-Cluster"));
tabWidget->addTab(colorsPage, tr("Colors"));
tabWidget->addTab(miscPage, tr("Misc"));
tabWidget->addTab(worldEditorPage, tr("World Editor"));
logsPageTabN = tabWidget->addTab(logsPage, tr("Logs"));
QPushButton *closeButton = new QPushButton(tr("Cancel"));
QPushButton *okButton = new QPushButton(tr("OK"));
connect(closeButton, SIGNAL(clicked()), this, SLOT(slotCancelButtonClicked()));
connect(okButton, SIGNAL(clicked()), this, SLOT(slotOkButtonClicked()));
QHBoxLayout *horizontalLayout = new QHBoxLayout;
horizontalLayout->addWidget(tabWidget);
QHBoxLayout *buttonsLayout = new QHBoxLayout;
buttonsLayout->addStretch(1);
buttonsLayout->addWidget(okButton);
buttonsLayout->addWidget(closeButton);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addLayout(horizontalLayout);
mainLayout->addLayout(buttonsLayout);
setLayout(mainLayout);
setWindowTitle(tr("Config Dialog"));
slotReadConfigData();
if ((pageRequested==6) && (logsPageTabN>0))// The user is opening a new log
{
tabWidget->setCurrentIndex(logsPageTabN);
}
}
SetupDialog::~SetupDialog()
{
//qDebug() << "SetupDialog::~SetupDialog " << endl;
}
void SetupDialog::setData(const QString _configFile, const QString _softwareVersion, const int _page, const bool _firstTime)
{
//qDebug() << "SetupDialog::setData" << endl;
firstTime = _firstTime;
if (firstTime)
{
//qDebug() << "SetupDialog::setData FIRST TIME! " << endl;
}
else
{
//qDebug() << "SetupDialog::setData NOT FIRST TIME! " << endl;
}
setConfigFile(_configFile);
setSoftVersion(_softwareVersion);
setPage(_page);
}
void SetupDialog::setConfigFile(const QString _configFile)
{
//qDebug() << "SetupDialog::setConfigFile" << endl;
configFileName = _configFile;
}
void SetupDialog::setSoftVersion(const QString _softwareVersion)
{
//qDebug() << "SetupDialog::setSoftVersion" << endl;
version = _softwareVersion;
}
void SetupDialog::setPage(const int _page)
{
//qDebug() << "SetupDialog::setPage("<<QString::number(_page) << ")" << endl;
pageRequested = _page;
}
void SetupDialog::slotCancelButtonClicked()
{
//qDebug() << "SetupDialog::slotCancelButtonClicked" << endl;
if (firstTime)
{
emit exitSignal(2);
}
//
close();
}
void SetupDialog::createIcons()
{
//qDebug() << "SetupDialog::createIcons" << endl;
QListWidgetItem *configButton = new QListWidgetItem(contentsWidget);
configButton->setIcon(QIcon(":/images/config.png"));
configButton->setText(tr("User data"));
configButton->setTextAlignment(Qt::AlignHCenter);
configButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
QListWidgetItem *logsButton = new QListWidgetItem(contentsWidget);
logsButton->setIcon(QIcon(":/images/config.png"));
logsButton->setText(tr("Logs"));
logsButton->setTextAlignment(Qt::AlignHCenter);
logsButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
QListWidgetItem *bandsButton = new QListWidgetItem(contentsWidget);
bandsButton->setIcon(QIcon(":/images/query.png"));
bandsButton->setText(tr("Bands/Modes"));
bandsButton->setTextAlignment(Qt::AlignHCenter);
bandsButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
QListWidgetItem *dxClusterButton = new QListWidgetItem(contentsWidget);
dxClusterButton->setIcon(QIcon(":/images/query.png"));
dxClusterButton->setText(tr("DX-Cluster"));
dxClusterButton->setTextAlignment(Qt::AlignHCenter);
dxClusterButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
QListWidgetItem *colorsButton = new QListWidgetItem(contentsWidget);
colorsButton->setIcon(QIcon(":/images/query.png"));
colorsButton->setText(tr("Colors"));
colorsButton->setTextAlignment(Qt::AlignHCenter);
colorsButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
QListWidgetItem *miscButton = new QListWidgetItem(contentsWidget);
miscButton->setIcon(QIcon(":/images/query.png"));
miscButton->setText(tr("Misc"));
miscButton->setTextAlignment(Qt::AlignHCenter);
miscButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
QListWidgetItem *worldButton = new QListWidgetItem(contentsWidget);
worldButton->setIcon(QIcon(":/images/query.png"));
worldButton->setText(tr("World"));
worldButton->setTextAlignment(Qt::AlignHCenter);
worldButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
connect(contentsWidget,
SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
this, SLOT(changePage(QListWidgetItem*,QListWidgetItem*)));
}
void SetupDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous)
{
//qDebug() << "SetupDialog::changePage" << endl;
if (!current)
current = previous;
pagesWidget->setCurrentIndex(contentsWidget->row(current));
}
void SetupDialog::slotOkButtonClicked()
{
//qDebug() << "SetupDialog::slotOkButonClicked" << endl;
if ((userDataPage->getStationQrz()).length() < 3){ // There are no valid calls with less than 3 Chars
return;
}
QFile file (configFileName);
QString tmp;
tmp = "true";
if (file.open (QIODevice::WriteOnly)){
QTextStream stream (&file);
/*QString stationCall;
int contest;
int contestCategory;
int modes;*/
//QRZ/CQ/ITU/CONTEST
stream << "version=" << version << ";" << endl;
stream << "callsign=" << userDataPage->getStationQrz() << ";" << endl;
if ((userDataPage->getOperators()).length() >= 3){ // There are no valid calls with less than 3 Chars
stream << "operators=" << userDataPage->getOperators() << ";" << endl;
}
//stream << "contest=" << userDataPage->getContest() << ";" << endl;
//stream << "contestcategory=" << userDataPage->getContestCategory() << ";" << endl;
stream << "cqz=" << QString::number(userDataPage->getCQz()) << ";" << endl;
stream << "ituz=" << QString::number(userDataPage->getITUz()) << ";" << endl;
if ( locator->isValidLocator(userDataPage->getStationLocator()) )
{
stream << "StationLocator=" << userDataPage->getStationLocator() << ";" << endl;
}
if ((!(userDataPage->getName()).isNull()) && ( (userDataPage->getName()).length() > 0 ))
{
stream << "Name=" << userDataPage->getName() <<";" << endl;
}
if ((!(userDataPage->getAddress1()).isNull()) && ( (userDataPage->getAddress1()).length() > 0 ))
{
stream << "Address1=" << userDataPage->getAddress1() <<";" << endl;
}
if ((!(userDataPage->getAddress2()).isNull()) && ( (userDataPage->getAddress2()).length() > 0 ))
{
stream << "Address2=" << userDataPage->getAddress2() <<";" << endl;
}
if ((!(userDataPage->getAddress3()).isNull()) && ( (userDataPage->getAddress3()).length() > 0 ))
{
stream << "Address3=" << userDataPage->getAddress3() <<";" << endl;
}
if ((!(userDataPage->getAddress4()).isNull()) && ( (userDataPage->getAddress4()).length() > 0 ))
{
stream << "Address4=" << userDataPage->getAddress4() <<";" << endl;
}
if ((!(userDataPage->getCity()).isNull()) && ( (userDataPage->getCity()).length() > 0 ))
{
stream << "City=" << userDataPage->getCity() <<";" << endl;
}
if ((!(userDataPage->getZipCode()).isNull()) && ( (userDataPage->getZipCode()).length() > 0 ))
{
stream << "ZipCode=" << userDataPage->getZipCode() <<";" << endl;
}
if ((!(userDataPage->getProvince()).isNull()) && ( (userDataPage->getProvince()).length() > 0 ))
{
stream << "ProvinceState=" << userDataPage->getProvince() <<";" << endl;
}
if ((!(userDataPage->getCountry()).isNull()) && ( (userDataPage->getCountry()).length() > 0 ))
{
stream << "Country=" << userDataPage->getCountry() <<";" << endl;
}
if ((!(userDataPage->getRig1()).isNull()) && ( (userDataPage->getRig1()).length() > 0 ))
{
stream << "Rig1=" << userDataPage->getRig1() <<";" << endl;
}
if ((!(userDataPage->getRig2()).isNull()) && ( (userDataPage->getRig2()).length() > 0 ))
{
stream << "Rig2=" << userDataPage->getRig2() <<";" << endl;
}
if ((!(userDataPage->getRig3()).isNull()) && ( (userDataPage->getRig3()).length() > 0 ))
{
stream << "Rig3=" << userDataPage->getRig3() <<";" << endl;
}
if ((!(userDataPage->getAntenna1()).isNull()) && ( (userDataPage->getAntenna1()).length() > 0 ))
{
stream << "Antenna1=" << userDataPage->getAntenna1() <<";" << endl;
}
if ((!(userDataPage->getAntenna2()).isNull()) && ( (userDataPage->getAntenna2()).length() > 0 ))
{
stream << "Antenna2=" << userDataPage->getAntenna2() <<";" << endl;
}
if ((!(userDataPage->getAntenna3()).isNull()) && ( (userDataPage->getAntenna2()).length() > 0 ))
{
stream << "Antenna3=" << userDataPage->getAntenna3() <<";" << endl;
}
if ((userDataPage->getPower()).toFloat()>=0)
{
stream << "Power=" << userDataPage->getPower() << ";" << endl;
}
//stream << "locator=" << (MyLocatorkLineEdit->text ()).toUpper () << ";" << endl;
//stream << "CallUsed=" << (UserDataPage.qrzLineEdit).text() << ";" << endl;
//stream << "Operators=" << ";" << endl;
stream << "Bands=" << bandsModesPage->getBands() << ";" << endl;
stream << "Modes=" << bandsModesPage->getModes() << ";" << endl;
stream << "InMemory=" << miscPage->getInMemory() << ";" << endl;
stream << "RealTime=" << miscPage->getRealTime() << ";" << endl;
stream << "UTCTime=" << miscPage->getUTCTime() << ";" << endl;
stream << "AlwaysADIF=" << miscPage->getAlwaysADIF() << ";" << endl;
stream << "UseDefaultName=" << miscPage->getUseDefaultName() << ";" << endl;
stream << "DefaultADIFFile=" << miscPage->getDefaultFileName() << ";" << endl;
stream << "ImperialSystem=" << miscPage->getImperial() << ";" << endl;
stream << "SendQSLWhenRec=" << miscPage->getSendQSLWhenRec() << ";" << endl;
stream << "ShowCallsignInSearch=" << miscPage->getShowStationCallSignInSearch() << ";" << endl;
stream << "KeepMyData=" << miscPage->getKeepMyData() << ";" << endl;
if ((!(dxClusterPage->getSelectedDxClusterServer()).isNull()) && ( (dxClusterPage->getSelectedDxClusterServer()).length() > 0 ))
{
stream << "DXClusterServerToUse=" << dxClusterPage->getSelectedDxClusterServer() <<";" << endl;
}
QStringList stringList;
stringList.clear();
stringList << dxClusterPage->getDxclusterServersComboBox();
if (stringList.count()>0)
{
for (int i = 0; i < stringList.count(); i++)
{
stream << "DXClusterServerPort="<< stringList.at(i) << ";" << endl;
}
}
stream << "DXClusterShowHF=" << dxClusterPage->getShowHFRadiobutton() << ";" << endl;
stream << "DXClusterShowVHF=" << dxClusterPage->getShowVHFRadiobutton() << ";" << endl;
stream << "DXClusterShowWARC=" << dxClusterPage->getShowWARCRadiobutton() << ";" << endl;
stream << "DXClusterShowWorked=" << dxClusterPage->getShowWorkedRadiobutton() << ";" << endl;
stream << "DXClusterShowConfirmed=" << dxClusterPage->getShowConfirmedRadiobutton() << ";" << endl;
stream << "DXClusterShowAnn=" << dxClusterPage->getShowANNRadiobutton() << ";" << endl;
stream << "DXClusterShowWWV=" << dxClusterPage->getShowWWVRadiobutton() << ";" << endl;
stream << "DXClusterShowWCY=" << dxClusterPage->getShowWCYRadiobutton() << ";" << endl;
stream << "NewOneColor=" << colorsPage->getNewOneColor() << ";" << endl;
stream << "NeededColor=" << colorsPage->getNeededColor() << ";" << endl;
stream << "WorkedColor=" << colorsPage->getWorkedColor() << ";" << endl;
stream << "ConfirmedColor=" << colorsPage->getConfirmedColor() << ";" << endl;
stream << "DefaultColor=" << colorsPage->getDefaultColor() << ";" << endl;
file.close ();
}
QDialog::accept();
//close();
}
void SetupDialog::slotReadConfigData()
{
//qDebug() << "SetupDialog::slotReadConfigData" << endl;
QFile file(configFileName);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)){
//qDebug() << "SetupDialog::slotReadConfigData() File not found" << configFileName << endl;
//firstTime = true;
return;
}
//dxClusterServers.clear();
setDefaults();
while (!file.atEnd()) {
QByteArray line = file.readLine();
processConfigLine(line);
}
dxClusterPage->setDxclusterServersComboBox(dxClusterServers);
dxClusterPage->setSelectedDxClusterServer(dxClusterServerToUse);
}
bool SetupDialog::processConfigLine(const QString _line)
{
//qDebug() << "SetupDialog::processConfigLine: " << _line << endl;
QString line = (_line.toUpper()).simplified();
//line.simplified();
QStringList values = line.split("=", QString::SkipEmptyParts);
if (line.startsWith('#')){
//qDebug() << "SetupDialog::processConfigLine: Comment Line!" << endl;
return true;
}
if (!( (line.contains('=')) && (line.contains(';')))){
//qDebug() << "SetupDialog::processConfigLine: Wrong Line!" << endl;
return false;
}
QString value = values.at(1);
int endValue = value.indexOf(';');
if (endValue>-1){
value = value.left(value.length() - (value.length() - endValue));
}
value = checkAndFixASCIIinADIF(value); // Check whether the value is valid.
if (values.at(0) == "CALLSIGN"){
//qDebug() << "SetupDialog::processConfigLine: CALLSIGN: " << value << endl;
userDataPage->setStationQrz(value);
}else if (values.at(0) == "OPERATORS"){
userDataPage->setOperators(value);
}else if (values.at(0)=="CQZ"){
userDataPage->setCQz((value).toInt());
}else if (values.at(0)=="ITUZ"){
userDataPage->setITUz((value).toInt());
}else if (values.at(0)=="CONTEST"){
//userDataPage->setContest(value);
}else if (values.at(0)=="MODES"){
readActiveModes(value);
bandsModesPage->setActiveModes(modes);
}else if (values.at(0)=="BANDS"){
readActiveBands(value);
bandsModesPage->setActiveBands(bands);
}else if (values.at(0)=="INMEMORY"){
miscPage->setInMemory(value);
}else if (values.at(0)=="REALTIME"){
miscPage->setRealTime(value);
}else if (values.at(0)=="UTCTIME"){
miscPage->setUTCTime(value);
}else if (values.at(0)=="ALWAYSADIF"){
miscPage->setAlwaysADIF(value);
}else if (values.at(0)=="USEDEFAULTNAME"){
miscPage->setDefaultFileName(value);
}else if (values.at(0)=="DEFAULTADIFFILE"){
miscPage->setDefaultFileName(value.toLower());
}else if (values.at(0)=="IMPERIALSYSTEM"){
miscPage->setImperial(value.toLower());
}else if (values.at(0)=="KEEPMYDATA"){
miscPage->setKeepMyData(value.toLower());
}else if (values.at(0)=="SENDQSLWHENREC"){
miscPage->setSendQSLWhenRec(value.toLower());
}
else if (values.at(0)=="SHOWCALLSIGNINSEARCH"){
miscPage->setShowStationCallSignInSearch(value.toLower());
}
else if (values.at(0)=="NAME")
{
userDataPage->setName(value);
}
else if (values.at(0)=="ADDRESS1")
{
userDataPage->setAddress1(value);
}
else if (values.at(0)=="ADDRESS2")
{
userDataPage->setAddress2(value);
}
else if (values.at(0)=="ADDRESS3")
{
userDataPage->setAddress3(value);
}
else if (values.at(0)=="ADDRESS4")
{
userDataPage->setAddress4(value);
}
else if (values.at(0)=="CITY")
{
userDataPage->setCity(value);
}
else if (values.at(0)=="ZIPCODE")
{
userDataPage->setZipCode(value);
}
else if (values.at(0)=="PROVINCESTATE")
{
userDataPage->setProvince(value);
}
else if (values.at(0)=="COUNTRY")
{
userDataPage->setCountry(value);
}
else if (values.at(0)=="POWER")
{
userDataPage->setPower(value);
}
else if (values.at(0)=="RIG1")
{
userDataPage->setRig1(value);
}
else if (values.at(0)=="RIG2")
{
userDataPage->setRig2(value);
}
else if (values.at(0)=="RIG3")
{
userDataPage->setRig3(value);
}
else if (values.at(0)=="ANTENNA1")
{
userDataPage->setAntenna1(value);
}
else if (values.at(0)=="ANTENNA2")
{
userDataPage->setAntenna2(value);
}
else if (values.at(0)=="ANTENNA3")
{
userDataPage->setAntenna3(value);
}
else if (values.at(0)=="STATIONLOCATOR"){
if ( locator->isValidLocator(value) )
{
userDataPage->setStationLocator(value);
}
}else if (values.at(0)=="DXCLUSTERSHOWHF"){
dxClusterPage->setShowHFRadiobutton(value);
}else if (values.at(0)=="DXCLUSTERSHOWVHF"){
dxClusterPage->setShowVHFRadiobutton(value);
}else if (values.at(0)=="DXCLUSTERSHOWWARC"){
dxClusterPage->setShowWARCRadiobutton(value);
}else if (values.at(0)=="DXCLUSTERSHOWWORKED"){
dxClusterPage->setShowWorkedRadiobutton(value);
}else if (values.at(0)=="DXCLUSTERSHOWCONFIRMED"){
dxClusterPage->setShowConfirmedRadiobutton(value);
}else if (values.at(0)=="DXCLUSTERSHOWANN"){
dxClusterPage->setShowANNRadiobutton(value);
}else if (values.at(0)=="DXCLUSTERSHOWWWV"){
dxClusterPage->setShowWWVRadiobutton(value);
}else if (values.at(0)=="DXCLUSTERSHOWWCY"){
dxClusterPage->setShowWCYRadiobutton(value);
}else if(values.at(0)=="DXCLUSTERSERVERPORT"){
dxClusterServers << value;
//qDebug() << "SetupDialog::processConfigLine: dxClusterServers: " << dxClusterServers.last() << endl;
}else if (values.at(0) =="DXCLUSTERSERVERTOUSE"){
dxClusterServerToUse=value;
}
else if(values.at(0)=="NEWONECOLOR"){
colorsPage->setNewOneColor(value);
}else if(values.at(0)=="NEEDEDCOLOR"){
colorsPage->setNeededColor(value);
}else if(values.at(0)=="WORKEDCOLOR"){
colorsPage->setWorkedColor(value);
}else if(values.at(0)=="CONFIRMEDCOLOR"){
colorsPage->setConfirmedColor(value);
}else if(values.at(0)=="DEFAULTCOLOR"){
colorsPage->setDefaultColor(value);
}else{
//qDebug() << "SetupDialog::processConfigLine: NONE: " << endl;
}
// Lines are: Option = value;
return true;
}
void SetupDialog::readActiveBands (const QString actives)
{ // Checks a "10m, 12m" QString, checks if they are valid bands and import to the
// bands used in the program
//qDebug() << "SetupDialog::readActiveBands: " << actives << endl;
bool atLeastOne = false;
QStringList values = actives.split(", ", QString::SkipEmptyParts);
for (int i = 0; i < values.count() ; i++)
{
if (isValidBand(values.at(i)))
{
if (!atLeastOne)
{
//qDebug() << "SetupDialog::readActiveBands (at least One!): " << values.at(i) << endl;
atLeastOne = true;
bands.clear();
}
bands << values.at(i);
//qDebug() << "SetupDialog::readActiveBands: " << values.at(i) << endl;
}
}
}
void SetupDialog::readActiveModes (const QString actives)
{
//qDebug() << "SetupDialog::readActiveModes: " << actives << endl;
bool atLeastOne = false;
QStringList values = actives.split(", ", QString::SkipEmptyParts);
for (int i = 0; i < values.count() ; i++)
{
if (isValidMode(values.at(i)))
{
if (!atLeastOne)
{
atLeastOne = true;
modes.clear();
}
modes << values.at(i);
}
}
}
bool SetupDialog::isValidBand (const QString b)
{
//qDebug() << "SetupDialog::isValidBand: "<< b << endl;
QString stringQuery = QString("SELECT id FROM band WHERE name='%1'").arg(b);
QSqlQuery query(stringQuery);
query.next();
return query.isValid();
}
bool SetupDialog::isValidMode (const QString b)
{
//qDebug() << "SetupDialog::isValidMode: " << b << endl;
QString stringQuery = QString("SELECT id FROM mode WHERE name='%1'").arg(b);
QSqlQuery query(stringQuery);
query.next();
return query.isValid();
}
void SetupDialog::setDefaults()
{
//qDebug() << "SetupDialog::setDefaults" << endl;
miscPage->setInMemory("TRUE");
miscPage->setRealTime("TRUE");
miscPage->setUTCTime("TRUE");
miscPage->setImperial("FALSE"); //Metric system is the default
miscPage->setAlwaysADIF("FALSE");
miscPage->setSendQSLWhenRec("TRUE");
miscPage->setShowStationCallSignInSearch("TRUE");
miscPage->setKeepMyData("TRUE");
dxClusterPage->setShowHFRadiobutton("TRUE");
dxClusterPage->setShowVHFRadiobutton("TRUE");
dxClusterPage->setShowWARCRadiobutton("TRUE");
dxClusterPage->setShowWorkedRadiobutton("TRUE");
dxClusterPage->setShowConfirmedRadiobutton("TRUE");
dxClusterPage->setShowANNRadiobutton("TRUE");
dxClusterPage->setShowWWVRadiobutton("TRUE");
dxClusterPage->setShowWCYRadiobutton("TRUE");
dxClusterServers.clear();
dxClusterServers.append("dxfun.com:8000");
dxClusterServerToUse = "dxfun.com:8000";
}
QString SetupDialog::checkAndFixASCIIinADIF(const QString _data)
{
//qDebug() << "SetupDialog::checkAndFixASCIIinADIF " << _data << endl;
//TODO: this function is also in the FileManager class. Maybe I should call that one and keep just one copy
int asciiVal;
QString st = _data;
QString newString;
newString.clear();
for(int i=0; i < st.length(); i++)
{
// Get ASCII VALUE into asciiVal
asciiVal = st.at(i).toAscii();
if ((32 <= asciiVal ) && (asciiVal <= 126))
{
newString.append(st.at(i));
}
//qDebug() << "SetupDialog::checkAndFixASCIIinADIF: " << st.at(i) <<" = " << QString::number(asciiVal) << endl;
}
// Show into another lineEdit
return newString;
}

116
setupdialog.h Normal file
View File

@ -0,0 +1,116 @@
#ifndef SETUPDIALOG_H
#define SETUPDIALOG_H
/***************************************************************************
setupdialog.h - description
-------------------
begin : sept 2011
copyright : (C) 2011 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
//#include <QtWidgets>
#include <QDialog>
#include "setuppageuserdata.h"
#include "setuppagebandsmodes.h"
#include "setuppagemisc.h"
#include "setuppagedxcluster.h"
#include "setuppagecolors.h"
#include "setuppagelogs.h"
#include "setuppageworldeditor.h"
#include "locator.h"
class QListWidget;
class QListWidgetItem;
class QStackedWidget;
class SetupDialog : public QDialog
{
Q_OBJECT
public:
SetupDialog(const bool _firstTime=true);
SetupDialog(const QString _configFile, const QString _softwareVersion, const int _page=0, const bool _firstTime = true);
~SetupDialog();
void setData(const QString _configFile, const QString _softwareVersion, const int _page, const bool _firstTime=true);
public slots:
signals:
void exitSignal(const int status); // 1 = OK, -1 = NOK, 2 = Cancel clicked
private slots:
void changePage(QListWidgetItem *current, QListWidgetItem *previous);
void slotReadConfigData();
void slotOkButtonClicked();
void slotCancelButtonClicked();
private:
void setConfigFile(const QString _configFile);
void setSoftVersion(const QString _softwareVersion);
void setConfigured(const bool _configured);
void setPage(const int _page);
void createIcons();
bool processConfigLine(const QString _line);
void setDefaults();
void readActiveBands (const QString actives);
void readActiveModes (const QString actives);
bool isValidBand (const QString b);
bool isValidMode (const QString b);
QString checkAndFixASCIIinADIF(const QString _data);
bool firstTime; // To know if we are calling it from the Start wizard or not
QString dxClusterServerToUse;
QStringList dxClusterServers;
QTabWidget *tabWidget;
QListWidget *contentsWidget;
QStackedWidget *pagesWidget;
SetupPageUserDataPage *userDataPage;
SetupPageBandsModes *bandsModesPage;
SetupPageDxCluster *dxClusterPage;
SetupPageMisc *miscPage;
SetupPageColors *colorsPage;
SetupPageLogs *logsPage;
SetupPageWorldEditor *worldEditorPage;
int pageRequested; // The page on the Dialog that is requested to be shown when you call it
//QString kontestDir;
QString configFileName, version;
QStringList bands, modes;
Locator *locator;
};
#endif // SETUPDIALOG_H

690
setupentitydialog.cpp Normal file
View File

@ -0,0 +1,690 @@
/***************************************************************************
setupentitydialog.cpp - description
-------------------
begin : sept 2012
copyright : (C) 2012 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
#include "setupentitydialog.h"
//#include <QDebug>
/*
This class calls all the othet "Setup..." to manage the configuration
*/
SetupEntityDialog::SetupEntityDialog(){
//qDebug() << "SetupEntityDialog::SetupEntityDialog: " << endl;
//QPalette::ColorRole QWidget::foregroundRole () const;
//QPalette::ColorRole
//paletteOrig = new QPalette;
//paletteWrong = new QPalette;
//paletteWrong.setColor(QPalette::Normal, QPalette::WindowText, Qt::red);
//paletteWrong = new QPalette();
//*paletteWrong->setColor(QPalette::WindowText, Qt::red);
//paletteWrong.setColor(QPalette::WindowText, color.setNamedColor("red"));
palw.setColor(QPalette::Text, Qt::red);
//pal.setColor(QPalette::Text, Qt::black);
entityData.clear();
entityBool = false;
mainPrefixBool = false;
cqBool = false;
ituBool = false;
contBool = false;
latBool = false;
lonBool = false;
utcBool = false;
arrlidBool = false;
delBool = false;
delDateBool = false;
prefBool = false;
//qDebug() << "SetupEntityDialog::SetupEntityDialog - 0" << endl;
QLabel *entityLabel = new QLabel(tr("Entity"));
entityLineEdit = new QLineEdit;
entityLineEdit->setToolTip(tr("Name of the Entity"));
QLabel *cqLabel = new QLabel(tr("CQ"));
cqLineEdit = new QLineEdit;
cqLineEdit->setToolTip(tr("CQ zone"));
QLabel *ituLabel = new QLabel(tr("ITU"));
ituLineEdit = new QLineEdit;
ituLineEdit->setToolTip(tr("ITU zone"));
//QLabel *contLabel = new QLabel(tr("Continent"));
//contLineEdit = new QLineEdit;
//contLineEdit->setToolTip(tr("Continent of the Entity"));
QLabel *latLabel = new QLabel(tr("Latitude"));
latLineEdit = new QLineEdit;
latLineEdit->setToolTip(tr("Longitude of the Entity"));
QLabel *lonLabel = new QLabel(tr("Longitude"));
lonLineEdit = new QLineEdit;
lonLineEdit->setToolTip(tr("Longitude of the Entity"));
QLabel *utcLabel = new QLabel(tr("UTC"));
utcLineEdit = new QLineEdit;
utcLineEdit->setToolTip(tr("Local time difference to UTC"));
QLabel *mprefLabel = new QLabel(tr("Main prefix"));
mprefLineEdit = new QLineEdit;
mprefLineEdit->setToolTip(tr("Main prefix of the entity"));
//qDebug() << "SetupEntityDialog::SetupEntityDialog - 1" << endl;
QLabel *arrlidLabel = new QLabel(tr("ARRL Id"));
arrlidLineEdit = new QLineEdit;
arrlidLineEdit->setToolTip(tr("ARRL id"));
//QLabel *deletedLabel = new QLabel(tr("Deleted"));
//deletedLineEdit = new QLineEdit;
//deletedLineEdit->setToolTip(tr("Mark if the entity is deleted"));
QLabel *prefLabel = new QLabel(tr("Prefixes"));
prefLineEdit = new QLineEdit;
prefLineEdit->setToolTip(tr("Comma separated possible prefixes. ie. EA1, EA2, ..."));
delQDateEdit = new QDateEdit;
delQDateEdit->setToolTip(tr("Date of the deletion"));
delRbutton = new QRadioButton(tr("Deleted"), this);
QPushButton *closeButton = new QPushButton(tr("Cancel"));
QPushButton *okButton = new QPushButton(tr("OK"));
//qDebug() << "SetupEntityDialog::SetupEntityDialog - 2" << endl;
/*
connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
connect(okButton, SIGNAL(clicked()), this, SLOT(slotOkButtonClicked()));
connect(entityLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotCheckEntity() ) );
connect(mprefLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotCheckMainprefix() ) );
connect(cqLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotCheckCQz() ) );
connect(ituLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotCheckITUz() ) );
connect(contLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotCheckContinent() ) );
connect(latLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotCheckLatitude() ) );
connect(lonLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotCheckLongitude() ) );
connect(utcLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotCheckUTC() ) );
connect(arrlidLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotCheckARRLid() ) );
connect(delRbutton, SIGNAL(checked), this, SLOT(slotCheckDeleted() ) );
connect(delQDateEdit, SIGNAL(dateChanged), this, SLOT(slotCheckDeletedDate() ) );
connect(prefLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotCheckPrefixes() ) );
*/
//qDebug() << "SetupEntityDialog::SetupEntityDialog - 3" << endl;
QVBoxLayout *cqLayout = new QVBoxLayout;
cqLayout->addWidget(cqLabel);
cqLayout->addWidget(cqLineEdit);
QVBoxLayout *ituLayout = new QVBoxLayout;
ituLayout->addWidget(ituLabel);
ituLayout->addWidget(ituLineEdit);
QVBoxLayout *latLayout = new QVBoxLayout;
latLayout->addWidget(latLabel);
latLayout->addWidget(latLineEdit);
QVBoxLayout *lonLayout = new QVBoxLayout;
lonLayout->addWidget(lonLabel);
lonLayout->addWidget(lonLineEdit);
QHBoxLayout *posLayout = new QHBoxLayout;
posLayout->addLayout(cqLayout);
posLayout->addLayout(ituLayout);
posLayout->addLayout(latLayout);
posLayout->addLayout(lonLayout);
QVBoxLayout *utcLayout = new QVBoxLayout;
utcLayout->addWidget(utcLabel);
utcLayout->addWidget(utcLineEdit);
QVBoxLayout *arrlidLayout = new QVBoxLayout;
arrlidLayout->addWidget(arrlidLabel);
arrlidLayout->addWidget(arrlidLineEdit);
QVBoxLayout *delLayout = new QVBoxLayout;
delLayout->addWidget(delRbutton);
delLayout->addWidget(delQDateEdit);
QHBoxLayout *thirdLayout = new QHBoxLayout;
thirdLayout->addLayout(utcLayout);
thirdLayout->addLayout(arrlidLayout);
thirdLayout->addLayout(delLayout);
QVBoxLayout *prefLayout = new QVBoxLayout;
prefLayout->addWidget(prefLabel);
prefLayout->addWidget(prefLineEdit);
QGridLayout *dataLayout = new QGridLayout;
dataLayout->addWidget(entityLabel, 0, 0);
dataLayout->addWidget(entityLineEdit, 1, 0);
dataLayout->addWidget(mprefLabel, 0, 1);
dataLayout->addWidget(mprefLineEdit, 1, 1);
dataLayout->addLayout(posLayout, 2, 0, 2, -1);
dataLayout->addLayout(thirdLayout, 4, 0, 4, -1);
dataLayout->addLayout(prefLayout, 8, 0, 8, -1);
QHBoxLayout *buttonsLayout = new QHBoxLayout;
buttonsLayout->addStretch(1);
buttonsLayout->addWidget(okButton);
buttonsLayout->addWidget(closeButton);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addLayout(dataLayout);
mainLayout->addStretch(1);
mainLayout->addSpacing(12);
mainLayout->addLayout(buttonsLayout);
//qDebug() << "SetupEntityDialog::SetupEntityDialog - 3" << endl;
setLayout(mainLayout);
setWindowTitle(tr("Entity Dialog"));
//slotReadConfigData();
//*paletteOrig = cqLineEdit->palette();
//QPalette::ColorRole QWidget::foregroundRole () const;
pal = lonLineEdit->palette();
//qDebug() << "SetupEntityDialog::SetupEntityDialog: END" << endl;
}
SetupEntityDialog::~SetupEntityDialog()
{
//qDebug() << "SetupEntityDialog::~SetupEntityDialog " << endl;
}
void SetupEntityDialog::slotOkButtonClicked()
{
//qDebug() << "SetupEntityDialog::slotOkButtonClicked " << endl;
QStringList ql;
ql.clear();
if (entityBool && mainPrefixBool &&
cqBool &&
ituBool &&
contBool &&
latBool &&
lonBool &&
utcBool &&
arrlidBool &&
delBool &&
delDateBool &&
prefBool)
{
ql << checkEntity();
ql << checkMainprefix();
ql << checkContinent();
ql << checkCQz();
ql << checkITUz();
ql << checkLatitude();
ql << checkLongitude();
ql << checkUTC();
ql << checkARRLid();
ql << checkDeleted();
//ql << checkDeletedDate();
ql << checkPrefixes();
emit entityAdded(ql);
accept();
}
else
{
reject();
}
reject();
}
QString SetupEntityDialog::checkContinent()
{
//qDebug() << "SetupEntityDialog::checkContinent" << endl;
if(contBool)
{
return contLineEdit->text();
}
else
{
return "";
}
return "";
}
QString SetupEntityDialog::checkEntity()
{
//qDebug() << "SetupEntityDialog::checkEntity" << endl;
if(entityBool)
{
return entityLineEdit->text();
}
else
{
return "";
}
return "";
}
QString SetupEntityDialog::checkMainprefix()
{
//qDebug() << "SetupEntityDialog::checkMainprefix" << endl;
if(mainPrefixBool)
{
return mprefLineEdit->text();
}
else
{
return "";
}
return "";
}
QString SetupEntityDialog::checkCQz()
{
//qDebug() << "SetupEntityDialog::checkCQz" << endl;
if(cqBool)
{
return cqLineEdit->text();
}
else
{
return "";
}
return "";
}
QString SetupEntityDialog::checkITUz()
{
//qDebug() << "SetupEntityDialog::checkITUz" << endl;
if(ituBool)
{
return ituLineEdit->text();
}
else
{
return "";
}
return "";
}
QString SetupEntityDialog::checkLatitude()
{
//qDebug() << "SetupEntityDialog::checkLatitude" << endl;
if(latBool)
{
return latLineEdit->text();
}
else
{
return "";
}
return "";
}
QString SetupEntityDialog::checkLongitude()
{
//qDebug() << "SetupEntityDialog::checkLongitude" << endl;
if(lonBool)
{
return lonLineEdit->text();
}
else
{
return "";
}
return "";
}
QString SetupEntityDialog::checkUTC()
{
//qDebug() << "SetupEntityDialog::checkUTC" << endl;
if(utcBool)
{
return utcLineEdit->text();
}
else
{
return "";
}
return "";
}
QString SetupEntityDialog::checkARRLid()
{
//qDebug() << "SetupEntityDialog::checkARRLid" << endl;
if(arrlidBool)
{
return arrlidLineEdit->text();
}
else
{
return "";
}
return "";
}
QString SetupEntityDialog::checkDeleted()
{
//qDebug() << "SetupEntityDialog::checkDeleted" << endl;
if(delBool)
{
return "Y";
}
else
{
return "N";
}
return "";
}
QString SetupEntityDialog::checkDeletedDate()
{
//qDebug() << "SetupEntityDialog::checkDeletedDate" << endl;
if(delDateBool)
{
return "00/00/0000";
}
else
{
return "";
}
return "";
}
QString SetupEntityDialog::checkPrefixes()
{
//qDebug() << "SetupEntityDialog::checkPrefixes" << endl;
if(prefBool)
{
return prefLineEdit->text();
}
else
{
return "";
}
return "";
}
void SetupEntityDialog::slotCancelButtonClicked()
{
//qDebug() << "SetupEntityDialog::slotCancelButtonClicked " << endl;
reject();
}
void SetupEntityDialog::slotCheckEntity()
{
//qDebug() << "SetupEntityDialog::slotCheckEntity " << endl;
QString aux;
aux = entityLineEdit->text();
if (aux.length()>2)
{
entityBool = true;
entityLineEdit->setPalette(pal);
}
else
{
entityBool = false;
entityLineEdit->setPalette(palw);
}
}
void SetupEntityDialog::slotCheckMainprefix()
{
//qDebug() << "SetupEntityDialog::slotCheckMainprefix" << endl;
QString aux;
aux = mprefLineEdit->text();
if (aux.length()>0)
{
mprefLineEdit->setPalette(pal);
mainPrefixBool = true;
}
else
{
mainPrefixBool = false;
mprefLineEdit->setPalette(palw);
}
}
void SetupEntityDialog::slotCheckCQz()
{
//qDebug() << "SetupEntityDialog::slotCheckCQz" << endl;
QString aux;
aux = cqLineEdit->text();
if (aux.length()>0)
{
cqBool = true;
cqLineEdit->setPalette(pal);
}
else
{
cqBool = false;
cqLineEdit->setPalette(palw);
}
}
void SetupEntityDialog::slotCheckITUz()
{
//qDebug() << "SetupEntityDialog::slotCheckITUz" << endl;
QString aux;
aux = ituLineEdit->text();
if (aux.length()>0)
{
ituBool = true;
ituLineEdit->setPalette(pal);
}
else
{
ituBool = false;
ituLineEdit->setPalette(palw);
}
}
void SetupEntityDialog::slotCheckContinent()
{
//qDebug() << "SetupEntityDialog::slotCheckContinent" << endl;
QString aux;
aux = contLineEdit->text();
if (aux.length()>2)
{
contBool = true;
contLineEdit->setPalette(pal);
}
else
{
contBool = false;
contLineEdit->setPalette(palw);
}
}
void SetupEntityDialog::slotCheckLatitude()
{
//qDebug() << "SetupEntityDialog::slotCheckLatitude" << endl;
QString aux;
aux = latLineEdit->text();
if (aux.length()>0)
{
latBool = true;
latLineEdit->setPalette(pal);
}
else
{
latBool = false;
latLineEdit->setPalette(palw);
}
}
void SetupEntityDialog::slotCheckLongitude()
{
//qDebug() << "SetupEntityDialog::slotCheckLongitude" << endl;
QString aux;
aux = lonLineEdit->text();
if (aux.length()>3)
{
//lonLineEdit->setPalette(*paletteOrig);
lonBool = true;
lonLineEdit->setPalette(pal);
}
else
{
//lonLineEdit->setForegroundRole(QPalette::WindowText);
lonLineEdit->setPalette(palw);
//lonLineEdit->setPalette(*paletteWrong);
lonBool = false;
}
}
void SetupEntityDialog::slotCheckUTC()
{
//qDebug() << "SetupEntityDialog::slotCheckUTC" << endl;
QString aux;
aux = utcLineEdit->text();
if (aux.length()>0)
{
utcBool = true;
utcLineEdit->setPalette(pal);
}
else
{
utcBool = false;
utcLineEdit->setPalette(palw);
}
}
void SetupEntityDialog::slotCheckARRLid()
{
//qDebug() << "SetupEntityDialog::slotCheckARRLid" << endl;
QString aux;
aux = arrlidLineEdit->text();
// int n = aux.toInt();
if (aux.length()>0)
{
arrlidBool = false;
arrlidLineEdit->setPalette(pal);
}
else
{
arrlidBool = false;
arrlidLineEdit->setPalette(palw);
}
}
void SetupEntityDialog::slotCheckDeleted()
{
//qDebug() << "SetupEntityDialog::slotCheckDeleted" << endl;
if (delRbutton->isChecked())
{
delBool = true;
}
else
{
delBool = false;
}
}
void SetupEntityDialog::slotCheckDeletedDate()
{
//qDebug() << "SetupEntityDialog::slotCheckDeletedDate" << endl;
delDateBool = false;
//arrlidLineEdit->setPalette(palw);
}
void SetupEntityDialog::slotCheckPrefixes()
{
//qDebug() << "SetupEntityDialog::slotCheckPrefixes" << endl;
QString aux;
aux = prefLineEdit->text();
aux = aux.simplified();
QStringList list = aux.split(",", QString::SkipEmptyParts);
if (aux.length()>0)
{
prefBool = true;
prefLineEdit->setPalette(pal);
//"EA1, EA2, EA3"
}
else
{
prefBool = false;
prefLineEdit->setPalette(palw);
}
}

99
setupentitydialog.h Normal file
View File

@ -0,0 +1,99 @@
#ifndef SETUPENTITYDIALOG_H
#define SETUPENTITYDIALOG_H
/***************************************************************************
SetupEntityDialog.h - description
-------------------
begin : sept 2012
copyright : (C) 2012 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
//#include <QtWidgets>
#include <QtGui>
#include <QDialog>
#include <QPalette>
class SetupEntityDialog : public QDialog
{
Q_OBJECT
public:
SetupEntityDialog();
~SetupEntityDialog();
public slots:
private slots:
void slotOkButtonClicked();
void slotCancelButtonClicked();
void slotCheckEntity();
void slotCheckMainprefix();
void slotCheckCQz();
void slotCheckITUz();
void slotCheckContinent();
void slotCheckLatitude();
void slotCheckLongitude();
void slotCheckUTC();
void slotCheckARRLid();
void slotCheckDeleted();
void slotCheckDeletedDate();
void slotCheckPrefixes();
signals:
void entityAdded(const QStringList _qs); // entity
private:
QString checkEntity();
QString checkMainprefix();
QString checkCQz();
QString checkITUz();
QString checkContinent();
QString checkLatitude();
QString checkLongitude();
QString checkUTC();
QString checkARRLid();
QString checkDeleted();
QString checkDeletedDate();
QString checkPrefixes();
bool entityBool, mainPrefixBool, cqBool, ituBool, contBool;
bool latBool, lonBool, utcBool, arrlidBool, delBool, delDateBool, prefBool;
QLineEdit *entityLineEdit, *cqLineEdit, *ituLineEdit;
QLineEdit *contLineEdit, *latLineEdit, *lonLineEdit;
QLineEdit *utcLineEdit, *mprefLineEdit, *arrlidLineEdit;
QLineEdit *deletedLineEdit, *prefLineEdit;
QDateEdit *delQDateEdit;
QRadioButton *delRbutton;
QStringList entityData;
//QPalette *paletteOrig, *paletteWrong;
//QColor color;
QPalette pal, palw;
};
#endif // SetupEntityDialog_H

328
setuppagebandsmodes.cpp Normal file
View File

@ -0,0 +1,328 @@
/***************************************************************************
setuppagebandsmodes.cpp - description
-------------------
begin : sept 2011
copyright : (C) 2011 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
//#include <//qDebug>
#include "setuppagebandsmodes.h"
SetupPageBandsModes::SetupPageBandsModes(QWidget *parent) : QWidget(parent){
//qDebug() << "SetupPageBandsModes::SetupPageBandsModes" << endl;
// bandsWidget = new QWidget;
bandsNotActiveListWidget = new QListWidget(this);
bandsActiveListWidget = new QListWidget(this);
modesNotActiveListWidget = new QListWidget(this);
modesActiveListWidget = new QListWidget(this);
bandsNotActiveListWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
bandsActiveListWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
modesNotActiveListWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
modesActiveListWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
QGroupBox *bandsGroupBox = new QGroupBox(tr("Bands"));
QGroupBox *modesGroupBox = new QGroupBox(tr("Modes"));
QHBoxLayout *bandsLayout = new QHBoxLayout;
bandsLayout->addWidget(bandsNotActiveListWidget);
bandsLayout->addWidget(bandsActiveListWidget);
bandsLayout->addStretch(1);
bandsGroupBox->setLayout(bandsLayout);
QHBoxLayout *modesLayout = new QHBoxLayout;
modesLayout->addWidget(modesNotActiveListWidget);
modesLayout->addWidget(modesActiveListWidget);
modesLayout->addStretch(1);
modesGroupBox->setLayout(modesLayout);
bandSelPushButton = new QPushButton(tr("&Add Band"), this);;
bandUnSelPushButton = new QPushButton(tr("&Remove Band"), this);
modeSelPushButton = new QPushButton(tr("Add &Mode"), this);
modeUnSelPushButton = new QPushButton(tr("Remove M&ode"), this);;
QVBoxLayout *bandsButtonsLayout = new QVBoxLayout;
bandsButtonsLayout->addWidget(bandSelPushButton);
bandsButtonsLayout->addWidget(bandUnSelPushButton);
QVBoxLayout *modesButtonsLayout = new QVBoxLayout;
modesButtonsLayout->addWidget(modeSelPushButton);
modesButtonsLayout->addWidget(modeUnSelPushButton);
QHBoxLayout *bandsModesWidgetLayout = new QHBoxLayout;
bandsModesWidgetLayout->addWidget(bandsGroupBox);
bandsModesWidgetLayout->addLayout(bandsButtonsLayout);
bandsModesWidgetLayout->addWidget(modesGroupBox);
bandsModesWidgetLayout->addLayout(modesButtonsLayout);
QSqlQuery query("SELECT name FROM band");
while (query.next()) {
if (query.isValid()){
bands << query.value(0).toString();
}
}
QSqlQuery query1("SELECT name FROM mode");
while (query1.next()) {
if (query1.isValid())
{
modes << query1.value(0).toString();
}
}
bandsNotActiveListWidget->addItems(bands);
modesNotActiveListWidget->addItems(modes);
setLayout(bandsModesWidgetLayout);
connect(bandsNotActiveListWidget, SIGNAL(itemDoubleClicked ( QListWidgetItem * )), this, SLOT(slotBandActiveItemDoubleClicked ( QListWidgetItem * ) ) );
connect(bandsActiveListWidget, SIGNAL(itemDoubleClicked ( QListWidgetItem * )), this, SLOT(slotBandNotActiveItemDoubleClicked ( QListWidgetItem * ) ) );
connect(bandSelPushButton, SIGNAL(clicked ( )), this, SLOT(slotBandSelButtonClicked ( ) ) );
connect(bandUnSelPushButton, SIGNAL(clicked ( )), this, SLOT(slotBandUnSelButtonClicked ( ) ) );
connect(modeSelPushButton, SIGNAL(clicked ( )), this, SLOT(slotModeSelButtonClicked ( ) ) );
connect(modeUnSelPushButton, SIGNAL(clicked ( )), this, SLOT(slotModeUnSelButtonClicked ( ) ) );
//connect(logView, SIGNAL(doubleClicked ( const QModelIndex& ) ), this, SLOT(slotDoubleClickLog( const QModelIndex& ) ) );
}
SetupPageBandsModes::~SetupPageBandsModes(){
//qDebug() << "SetupPageBandsModes::~SetupPageBandsModes" << endl;
}
void SetupPageBandsModes::createActions(){
//void itemDoubleClicked ( QListWidgetItem * item )
}
void SetupPageBandsModes::slotBandActiveItemDoubleClicked ( QListWidgetItem * item ){
//qDebug() << "SetupPageBandsModes::slotBandActiveItemDoubleClicked" << item->text() << endl;
bandsActiveListWidget->addItem(item->text());
//bandsActiveListWidget->removeItemWidget(item->cur);
}
void SetupPageBandsModes::slotBandNotActiveItemDoubleClicked ( QListWidgetItem * item ){
//qDebug() << "SetupPageBandsModes::slotBandNotActiveItemDoubleClicked" << item->text() << endl;
//bandsNotActiveListWidget->addItem(itemitem->text());
//bandsNotActiveListWidget->removeItemWidget(item);
}
void SetupPageBandsModes::slotBandSelButtonClicked(){
//qDebug() << "SetupPageBandsModes::slotBandSelButtonClicked" << endl;
QListWidgetItem *it;
for (int i = 0; i < bandsNotActiveListWidget->count(); i++)
{
it = bandsNotActiveListWidget->item(i);
if( (*it).isSelected() )
{
bandsActiveListWidget->addItem((it)->text());
bandsNotActiveListWidget->takeItem(i);
i--;
}
else
{
}
}
};
void SetupPageBandsModes::slotBandUnSelButtonClicked(){
//qDebug() << "SetupPageBandsModes::slotBandUnSelButtonClicked" << endl;
QListWidgetItem *it;
for (int i = 0; i < bandsActiveListWidget->count(); i++)
{
it = bandsActiveListWidget->item(i);
if( (*it).isSelected() )
{
bandsNotActiveListWidget->addItem((it)->text());
bandsActiveListWidget->takeItem(i);
i--;
}
else
{
}
}
};
void SetupPageBandsModes::slotModeSelButtonClicked(){
//qDebug() << "SetupPageBandsModes::slotModeSelButtonClicked" << endl;
QListWidgetItem *it;
for (int i = 0; i < modesNotActiveListWidget->count(); i++)
{
it = modesNotActiveListWidget->item(i);
if( (*it).isSelected() )
{
modesActiveListWidget->addItem((it)->text());
modesNotActiveListWidget->takeItem(i);
i--;
}
else
{
}
}
};
void SetupPageBandsModes::slotModeUnSelButtonClicked(){
//qDebug() << "SetupPageBandsModes::slotModeUnSelButtonClicked" << endl;
QListWidgetItem *it;
for (int i = 0; i < modesActiveListWidget->count(); i++)
{
it = modesActiveListWidget->item(i);
if( (*it).isSelected() )
{
modesNotActiveListWidget->addItem((it)->text());
modesActiveListWidget->takeItem(i);
i--;
}
else
{
}
}
};
QString SetupPageBandsModes::getBands()
{
//qDebug() << "SetupPageBandsModes::getBands" << endl;
QString b;
QListWidgetItem *it;
if ( (bandsActiveListWidget->count()) < 1)
{
return "";
}
for (int i = 0; i < bandsActiveListWidget->count(); i++)
{
it = bandsActiveListWidget->item(i);
b = b + it->text();
b = b + ", ";
}
if (b.size()<2)
{
}else
{
b.chop(2);
}
//qDebug() << "SetupPageBandsModes::getBands: " << b << endl;
return b;
}
QString SetupPageBandsModes::getModes()
{
//qDebug() << "SetupPageBandsModes::getModes" << endl;
QString b;
QListWidgetItem *it;
if ( (modesActiveListWidget->count()) < 1)
{
return "";
}
for (int i = 0; i < modesActiveListWidget->count(); i++)
{
it = modesActiveListWidget->item(i);
b = b + it->text();
b = b + ", ";
}
if (b.size()<2)
{
}else
{
b.chop(2);
}
//qDebug() << "SetupPageBandsModes::getModes: " << b << endl;
return b;
}
void SetupPageBandsModes::setActiveBands(QStringList q)
{
QListWidgetItem *it, *itn;
bandsActiveListWidget->addItems(q);
for (int i = 0; i < bandsActiveListWidget->count(); i++)
{
it = bandsActiveListWidget->item(i);
for (int j = 0; j < bandsNotActiveListWidget->count(); j++)
{
itn = bandsNotActiveListWidget->item(j);
if ( (itn->text()) == (it->text()) )
{
bandsNotActiveListWidget->takeItem(j);
}
}
}
}
void SetupPageBandsModes::setActiveModes(QStringList q)
{
QListWidgetItem *it, *itn;
modesActiveListWidget->addItems(q);
for (int i = 0; i < modesActiveListWidget->count(); i++)
{
it = modesActiveListWidget->item(i);
for (int j = 0; j < modesNotActiveListWidget->count(); j++)
{
itn = modesNotActiveListWidget->item(j);
if ( (itn->text()) == (it->text()) )
{
modesNotActiveListWidget->takeItem(j);
}
}
}
}

71
setuppagebandsmodes.h Normal file
View File

@ -0,0 +1,71 @@
#ifndef SETUPPAGEBANDSMODES_H
#define SETUPPAGEBANDSMODES_H
/***************************************************************************
setuppagebandsmodes.h - description
-------------------
begin : sept 2011
copyright : (C) 2011 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
//#include <QtWidgets>
#include <QtGui>
#include <QSqlQuery>
#include <QStringList>
#include <QListWidget>
class SetupPageBandsModes : public QWidget {
Q_OBJECT
public:
SetupPageBandsModes(QWidget *parent=0);
~SetupPageBandsModes();
QString getBands(); // 10m, 12m, 15m
QString getModes(); //ssb, CW
void setActiveBands(QStringList q);
void setActiveModes(QStringList q);
private slots:
void slotBandActiveItemDoubleClicked ( QListWidgetItem * item );
void slotBandNotActiveItemDoubleClicked ( QListWidgetItem * item );
void slotBandSelButtonClicked( );
void slotBandUnSelButtonClicked( );
void slotModeSelButtonClicked( );
void slotModeUnSelButtonClicked( );
private:
void createActions();
//QWidget *bandsWidget;
QListWidget *bandsNotActiveListWidget, *bandsActiveListWidget;
QListWidget *modesNotActiveListWidget, *modesActiveListWidget;
QStringList bands, modes;
QPushButton *bandSelPushButton, *bandUnSelPushButton, *modeSelPushButton, *modeUnSelPushButton;
//QCheckBox *10m;
};
#endif // SETUPPAGEBANDSMODES_H

210
setuppagecolors.cpp Normal file
View File

@ -0,0 +1,210 @@
/***************************************************************************
setuppagecolors.cpp - description
-------------------
begin : nov 2011
copyright : (C) 2011 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
//#include <QDebug>
#include "setuppagecolors.h"
SetupPageColors::SetupPageColors(QWidget *parent) : QWidget(parent)
{
//Debug() << "SetupPageColors::SetupPageColors" << endl;
newOneColorButton = new QPushButton;
neededColorButton = new QPushButton;
workedColorButton = new QPushButton;
confirmedColorButton = new QPushButton;
defaultColorButton = new QPushButton;
newOneColorButton->setText(tr("New One"));
neededColorButton->setText(tr("Needed in this band"));
workedColorButton->setText(tr("Worked in this band"));
confirmedColorButton->setText(tr("Confirmed in this band"));
defaultColorButton->setText(tr("Default"));
newOneColorButton->setAutoFillBackground ( true );
QVBoxLayout *buttonsLayout = new QVBoxLayout;
buttonsLayout->addWidget(newOneColorButton);
buttonsLayout->addWidget(neededColorButton);
buttonsLayout->addWidget(workedColorButton);
buttonsLayout->addWidget(confirmedColorButton);
buttonsLayout->addWidget(defaultColorButton);
setLayout(buttonsLayout);
connect(newOneColorButton, SIGNAL(clicked()), this, SLOT(slotNewOneColorButtonClicked()) );
connect(neededColorButton, SIGNAL(clicked()), this, SLOT(slotNeededColorButtonClicked()) );
connect(workedColorButton, SIGNAL(clicked()), this, SLOT(slotWorkedColorButtonClicked()) );
connect(confirmedColorButton, SIGNAL(clicked()), this, SLOT(slotConfirmedColorButtonClicked()) );
connect(defaultColorButton, SIGNAL(clicked()), this, SLOT(slotDefaultColorButtonClicked()) );
setNewOneColor("#FF0000");
setNeededColor("#FF8C00");
setWorkedColor("#FFD700");
setConfirmedColor("#32CD32");
setDefaultColor("#00BFFF");
}
SetupPageColors::~SetupPageColors()
{;
}
void SetupPageColors::slotNewOneColorButtonClicked()
{
//qDebug() << "SetupPageColors::slotNewOneColorButtonClicked " << endl;
QString style = "* { background-color: ";
style = style + (giveColor(newOneColorButton->palette().color(QPalette::Button))).name();
style = style + "; }";
newOneColorButton->setStyleSheet(style);
}
void SetupPageColors::slotNeededColorButtonClicked ()
{
//qDebug() << "SetupPageColors::slotNeededColorButtonClicked " << endl;
QString style = "* { background-color: ";
style = style + (giveColor(neededColorButton->palette().color(QPalette::Button))).name();
style = style + "; }";
neededColorButton->setStyleSheet(style);
}
void SetupPageColors::slotWorkedColorButtonClicked ()
{
//qDebug() << "SetupPageColors::slotWorkedColorButtonClicked " << endl;
QString style = "* { background-color: ";
style = style + (giveColor(workedColorButton->palette().color(QPalette::Button))).name();
style = style + "; }";
workedColorButton->setStyleSheet(style);
}
void SetupPageColors::slotConfirmedColorButtonClicked ()
{
//qDebug() << "SetupPageColors::slotNeededColorButtonClicked " << endl;
QString style = "* { background-color: ";
style = style + (giveColor(confirmedColorButton->palette().color(QPalette::Button))).name();
style = style + "; }";
confirmedColorButton->setStyleSheet(style);
}
void SetupPageColors::slotDefaultColorButtonClicked()
{
//qDebug() << "SetupPageColors::slotDefaultColorButtonClicked " << endl;
QString style = "* { background-color: ";
style = style + (giveColor(defaultColorButton->palette().color(QPalette::Button))).name();
style = style + "; }";
defaultColorButton->setStyleSheet(style);
}
QColor SetupPageColors::giveColor (QColor c)
{
// Receives the actual color, shows the user a color picker and returns the color that the user selects.
QColor colorb;
color = c;
colorb = color;
color = QColorDialog::getColor (color, this, tr("Choose a color"));
if (color.isValid ())
{
//qDebug() << "SetupPageColors::giveColor valid color: " << color.name() << endl;
return color;
}
else
{
//qDebug() << "SetupPageColors::giveColor NOT valid color" << endl;
return colorb;
}
}
QString SetupPageColors::getNewOneColor()
{
//qDebug() << "SetupPageColors::getNewOneColor: " << (newOneColorButton->palette().color(QPalette::Button)).name() << endl;
return (newOneColorButton->palette().color(QPalette::Button)).name();
}
QString SetupPageColors::getNeededColor()
{
return (neededColorButton->palette().color(QPalette::Button)).name();
}
QString SetupPageColors::getWorkedColor()
{
return (workedColorButton->palette().color(QPalette::Button)).name();
}
QString SetupPageColors::getConfirmedColor()
{
return (confirmedColorButton->palette().color(QPalette::Button)).name();
}
QString SetupPageColors::getDefaultColor()
{
return (defaultColorButton->palette().color(QPalette::Button)).name();
}
void SetupPageColors::setNewOneColor(const QString c)
{
QString style = "* { background-color: ";
style = style + c;
style = style + "; }";
newOneColorButton->setStyleSheet(style);
}
void SetupPageColors::setNeededColor(const QString c)
{
QString style = "* { background-color: ";
style = style + c;
style = style + "; }";
neededColorButton->setStyleSheet(style);
}
void SetupPageColors::setWorkedColor(const QString c)
{
QString style = "* { background-color: ";
style = style + c;
style = style + "; }";
workedColorButton->setStyleSheet(style);
}
void SetupPageColors::setConfirmedColor(const QString c)
{
QString style = "* { background-color: ";
style = style + c;
style = style + "; }";
confirmedColorButton->setStyleSheet(style);
}
void SetupPageColors::setDefaultColor(const QString c)
{
QString style = "* { background-color: ";
style = style + c;
style = style + "; }";
defaultColorButton->setStyleSheet(style);
}

85
setuppagecolors.h Normal file
View File

@ -0,0 +1,85 @@
#ifndef SETUPPAGECOLORS_H
#define SETUPPAGECOLORS_H
/***************************************************************************
setuppagecolors.h - description
-------------------
begin : nov 2011
copyright : (C) 2011 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
//#include <QtWidgets>
//#include <QPalette>
#include <QtGui>
class SetupPageColors : public QWidget {
Q_OBJECT
public:
SetupPageColors(QWidget *parent=0);
~SetupPageColors();
QString getNewOneColor();
QString getNeededColor();
QString getWorkedColor();
QString getConfirmedColor();
QString getDefaultColor();
void setNewOneColor(const QString c);
void setNeededColor(const QString c);
void setWorkedColor(const QString c);
void setConfirmedColor(const QString c);
void setDefaultColor(const QString c);
private slots:
void slotNewOneColorButtonClicked();
void slotConfirmedColorButtonClicked();
void slotWorkedColorButtonClicked();
void slotNeededColorButtonClicked();
void slotDefaultColorButtonClicked();
private:
QColor giveColor (QColor c);
QPalette palette;
QPushButton *newOneColorButton; // In ANY band
QPushButton *neededColorButton; // In this band
QPushButton *workedColorButton; // In this band
QPushButton *confirmedColorButton; // In this band
QPushButton *defaultColorButton; // In this band
QColor color;
/*
0 - New one.
1 - Worked but not confirmed: New one in this band.
2 - Worked but not confirmed: Worked in this band.
3 - Confirmed: New one in this band.
4 - Confirmed: Worked in this band.
5 - Confirmed: Confirmed in this band.
*/
};
#endif // SETUPPAGECOLORS_H

513
setuppagedxcluster.cpp Normal file
View File

@ -0,0 +1,513 @@
/***************************************************************************
setuppagedxcluster.cpp - description
-------------------
begin : nov 2011
copyright : (C) 2011 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
//#include <QDebug>
#include "setuppagedxcluster.h"
SetupPageDxCluster::SetupPageDxCluster(QWidget *parent) : QWidget(parent)
{
//qDebug() << "SetupPageDxCluster::SetupPageDxCluster" << endl;
//xClusterServers = new QStringList;
//dxClusterServers << "dxfun.com:8000";
dxclusterServersComboBox = new QComboBox;
dxclusterServersComboBox->addItem("dxfun.com:8000");
addClusterButton = new QPushButton;
deleteClusterButton = new QPushButton;
showHFRadiobutton = new QRadioButton;
showVHFRadiobutton = new QRadioButton;
showWARCRadiobutton = new QRadioButton;
showWorkedRadiobutton = new QRadioButton;
showConfirmedRadiobutton = new QRadioButton;
showANNRadiobutton = new QRadioButton;
showWWVRadiobutton = new QRadioButton;
showWCYRadiobutton = new QRadioButton;
saveAllDXClusterDataRadiobutton = new QRadioButton;
showHFRadiobutton->setAutoExclusive(false);
showVHFRadiobutton->setAutoExclusive(false);
showWARCRadiobutton->setAutoExclusive(false);
showWorkedRadiobutton->setAutoExclusive(false);
showConfirmedRadiobutton->setAutoExclusive(false);
showANNRadiobutton->setAutoExclusive(false);
showWWVRadiobutton->setAutoExclusive(false);
showWCYRadiobutton->setAutoExclusive(false);
showHFRadiobutton->setChecked(true);
showVHFRadiobutton->setChecked(true);
showWARCRadiobutton->setChecked(true);
showWorkedRadiobutton->setChecked(true);
showConfirmedRadiobutton->setChecked(true);
showANNRadiobutton->setChecked(true);
showWWVRadiobutton->setChecked(true);
showWCYRadiobutton->setChecked(true);
addClusterButton->setText(tr("Add"));
deleteClusterButton->setText(tr("Delete"));
showHFRadiobutton->setText(tr("Show HF spots"));
showVHFRadiobutton->setText(tr("Show V/UHF spots"));
showWARCRadiobutton->setText(tr("Show WARC spots"));
showWorkedRadiobutton->setText(tr("Show worked spots"));
showConfirmedRadiobutton->setText(tr("Show confirmed spots"));
showANNRadiobutton->setText(tr("Show ANN/FULL messages"));
showWWVRadiobutton->setText(tr("Show WWV messages"));
showWCYRadiobutton->setText(tr("Show WCY messages"));
QGroupBox *spotsGroupBox = new QGroupBox(tr("DX Spots"));
QVBoxLayout *spotsVBoxLayout = new QVBoxLayout;
spotsVBoxLayout->addWidget(showHFRadiobutton);
spotsVBoxLayout->addWidget(showVHFRadiobutton);
spotsVBoxLayout->addWidget(showWARCRadiobutton);
spotsVBoxLayout->addWidget(showWorkedRadiobutton);
spotsVBoxLayout->addWidget(showConfirmedRadiobutton);
spotsVBoxLayout->addStretch(1);
spotsGroupBox->setLayout(spotsVBoxLayout);
QGroupBox *messagesGroupBox = new QGroupBox(tr("Messages"));
QVBoxLayout *messagesVBoxLayout = new QVBoxLayout;
messagesVBoxLayout->addWidget(showANNRadiobutton);
messagesVBoxLayout->addWidget(showWWVRadiobutton);
messagesVBoxLayout->addWidget(showWCYRadiobutton);
messagesVBoxLayout->addStretch(1);
messagesGroupBox->setLayout(messagesVBoxLayout);
// ( QWidget * widget, int fromRow, int fromColumn, int rowSpan,
//int columnSpan, Qt::Alignment alignment = 0 )
QHBoxLayout *serversButtonsLayout = new QHBoxLayout;
serversButtonsLayout->addSpacerItem(new QSpacerItem(10,0,QSizePolicy::Expanding,QSizePolicy::Maximum));
serversButtonsLayout->addWidget(addClusterButton);
serversButtonsLayout->addWidget(deleteClusterButton);
QVBoxLayout *serversLayout = new QVBoxLayout;
serversLayout->addWidget(dxclusterServersComboBox);
serversLayout->addLayout(serversButtonsLayout);
QGridLayout *mainLayout = new QGridLayout;
mainLayout->addLayout(serversLayout, 0, 0);
mainLayout->addWidget(spotsGroupBox, 1, 0);
mainLayout->addWidget(messagesGroupBox, 1, 1);
setLayout(mainLayout);
createActions();
}
SetupPageDxCluster::~SetupPageDxCluster()
{
//qDebug() << "SetupPageDxCluster::~SetupPageDxCluster" << endl;
}
void SetupPageDxCluster::createActions()
{
//qDebug() << "SetupPageDxCluster::createActions" << endl;
connect(addClusterButton, SIGNAL(clicked()), this, SLOT(slotAddButtonClicked()) );
connect(deleteClusterButton, SIGNAL(clicked()), this, SLOT(slotDeleteButtonClicked()) );
}
void SetupPageDxCluster::slotAddButtonClicked()
{
//qDebug() << "SetupPageDxCluster::slotAddButtonClicked" << endl;
bool ok;
ok = false;
while (!ok)
{
QString text = QInputDialog::getText (this,
tr("KLog: Add a DXCluster server"),
tr("Add the address followed by the :port\nExample: dxfun.com:8000\nIf no port is specified, 41112 will be used by default:"),
QLineEdit::Normal, QString::null,
&ok);
if (ok && !text.isEmpty ())
{
if (checkIfValidDXCluster (text))
{
if (checkIfNewDXCluster (text))
{
ok = true;
if ((text.contains (":")) == 0)
{
text = text + ":41112";
}
dxclusterServersComboBox->insertItem (0, text);
}
else
{
ok = false;
}
}
else
{
ok = false;
}
}
else
{
// user entered nothing or pressed Cancel
ok = true;
}
}
}
void SetupPageDxCluster::slotDeleteButtonClicked()
{
//qDebug() << "SetupPageDxCluster::slotDeleteButtonClicked" << endl;
dxclusterServersComboBox->removeItem (dxclusterServersComboBox->currentIndex ());
}
bool SetupPageDxCluster::checkIfValidDXCluster (const QString & tdxcluster)
{
QUrl url ("http://" + tdxcluster);
if ((!url.host ().isEmpty ()) || (url.port () != -1))
{
return true;
}
else
{
return false;
}
}
bool SetupPageDxCluster::checkIfNewDXCluster (const QString & tdxcluster) {
//qDebug() << "checkIfNewDXCluster: -" << tdxcluster << "-"<< endl;
int numberOfDXClusterServers = dxclusterServersComboBox->count ();
for (int i = 0; i <= numberOfDXClusterServers - 1; i++)
{
if ((dxclusterServersComboBox->currentText ()) == (tdxcluster))
{
return false;
}
else
{
return true;
}
dxclusterServersComboBox->setCurrentIndex(i);
}
return true;
}
QStringList SetupPageDxCluster::getDxclusterServersComboBox()
{
//qDebug() << "SetupPageDxCluster::getDxclusterServersComboBox" << endl;
QStringList servers;
int numberOfDXClusterServers = dxclusterServersComboBox->count ();
servers.clear();
if(numberOfDXClusterServers>=1)
{
//stream << "DXClusterServerToUse=" << dxclusterServersComboBox->currentText () << endl;
//servers << dxclusterServersComboBox->currentText ();
for (int i = 0; i <= numberOfDXClusterServers - 1; i++)
{
dxclusterServersComboBox->setCurrentIndex (i);
servers << dxclusterServersComboBox->currentText ();
//stream << "DXClusterServerPort=" << dxclusterServersComboBox->currentText () << endl;
}
}
return servers;
}
void SetupPageDxCluster::setDxclusterServersComboBox(const QStringList t)
{
//qDebug() << "SetupPageDxCluster::setDxclusterServersComboBox" << endl;
if (t.count()>0)
{
QString text;
for (int i=0; i < t.count(); i++)
{
text.clear();
text = t.at(i);
if (checkIfValidDXCluster (text))
{
if (checkIfNewDXCluster (text))
{
if ((text.contains (":")) == 0)
{
text = text + ":41112";
}
dxclusterServersComboBox->insertItem (0, text);
}
else
{
// Not added
}
}
}
}
}
QString SetupPageDxCluster::getShowHFRadiobutton()
{
if (showHFRadiobutton->isChecked())
{
return "True";
}
else
{
return "False";
}
}
QString SetupPageDxCluster::getShowVHFRadiobutton()
{
if (showVHFRadiobutton->isChecked())
{
return "True";
}
else
{
return "False";
}
}
QString SetupPageDxCluster::getShowWARCRadiobutton()
{
if (showWARCRadiobutton->isChecked())
{
return "True";
}
else
{
return "False";
}
}
QString SetupPageDxCluster::getShowWorkedRadiobutton()
{
if (showWorkedRadiobutton->isChecked())
{
return "True";
}
else
{
return "False";
}
}
QString SetupPageDxCluster::getShowConfirmedRadiobutton()
{
if (showConfirmedRadiobutton->isChecked())
{
return "True";
}
else
{
return "False";
}
}
QString SetupPageDxCluster::getShowANNRadiobutton()
{
if (showANNRadiobutton->isChecked())
{
return "True";
}
else
{
return "False";
}
}
QString SetupPageDxCluster::getShowWWVRadiobutton()
{
if (showWWVRadiobutton->isChecked())
{
return "True";
}
else
{
return "False";
}
}
QString SetupPageDxCluster::getShowWCYRadiobutton()
{
if (showWCYRadiobutton->isChecked())
{
return "True";
}
else
{
return "False";
}
}
void SetupPageDxCluster::setShowHFRadiobutton(const QString t)
{
if ( (t.toUpper()) == "FALSE")
{
showHFRadiobutton->setChecked(false);
}
else
{
showHFRadiobutton->setChecked(true);
}
}
void SetupPageDxCluster::setShowVHFRadiobutton(const QString t)
{
if ( (t.toUpper()) == "FALSE")
{
showVHFRadiobutton->setChecked(false);
}
else
{
showVHFRadiobutton->setChecked(true);
}
}
void SetupPageDxCluster::setShowWARCRadiobutton(const QString t)
{
if ( (t.toUpper()) == "FALSE")
{
showWARCRadiobutton->setChecked(false);
}
else
{
showWARCRadiobutton->setChecked(true);
}
}
void SetupPageDxCluster::setShowWorkedRadiobutton(const QString t)
{
if ( (t.toUpper()) == "FALSE")
{
showWorkedRadiobutton->setChecked(false);
}
else
{
showWorkedRadiobutton->setChecked(true);
}
}
void SetupPageDxCluster::setShowConfirmedRadiobutton(const QString t)
{
if ( (t.toUpper()) == "FALSE")
{
showConfirmedRadiobutton->setChecked(false);
}
else
{
showConfirmedRadiobutton->setChecked(true);
}
}
void SetupPageDxCluster::setShowANNRadiobutton(const QString t)
{
if ( (t.toUpper()) == "FALSE")
{
showANNRadiobutton->setChecked(false);
}
else
{
showANNRadiobutton->setChecked(true);
}
}
void SetupPageDxCluster::setShowWWVRadiobutton(const QString t)
{
if ( (t.toUpper()) == "FALSE")
{
showWWVRadiobutton->setChecked(false);
}
else
{
showWWVRadiobutton->setChecked(true);
}
}
void SetupPageDxCluster::setShowWCYRadiobutton(const QString t)
{
if ( (t.toUpper()) == "FALSE")
{
showWCYRadiobutton->setChecked(false);
}
else
{
showWCYRadiobutton->setChecked(true);
}
}
QString SetupPageDxCluster::getSelectedDxClusterServer()
{
//return dxclusterServersComboBox->currentText();
int dxclusterServerListItems = dxclusterServersComboBox->count ();
if (dxclusterServerListItems >= 1)
{
return dxclusterServersComboBox->currentText ();
}
else
{
return QString::null;
}
return QString::null;
}
void SetupPageDxCluster::setSelectedDxClusterServer(const QString t)
{
dxclusterServersComboBox->setCurrentIndex(dxclusterServersComboBox->findText(t));
}

98
setuppagedxcluster.h Normal file
View File

@ -0,0 +1,98 @@
#ifndef SETUPPAGEDXCLUSTER_H
#define SETUPPAGEDXCLUSTER_H
/***************************************************************************
setuppagedxcluster.h - description
-------------------
begin : nov 2011
copyright : (C) 2011 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
//#include <QtWidgets>
//#include <QSqlQuery>
//#include <QStringList>
//#include <QListWidget>
#include <QtGui>
class SetupPageDxCluster : public QWidget {
Q_OBJECT
public:
SetupPageDxCluster(QWidget *parent=0);
~SetupPageDxCluster();
QStringList getDxclusterServersComboBox();
void setDxclusterServersComboBox(const QStringList t);
QString getSelectedDxClusterServer();
void setSelectedDxClusterServer(const QString t);
QString getShowHFRadiobutton();
QString getShowVHFRadiobutton();
QString getShowWARCRadiobutton();
QString getShowWorkedRadiobutton();
QString getShowConfirmedRadiobutton();
QString getShowANNRadiobutton();
QString getShowWWVRadiobutton();
QString getShowWCYRadiobutton();
void setShowHFRadiobutton(const QString t);
void setShowVHFRadiobutton(const QString t);
void setShowWARCRadiobutton(const QString t);
void setShowWorkedRadiobutton(const QString t);
void setShowConfirmedRadiobutton(const QString t);
void setShowANNRadiobutton(const QString t);
void setShowWWVRadiobutton(const QString t);
void setShowWCYRadiobutton(const QString t);
private slots:
void slotAddButtonClicked();
void slotDeleteButtonClicked();
private:
void createActions();
bool checkIfValidDXCluster (const QString &tdxcluster);
bool checkIfNewDXCluster (const QString &tdxcluster);
QComboBox *dxclusterServersComboBox;
QPushButton *addClusterButton;
QPushButton *deleteClusterButton;
QRadioButton *showHFRadiobutton;
QRadioButton *showVHFRadiobutton;
QRadioButton *showWARCRadiobutton;
QRadioButton *showWorkedRadiobutton;
QRadioButton *showConfirmedRadiobutton;
QRadioButton *showANNRadiobutton;
QRadioButton *showWWVRadiobutton;
QRadioButton *showWCYRadiobutton;
QRadioButton *saveAllDXClusterDataRadiobutton;
//QStringList dxClusterServers;
};
#endif // SETUPPAGEDXCLUSTER_H

542
setuppagelogs.cpp Normal file
View File

@ -0,0 +1,542 @@
/***************************************************************************
setuppagelogs.cpp - description
-------------------
begin : feb 2012
copyright : (C) 2012 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
//#include <QDebug>
#include "setuppagelogs.h"
SetupPageLogs::SetupPageLogs(QWidget *parent) : QWidget(parent){
//qDebug() << "SetupPageLogs::SetupPageLogs" << endl;
stationCallsignFilled = false;
operatorsFilled = true;
logsModel = new QSqlRelationalTableModel(this);
logsView = new QTableView;
logsView->setContextMenuPolicy(Qt::CustomContextMenu);
logsView->setSortingEnabled(true);
createLogsModel();
createLogsPanel();
logsView->setCurrentIndex(logsModel->index(0, 0));
lastLog = 0;
newLogPushButton = new QPushButton(tr("New"), this);
//loadAllPushButton = new QPushButton(tr("Load All"), this);
//loadSelectedPushButton = new QPushButton(tr("Load"), this);
//clearPushButton = new QPushButton(tr("Clear"), this);
editPushButton = new QPushButton(tr("Edit"), this);
removePushButton = new QPushButton(tr("Remove"), this);
newLogPushButton->setToolTip(tr("Add a new log"));
//loadAllPushButton->setToolTip(tr("Load all the logs"));
//loadSelectedPushButton->setToolTip(tr("Load only the selected log"));
//clearPushButton->setToolTip(tr("Clear selection"));
editPushButton->setToolTip(tr("Edit the selected log"));
removePushButton->setToolTip(tr("Remove the selected log"));
QHBoxLayout *buttonsLayout = new QHBoxLayout;
buttonsLayout->addWidget(newLogPushButton);
//buttonsLayout->addWidget(loadSelectedPushButton);
//buttonsLayout->addWidget(loadAllPushButton);
buttonsLayout->addWidget(editPushButton);
buttonsLayout->addWidget(removePushButton);
//buttonsLayout->addWidget(clearPushButton);
QVBoxLayout *widgetLayout = new QVBoxLayout;
widgetLayout->addWidget(logsView);
widgetLayout->addLayout(buttonsLayout);
//widgetLayout->addLayout(logDataLayout);
setLayout(widgetLayout);
//connect(newLogPushButton, SIGNAL(clicked ( )), this, SLOT(slotNewButtonClicked() ) );
// readLogs();
createActions();
}
SetupPageLogs::~SetupPageLogs(){
////qDebug() << "SetupPageLogs::~SetupPageLogs" << endl;
}
QWizardPage *SetupPageLogs::createLogTypePage()
{
QWizardPage *page = new QWizardPage;
page->setTitle(tr("New Log"));
QLabel *stationCallsignLabel = new QLabel(tr("StationCallsign"));
stationCallsignLabel->setWordWrap(true);
QLabel *operatorsLabel = new QLabel(tr("Operators"));
operatorsLabel->setWordWrap(true);
stationCallsignLineEdit = new QLineEdit;
operatorsLineEdit = new QLineEdit;
nameLineEdit = new QLineEdit;
dateEdit = new QDateEdit;
stationCallsignLineEdit->setToolTip(tr("Callsign used for this log"));
operatorsLineEdit->setToolTip(tr("Comma separated list of operators: callsign1, callsign2"));
nameLineEdit->setToolTip(tr("Your name or the station's responsible"));
dateEdit->setToolTip(tr("Start date of this log"));
//callsLayout->addSpacerItem(new QSpacerItem(10,0,QSizePolicy::Expanding,QSizePolicy::Maximum));
QLabel *typeLabel = new QLabel(tr("Type of Operation"));
typeLabel->setWordWrap(true);
QLabel *nameLabel = new QLabel(tr("Name"));
nameLabel->setWordWrap(true);
QLabel *dateLabel = new QLabel(tr("Date"));
dateLabel->setWordWrap(true);
typeComboBox = new QComboBox;
contestCatModeComboBox = new QComboBox;
contestCatOperatorsComboBox = new QComboBox;
contestCatAssistedComboBox = new QComboBox;
contestCatPowerComboBox = new QComboBox;
contestCatBandsComboBox = new QComboBox;
contestBandsComboBox = new QComboBox;
typeComboBox->setToolTip(tr("Select the kind of operation for this log"));
QStringList _qs;
_qs.clear();
_qs << "DX" << "CQ-WW-SSB" << "CQ-WW-CW" << "CQ-WPX-SSB" << "CQ-WPX-CW" ;
typeComboBox->addItems(_qs);
QLabel *catModeLabel = new QLabel(tr("Mode Category"));
catModeLabel->setWordWrap(true);
contestCatModeComboBox->setToolTip(tr("Select the mode category"));
_qs.clear();
_qs << "SSB" << "CW" << "MIXED";
contestCatModeComboBox->addItems(_qs);
QLabel *catOpLabel = new QLabel(tr("Operators Category"));
catOpLabel->setWordWrap(true);
contestCatOperatorsComboBox->setToolTip(tr("Select the operators category"));
_qs.clear();
_qs << "SINGLE" << "MULTI";
contestCatOperatorsComboBox->addItems(_qs);
QLabel *catAsLabel = new QLabel(tr("Assisted Category"));
catOpLabel->setWordWrap(true);
contestCatAssistedComboBox->setToolTip(tr("Select the assisted category"));
_qs.clear();
_qs << "NON-ASSISTED" << "ASSISTED";
contestCatAssistedComboBox->addItems(_qs);
QLabel *catPowerLabel = new QLabel(tr("Power Category"));
catPowerLabel->setWordWrap(true);
contestCatPowerComboBox->setToolTip(tr("Select the power category"));
_qs.clear();
_qs << "QRP" << "LOW" << "HIGH";
contestCatPowerComboBox->addItems(_qs);
QLabel *catBandsLabel = new QLabel(tr("Bands Category"));
catBandsLabel->setWordWrap(true);
contestCatBandsComboBox->setToolTip(tr("Select the bands category"));
_qs.clear();
_qs << "ALL" << "10" << "15" << "20" << "40" << "80" << "160";
contestCatBandsComboBox->addItems(_qs);
connect(stationCallsignLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotStationCallSignTextChanged() ) );
connect(typeComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotTypeComboBoxChanged(int) ) ) ;
connect(contestCatModeComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotCatModeComboBoxChanged() ) ) ;
connect(contestCatAssistedComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotCatAssistedComboBoxChanged() ) ) ;
connect(contestCatOperatorsComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotCatOperatorsComboBoxChanged() ) ) ;
connect(contestCatPowerComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotCatPowerComboBoxChanged() ) ) ;
connect(contestCatBandsComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotCatBandsComboBoxChanged() ) ) ;
connect(contestBandsComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotBandsComboBoxChanged() ) ) ;
QGridLayout *callsLayout = new QGridLayout; // Widget, row, column
callsLayout->addWidget(stationCallsignLabel, 0, 0);
callsLayout->addWidget(stationCallsignLineEdit, 0, 1);
callsLayout->addWidget(dateLabel, 1, 0);
callsLayout->addWidget(dateEdit, 1, 1);
//callsLayout->addWidget(nameLabel, 0, 0);
//callsLayout->addWidget(nameLineEdit, 0, 1);
callsLayout->addWidget(operatorsLabel, 2, 0);
callsLayout->addWidget(operatorsLineEdit, 2, 1);
callsLayout->addWidget(typeLabel, 3, 0);
callsLayout->addWidget(typeComboBox, 3, 1);
callsLayout->addWidget(catModeLabel, 4, 0);
callsLayout->addWidget(contestCatModeComboBox, 4, 1);
callsLayout->addWidget(catOpLabel, 5, 0);
callsLayout->addWidget(contestCatOperatorsComboBox, 5, 1);
callsLayout->addWidget(catAsLabel, 6, 0);
callsLayout->addWidget(contestCatAssistedComboBox, 6, 1);
callsLayout->addWidget(catPowerLabel, 7, 0);
callsLayout->addWidget(contestCatPowerComboBox, 7, 1);
callsLayout->addWidget(catBandsLabel, 8, 0);
callsLayout->addWidget(contestCatBandsComboBox, 8, 1);
//page->registerField("stationCallSignLineEdit*", stationCallsignLineEdit);
//page->registerField("operatorsLineEdit*", operatorsLineEdit);
page->setLayout(callsLayout);
return page;
}
void SetupPageLogs::slotNewButtonClicked()
{
//qDebug() << "SetupPageLogs::slotNewButtonClicked" << endl;
newLogWizard = new QWizard (this);
finishButton = newLogWizard->button(QWizard::FinishButton);
// QAbstractButton* cancelButton = this->button(QWizard::CancelButton);
// newLogWizard->setButton(finishButton);
//newLogWizard->setButton(cancelButton);
//QList<QWizard::WizardButton> wblayout;
//wblayout << QWizard::Stretch << cancelButton << finishButton;
//wblayout << *finishButton;
//newLogWizard->setButtonLayout(wblayout);
finishButton->setDisabled(true);
newLogWizard->setButton(QWizard::FinishButton, finishButton);
//finishButton->setEnabled(false);
/*
QAbstractButton* finishButton = this->button(QWizard::FinishButton);
QAbstractButton* cancelButton = this->button(QWizard::CancelButton);
connect(finishButton, SIGNAL(clicked()), this, SLOT(slotButtonFinishedClicked()));
disconnect( cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) );
connect(cancelButton, SIGNAL( clicked() ), this, SLOT( slotCancelWizard() ) );
* ...
QList<QWizard::WizardButton> layout;
layout << QWizard::Stretch << QWizard::BackButton << QWizard::CancelButton
<< QWizard::NextButton << QWizard::FinishButton;
setButtonLayout(layout);
wizard()->setButtonText(QWizard::CustomButton1, tr("&Print"));
wizard()->setOption(QWizard::HaveCustomButton1, true);
connect(wizard(), SIGNAL(customButtonClicked(int)),
this, SLOT(printButtonClicked()));
*/
newLogWizard->setModal(true);
newLogWizard->addPage(createLogTypePage());
newLogWizard->setWindowTitle(tr("New Log"));
newLogWizard->show();
}
void SetupPageLogs::slotEditButtonClicked()
{
//qDebug() << "SetupPageLogs::slotEditButtonClicked" << endl;
}
void SetupPageLogs::slotRemoveButtonClicked()
{
//qDebug() << "SetupPageLogs::slotRemoveButtonClicked" << endl;
}
void SetupPageLogs::createLogsPanel()
{
logsView->setModel(logsModel);
QString stringQuery = QString("SELECT * FROM logs");
QSqlQuery query(stringQuery);
QSqlRecord rec = query.record(); // Number of columns
int columns = rec.count();
for (int i = 0; i < columns; i++ ){
logsView->setColumnHidden(i, true);
}
columns = rec.indexOf("id");
logsView->setColumnHidden(columns, false);
columns = rec.indexOf("logdate");
logsView->setColumnHidden(columns, false);
columns = rec.indexOf("stationcall");
logsView->setColumnHidden(columns, false);
columns = rec.indexOf("comment");
logsView->setColumnHidden(columns, false);
columns = rec.indexOf("logtype");
logsView->setColumnHidden(columns, false);
logsView->setItemDelegate(new QSqlRelationalDelegate(this));
logsView->setSelectionMode( QAbstractItemView::SingleSelection);
logsView->setSelectionBehavior(QAbstractItemView::SelectRows);
logsView->resizeColumnsToContents();
logsView->horizontalHeader()->setStretchLastSection(true);
}
void SetupPageLogs::createLogsModel()
{
QString stringQuery = QString("SELECT * FROM logs");
QSqlQuery q(stringQuery);
QSqlRecord rec = q.record();
/*
query.exec("CREATE TABLE logs ("
"id INTEGER PRIMARY KEY AUTOINCREMENT, "
"logdate VARCHAR(10), "
"stationcall VARCHAR(15) NOT NULL, "
"comment VARCHAR, "
"logtype VARCHAR )");
*/
int nameCol;
//logsModel = new QSqlRelationalTableModel(this);
logsModel->setTable("logs");
nameCol = rec.indexOf("id");
logsModel->setSort(nameCol, Qt::AscendingOrder);
logsModel->setHeaderData(nameCol, Qt::Horizontal, tr("ID"));
nameCol = rec.indexOf("logdate");
logsModel->setHeaderData(nameCol, Qt::Horizontal, tr("Date"));
nameCol = rec.indexOf("stationcall");
logsModel->setHeaderData(nameCol, Qt::Horizontal, tr("Station Callsign"));
nameCol = rec.indexOf("comment");
logsModel->setHeaderData(nameCol, Qt::Horizontal, tr("Comments"));
nameCol = rec.indexOf("logtype");
logsModel->setHeaderData(nameCol, Qt::Horizontal, tr("Type"));
logsModel->select();
}
void SetupPageLogs::createActions()
{
connect(newLogPushButton, SIGNAL(clicked ( )), this, SLOT(slotNewButtonClicked() ) );
connect(removePushButton, SIGNAL(clicked ( )), this, SLOT(slotRemoveButtonClicked() ) );
connect(editPushButton, SIGNAL(clicked ( )), this, SLOT(slotEditButtonClicked() ) );
//loadAllPushButton->setToolTip(tr("Load all the logs"));
//loadSelectedPushButton->setToolTip(tr("Load only the selected log"));
//clearPushButton->setToolTip(tr("Clear selection"));
}
void SetupPageLogs::readLogs()
{
//qDebug() << "SetupPageLogs::readLogs" << endl;
QString aux, callUsed;
QStringList _logs;
QSqlQuery query;
QDate date = QDate::currentDate();
_logs.clear();
aux = "SELECT lognumber FROM log";
query.exec(aux);
QSqlRecord rec = query.record();
while ( (query.next()) && (query.isValid()) ) {
aux = (query.value(0)).toString();
//qDebug() << "SetupPageLogs::readLogs: " << aux << endl;
if (!(_logs.contains(aux)))
{
_logs += aux;
}
}
int i = 0;
int nameCol = 0;
while (i <= _logs.size())
{
aux = QString("SELECT qso_date, station_callsign, operator FROM log WHERE lognumber = '%1'").arg(_logs.at(i));
while ( (query.next()) && (query.isValid()) )
{
nameCol = rec.indexOf("qso_date");
aux = (query.value(nameCol)).toString();
if (date < QDate::fromString(aux, "yyyy/MM/dd"))
{
date = QDate::fromString(aux, "yyyy/MM/dd");
}
nameCol = rec.indexOf("station_callsign");
aux = (query.value(nameCol)).toString();
nameCol = rec.indexOf("operator");
//revisar como va
aux = (query.value(nameCol)).toString();
}
}
//qDebug() << "SetupPageLogs::readLogs: " << QString::number(_logs.size())<< endl;
}
void SetupPageLogs::slotStationCallSignTextChanged()
{
//qDebug() << "SetupPageLogs::slotStationCallSignTextChanged" << endl;
// connect(stationCallsignLineEdit, SIGNAL(textChanged(QString)), this, SLOT( ) );
int cursorP = stationCallsignLineEdit->cursorPosition();
QString currentQrz = stationCallsignLineEdit->text();
if ((currentQrz.at(cursorP-1)).isSpace())
{
currentQrz = currentQrz.remove(cursorP-1, 1);
cursorP--;
stationCallsignLineEdit->setText(currentQrz);
}
stationCallsignLineEdit->setText(((stationCallsignLineEdit->text())).simplified());
stationCallsignLineEdit->setText((stationCallsignLineEdit->text()).toUpper());
stationCallsignLineEdit->setCursorPosition(cursorP);
if (currentQrz.length()>=3)
{
stationCallsignFilled = true;
}
}
void SetupPageLogs::slotTypeComboBoxChanged(const int _ind)
{
//qDebug() << "SetupPageLogs::slotTypeComboBoxChanged" << endl;
// connect(typeComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotTypeComboBoxChanged() ) ) ;
int i = _ind;
//int i = typeComboBox->currentIndex();
//qDebug() << "SetupPageLogs::slotTypeComboBoxChanged: " << QString::number(i) << endl;
switch (i)
{
case 0: // DX = No Contest
typeOperation = 0;
contestCatModeComboBox->setEnabled(false);
contestCatOperatorsComboBox->setEnabled(false);
contestCatAssistedComboBox->setEnabled(false);
contestCatPowerComboBox->setEnabled(false);
contestCatBandsComboBox->setEnabled(false);
contestBandsComboBox->setEnabled(false);
break;
case 1: // CQ-WW-SSB
typeOperation = 1;
contestCatModeComboBox->setEnabled(true);
contestCatOperatorsComboBox->setEnabled(true);
contestCatAssistedComboBox->setEnabled(true);
contestCatPowerComboBox->setEnabled(true);
contestCatBandsComboBox->setEnabled(true);
contestBandsComboBox->setEnabled(true);
break;
case 2: // CQ-WW-CW
typeOperation = 2;
contestCatModeComboBox->setEnabled(true);
contestCatOperatorsComboBox->setEnabled(true);
contestCatAssistedComboBox->setEnabled(true);
contestCatPowerComboBox->setEnabled(true);
contestCatBandsComboBox->setEnabled(true);
contestBandsComboBox->setEnabled(true);
break;
case 3: // CQ-WPX-SSB
typeOperation = 3;
contestCatModeComboBox->setEnabled(true);
contestCatOperatorsComboBox->setEnabled(true);
contestCatAssistedComboBox->setEnabled(true);
contestCatPowerComboBox->setEnabled(true);
contestCatBandsComboBox->setEnabled(true);
contestBandsComboBox->setEnabled(true);
break;
case 4: // CQ-WPX-CW
typeOperation = 4;
contestCatModeComboBox->setEnabled(true);
contestCatOperatorsComboBox->setEnabled(true);
contestCatAssistedComboBox->setEnabled(true);
contestCatPowerComboBox->setEnabled(true);
contestCatBandsComboBox->setEnabled(true);
contestBandsComboBox->setEnabled(true);
break;
default:// DX = No Contest
typeOperation = 0;
contestCatModeComboBox->setEnabled(false);
contestCatOperatorsComboBox->setEnabled(false);
contestCatAssistedComboBox->setEnabled(false);
contestCatPowerComboBox->setEnabled(false);
contestCatBandsComboBox->setEnabled(false);
contestBandsComboBox->setEnabled(false);
break;
}
}
void SetupPageLogs::slotCatAssistedComboBoxChanged()
{
//qDebug() << "SetupPageLogs:slotCatAssistedComboBoxChanged: " << QString::number(contestCatAssistedComboBox->currentIndex()) << endl;
//connect(contestCatAssistedComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotCatAssistedComboBoxChanged() ) ) ;
}
void SetupPageLogs::slotCatOperatorsComboBoxChanged()
{
//qDebug() << "SetupPageLogs::slotCatOperatorsComboBoxChanged(): " << QString::number(contestCatOperatorsComboBox->currentIndex()) << endl;
//connect(contestCatOperatorsComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotCatOperatorsComboBoxChanged() ) ) ;
}
void SetupPageLogs::slotCatPowerComboBoxChanged()
{
//qDebug() << "SetupPageLogs::slotCatPowerComboBoxChanged(): " << QString::number(contestCatPowerComboBox->currentIndex()) << endl;
//connect(contestCatPowerComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotCatPowerComboBoxChanged() ) ) ;
}
void SetupPageLogs::slotCatBandsComboBoxChanged()
{
//qDebug() << "SetupPageLogs::slotCatBandsComboBoxChanged(): " << QString::number(contestCatBandsComboBox->currentIndex()) << endl;
//connect(contestCatBandsComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotCatBandsComboBoxChanged() ) ) ;
}
void SetupPageLogs::slotBandsComboBoxChanged()
{
//qDebug() << "SetupPageLogs::slotBandsComboBoxChanged(): " << QString::number(contestBandsComboBox->currentIndex()) << endl;
//connect(contestBandsComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotBandsComboBoxChanged() ) ) ;
}
void SetupPageLogs::slotCatModeComboBoxChanged()
{
//qDebug() << "SetupPageLogs::slotModeComboBoxChanged(): " << QString::number(contestCatModeComboBox->currentIndex()) << endl;
}

133
setuppagelogs.h Normal file
View File

@ -0,0 +1,133 @@
#ifndef SETUPPAGELOGS_H
#define SETUPPAGELOGS_H
/***************************************************************************
setuppagelogs.h - description
-------------------
begin : feb 2012
copyright : (C) 2012 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
//#include <QtWidgets>
#include <QtGui>
#include <QtSql>
#include <QWizard>
#include <QWizardPage>
const int CONTEST_DX = 0;
const int CONTEST_CQ_WW_SSB = 1;
const int CONTEST_CQ_WW_CW = 2;
const int CONTEST_CQ_WPX_SSB = 3;
const int CONTEST_CQ_WPX_CW = 4;
class SetupPageLogs : public QWidget {
Q_OBJECT
public:
SetupPageLogs(QWidget *parent=0);
~SetupPageLogs();
/*
QString getBands(); // 10m, 12m, 15m
QString getModes(); //ssb, CW
void setActiveBands(QStringList q);
void setActiveModes(QStringList q);
*/
private slots:
/*
void slotBandActiveItemDoubleClicked ( QListWidgetItem * item );
void slotBandNotActiveItemDoubleClicked ( QListWidgetItem * item );
void slotBandSelButtonClicked( );
void slotBandUnSelButtonClicked( );
void slotModeSelButtonClicked( );
void slotModeUnSelButtonClicked( );
*/
void slotNewButtonClicked();
void slotEditButtonClicked();
void slotRemoveButtonClicked();
void slotStationCallSignTextChanged();
void slotTypeComboBoxChanged(const int _ind);
void slotCatAssistedComboBoxChanged();
void slotCatOperatorsComboBoxChanged();
void slotCatPowerComboBoxChanged();
void slotCatBandsComboBoxChanged();
void slotBandsComboBoxChanged();
void slotCatModeComboBoxChanged();
//void slotCreateLog();
//
private:
//void createActions();
void readLogs();
void createLogsPanel();
void createLogsModel();
void createActions();
/* Wizard to create a new log*/
QWizardPage *createLogTypePage();
QWizard *newLogWizard; // Wizard to create a new log
/*^Wizard to create a new log^*/
QSqlRelationalTableModel *logsModel;
QWidget *logsPanel;
QTableView *logsView;
QAbstractButton *finishButton;
//QWidget *logsWidget;
//QTreeWidget *logsQTreeWidget;
//QListWidget *bandsNotActiveListWidget, *bandsActiveListWidget;
//QListWidget *modesNotActiveListWidget, *modesActiveListWidget;
//QStringList bands, modes;
QPushButton *newLogPushButton, *editPushButton, *removePushButton;
//*loadAllPushButton, *loadSelectedPushButton, *clearPushButton,;
int lastLog;
QString currentLogComment;
QString currentStationCallSign;
QDateEdit *dateEdit;
QLineEdit *stationCallsignLineEdit, *nameLineEdit;
QLineEdit *operatorsLineEdit;
QComboBox *typeComboBox;
QComboBox *contestCatModeComboBox;
QComboBox *contestCatOperatorsComboBox;
QComboBox *contestCatAssistedComboBox;
QComboBox *contestCatPowerComboBox;
QComboBox *contestCatBandsComboBox;
QComboBox *contestBandsComboBox;
bool stationCallsignFilled, operatorsFilled;
int typeOperation; // DX, CQ-WW-SSB, CQ-WW-CW, CQ-WPX-SSB, CQ-WPX-CW
};
#endif // SETUPPAGELOGS_H

406
setuppagemisc.cpp Normal file
View File

@ -0,0 +1,406 @@
/***************************************************************************
setuppagemisc.cpp - description
-------------------
begin : sept 2011
copyright : (C) 2011 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
//#include <QDebug>
#include "setuppagemisc.h"
//TODO: The defaultFileName QString can be removed and used the content of defaultFileNameLineEdit
// instead. It is easy to change but the code would not be so clear... Think about this. :-)
SetupPageMisc::SetupPageMisc(QWidget *parent) : QWidget(parent){
//qDebug() << "SetupPageMisc::SetupPageMisc" << endl;
// bandsWidget = new QWidget;
//TODO: To be removed when the defaultDir is saved in the config file
#ifdef Q_OS_WIN
//qDebug() << "WINDOWS DETECTED!" << endl;
kontestDir = QDir::homePath()+"/klog"; // We create the \klog for the logs and data
defaultFileName = kontestDir+"/klog.adi";
#else
//qDebug() << "NO WINDOWS DETECTED!" << endl;
kontestDir = QDir::homePath()+"/.klog"; // We create the ~/.klog for the logs and data
defaultFileName = kontestDir+"/klog.adi";
#endif
imperialCheckBox = new QCheckBox(tr("Imperial system"), this);
dbInMemory = new QCheckBox(tr("DB in Memory"), this);
realTimeCheckbox = new QCheckBox(tr("Log in real time"), this);
UTCCheckbox = new QCheckBox(tr("Time in UTC"), this);
alwaysADIFCheckBox = new QCheckBox(tr("Save ADIF on exit"), this);
useDefaultName = new QCheckBox(tr("Use this default filename"), this);
sendQSLWhenRecCheckBox = new QCheckBox(tr("Mark QSO to send QSL when QSL is received"), this);
sendQSLWhenRecCheckBox->setToolTip(tr("QSOs will be marked to be pending to send the QSL if the DX QSL is received and you have not sent your."));
showStationCallWhenSearchCheckBox = new QCheckBox(tr("Show the Station Callsign used in the search box"), this);
showStationCallWhenSearchCheckBox->setToolTip(tr("The search box will show also the callsign on the air to do the QSO."));
keepMyDataCheckBox = new QCheckBox(tr("Use My Data tab for all QSO"), this);
keepMyDataCheckBox->setToolTip(tr("All the data from the My Data tab will be used or data from the previous QSO will be maintained."));
imperialCheckBox ->setToolTip(tr("Check it for Imperial system (Miles instead of Kilometres)."));
dbInMemory->setToolTip(tr("Working in memory (vs in file) is much quicker but you will need to save the ADIF file each time you exit KLog."));
realTimeCheckbox->setToolTip(tr("Select to use real time."));
UTCCheckbox->setToolTip(tr("Select to use UTC time."));
alwaysADIFCheckBox->setToolTip(tr("Select if you want to save to ADIF on exit."));
useDefaultName->setToolTip(tr("Select to use the following name for the logfile and not being asked for it anymore."));
defaultFileNameLineEdit = new QLineEdit;
defaultFileNameLineEdit->setToolTip(tr("This is the default file where ADIF will be saved."));
defaultFileNameLineEdit->setReadOnly(true);
defaultFileNameLineEdit->setText(defaultFileName);
defaultFileNameLineEdit->setEnabled(false);
useDefaultName->setChecked(true);
alwaysADIFCheckBox->setChecked(true);
showStationCallWhenSearchCheckBox->setChecked(true);
keepMyDataCheckBox->setChecked(true);
fileNameButton = new QPushButton;
fileNameButton->setToolTip(tr("Click to change the default ADIF file"));
//TODO: Add an icon "open" to this pushbutton
QHBoxLayout *fileLayout = new QHBoxLayout;
fileLayout->addWidget(useDefaultName);
fileLayout->addWidget(defaultFileNameLineEdit);
fileLayout->addWidget(fileNameButton);
defaultFileNameLineEdit->setEnabled(true);
fileNameButton->setEnabled(true);
UTCCheckbox->setChecked(true);
realTimeCheckbox->setChecked(true);
//showStationCallWhenSearchCheckBox->setChecked(true);
QHBoxLayout *timeLayout = new QHBoxLayout;
timeLayout->addWidget(UTCCheckbox);
timeLayout->addWidget(realTimeCheckbox);
//QHBoxLayout *fileOptLayout = new QHBoxLayout;
//fileOptLayout->addWidget(useDefaultName);
//fileOptLayout->addWidget(alwaysADIFCheckBox);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(dbInMemory);
mainLayout->addLayout(fileLayout);
mainLayout->addWidget(alwaysADIFCheckBox);
//mainLayout->addWidget(useDefaultName);
//mainLayout->addLayout(fileOptLayout);
//mainLayout->addWidget(realTimeCheckbox);
//mainLayout->addWidget(UTCCheckbox);
mainLayout->addLayout(timeLayout);
mainLayout->addWidget(imperialCheckBox);
mainLayout->addWidget(keepMyDataCheckBox);
mainLayout->addWidget(sendQSLWhenRecCheckBox);
mainLayout->addWidget(showStationCallWhenSearchCheckBox);
setLayout(mainLayout);
connect(fileNameButton, SIGNAL(clicked () ), this, SLOT(slotOpenFileButtonClicked() ) );
connect(useDefaultName, SIGNAL(stateChanged (int) ), this, SLOT(slotUseDefaultButtonStateChanged(int) ) );
}
SetupPageMisc::~SetupPageMisc(){
//qDebug() << "SetupPageMisc::~SetupPageMisc" << endl;
}
void SetupPageMisc::createActions(){
//void itemDoubleClicked ( QListWidgetItem * item )
}
QString SetupPageMisc::getRealTime(){
if (realTimeCheckbox->isChecked())
{
return "True";
}
else
{
return "False";
}
}
void SetupPageMisc::setRealTime(const QString t){
//QString st = t;
if ( (t.toUpper()) == "FALSE")
{
realTimeCheckbox->setChecked(false);
}
else
{
realTimeCheckbox->setChecked(true);
}
}
QString SetupPageMisc::getUTCTime(){
if (UTCCheckbox->isChecked())
{
return "True";
}
else
{
return "False";
}
}
void SetupPageMisc::setUTCTime(const QString t){
if ( (t.toUpper()) == "FALSE")
{
UTCCheckbox->setChecked(false);
}
else
{
UTCCheckbox->setChecked(true);
}
}
QString SetupPageMisc::getAlwaysADIF()
{
if (alwaysADIFCheckBox->isChecked())
{
return "True";
}
else
{
return "False";
}
}
void SetupPageMisc::setAlwaysADIF(const QString t)
{ // Defaul value is false
if ( (t.toUpper()) == "TRUE")
{
alwaysADIFCheckBox->setChecked(true);
}
else
{
alwaysADIFCheckBox->setChecked(false);
}
}
QString SetupPageMisc::getDefaultFileName()
{
return defaultFileName;
}
void SetupPageMisc::setDefaultFileName(const QString t)
{
defaultFileName = t;
defaultFileNameLineEdit->setText(defaultFileName);
}
void SetupPageMisc::slotOpenFileButtonClicked()
{
defaultFileName = QFileDialog::getOpenFileName(this, tr("Open File"), kontestDir, tr("ADIF (*.adi)"));
defaultFileNameLineEdit->setText(defaultFileName);
}
QString SetupPageMisc::getInMemory()
{
if (dbInMemory->isChecked())
{
return "True";
}
else
{
return "False";
}
}
void SetupPageMisc::setInMemory(const QString t)
{
if ( (t.toUpper()) == "FALSE")
{
dbInMemory->setChecked(false);
}
else
{
dbInMemory->setChecked(true);
}
}
QString SetupPageMisc::getUseDefaultName()
{
if (useDefaultName->isChecked())
{
return "True";
}
else
{
return "False";
}
}
void SetupPageMisc::setUseDefaultName(const QString t)
{
if ( (t.toUpper()) == "FALSE")
{
useDefaultName->setChecked(false);
}
else
{
useDefaultName->setChecked(true);
}
}
QString SetupPageMisc::getImperial()
{
if (imperialCheckBox->isChecked())
{
return "True";
}
else
{
return "False";
}
}
void SetupPageMisc::setImperial(const QString t)
{
if ( (t.toUpper()) == "FALSE")
{
imperialCheckBox->setChecked(false);
}
else
{
imperialCheckBox->setChecked(true);
}
}
void SetupPageMisc::slotUseDefaultButtonStateChanged(int state)
{
//qDebug() << "SetupPageMisc::slotUseDefaultButtonStateChanged" << endl;
if (state)
{
defaultFileNameLineEdit->setEnabled(true);
fileNameButton->setEnabled(true);
}
else
{
defaultFileNameLineEdit->setEnabled(false);
fileNameButton->setEnabled(false);
}
}
QString SetupPageMisc::getSendQSLWhenRec(){
if (sendQSLWhenRecCheckBox->isChecked())
{
return "True";
}
else
{
return "False";
}
}
void SetupPageMisc::setSendQSLWhenRec(const QString t){
if ( (t.toUpper()) == "FALSE")
{
sendQSLWhenRecCheckBox->setChecked(false);
}
else
{
sendQSLWhenRecCheckBox->setChecked(true);
}
}
QString SetupPageMisc::getShowStationCallSignInSearch()
{
if (showStationCallWhenSearchCheckBox->isChecked())
{
return "True";
}
else
{
return "False";
}
}
void SetupPageMisc::setShowStationCallSignInSearch(const QString t)
{
if ( (t.toUpper()) == "FALSE")
{
showStationCallWhenSearchCheckBox->setChecked(false);
}
else
{
showStationCallWhenSearchCheckBox->setChecked(true);
}
}
QString SetupPageMisc::getKeepMyData()
{
if (keepMyDataCheckBox->isChecked())
{
return "True";
}
else
{
return "False";
}
}
void SetupPageMisc::setKeepMyData(const QString t)
{
if ( (t.toUpper()) == "FALSE")
{
keepMyDataCheckBox->setChecked(false);
}
else
{
keepMyDataCheckBox->setChecked(true);
}
}

83
setuppagemisc.h Normal file
View File

@ -0,0 +1,83 @@
#ifndef SETUPPAGEMISC_H
#define SETUPPAGEMISC_H
/***************************************************************************
setuppagemisc.h - description
-------------------
begin : sept 2011
copyright : (C) 2011 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
//#include <QtWidgets>
#include <QtGui>
class SetupPageMisc : public QWidget {
Q_OBJECT
public:
SetupPageMisc(QWidget *parent=0);
~SetupPageMisc();
QString getRealTime();
void setRealTime(const QString t);
QString getUTCTime();
void setUTCTime(const QString t);
QString getAlwaysADIF();
void setAlwaysADIF(const QString t);
QString getDefaultFileName();
void setUseDefaultName(const QString t);
QString getUseDefaultName();
void setDefaultFileName(const QString t);
QString getInMemory();
void setInMemory(const QString t);
QString getImperial();
void setImperial(const QString t);
QString getSendQSLWhenRec();
void setSendQSLWhenRec(const QString t);
QString getShowStationCallSignInSearch();
void setShowStationCallSignInSearch(const QString t);
QString getKeepMyData();
void setKeepMyData(const QString t);
private slots:
void slotOpenFileButtonClicked();
void slotUseDefaultButtonStateChanged(int state);
private:
void createActions();
QCheckBox *realTimeCheckbox, *UTCCheckbox, *alwaysADIFCheckBox, *dbInMemory, *useDefaultName;
QCheckBox *imperialCheckBox, *sendQSLWhenRecCheckBox, *showStationCallWhenSearchCheckBox, *keepMyDataCheckBox;
QString defaultFileName;
QLineEdit *defaultFileNameLineEdit;
QPushButton *fileNameButton;
QString kontestDir; //TODO: To be removed when the defaultDir is saved in the config file
//QWidget *bandsWidget;
};
#endif // SETUPPAGEMISC_H

686
setuppageuserdata.cpp Normal file
View File

@ -0,0 +1,686 @@
/***************************************************************************
userdatapage.cpp - description
-------------------
begin : sept 2011
copyright : (C) 2011 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* Foobar 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
#include "setuppageuserdata.h"
SetupPageUserDataPage::SetupPageUserDataPage(QWidget *parent) : QWidget(parent){
locator = new Locator();
operatorOK = false;
operatorsOK = false;
tabWidget = new QTabWidget;
QWidget *personalTab = new QWidget;
QWidget *stationTab = new QWidget;
tabWidget->addTab(personalTab, tr("Personal data"));
tabWidget->addTab(stationTab, tr("Station data"));
qrzLineEdit = new QLineEdit;
operatorsLineEdit = new QLineEdit;
nameLineEdit = new QLineEdit;
cqzLineEdit = new QLineEdit;
ituzLineEdit = new QLineEdit;
myLocatorLineEdit = new QLineEdit;
defaultPalette = new QPalette;
//defaultPalette = operatorsLineEdit->palette();
wrongPalette = new QPalette;
//wrongPalette->setColor(QPalette::WindowText, setNamedColor(Qt::red));
//redColor.setNamedColor(Qt::red);
//redColor->setNamedColor(Qt::red);
wrongPalette->setColor(QPalette::Text, Qt::red);
//Personal Tab
nameLineEdit = new QLineEdit;
address1LineEdit = new QLineEdit;
address2LineEdit = new QLineEdit;
address3LineEdit = new QLineEdit;
address4LineEdit = new QLineEdit;
cityLineEdit = new QLineEdit;
zipLineEdit = new QLineEdit;
provinceLineEdit = new QLineEdit;
countryLineEdit = new QLineEdit;
nameLineEdit->setToolTip(tr("Enter your name"));
address1LineEdit->setToolTip(tr("Enter your address - 1st line"));
address2LineEdit->setToolTip(tr("Enter your address - 2nd line"));
address3LineEdit->setToolTip(tr("Enter your address - 3st line"));
address4LineEdit->setToolTip(tr("Enter your address - 4nd line"));
cityLineEdit->setToolTip(tr("Enter your city"));
zipLineEdit->setToolTip(tr("Enter your zip code"));
provinceLineEdit->setToolTip(tr("Enter your province or state"));
countryLineEdit->setToolTip(tr("Enter your country"));
QLabel *nameLabel = new QLabel(tr("Name"));
QLabel *addressLabel = new QLabel(tr("Address"));
QLabel *cityLabel = new QLabel(tr("City"));
QLabel *zipLabel = new QLabel(tr("Zip Code"));
QLabel *provLabel = new QLabel(tr("Prov/State"));
QLabel *countryLabel = new QLabel(tr("Country"));
//void addWidget ( QWidget * widget, int fromRow, int fromColumn, int rowSpan, int columnSpan, Qt::Alignment alignment = 0 )
// 0 1 2 3
QGridLayout *personalLayout = new QGridLayout();
personalLayout->addWidget(nameLabel, 0, 0);
personalLayout->addWidget(nameLineEdit, 1, 0);
personalLayout->addWidget(addressLabel, 2, 0);
personalLayout->addWidget(address1LineEdit, 3, 0, 1, 2);
personalLayout->addWidget(address2LineEdit, 4, 0, 1, 2);
personalLayout->addWidget(address3LineEdit, 5, 0, 1, 2);
personalLayout->addWidget(address4LineEdit, 6, 0, 1, 2);
personalLayout->addWidget(cityLabel, 2, 2);
personalLayout->addWidget(cityLineEdit, 3, 2, 1, 1);
personalLayout->addWidget(zipLabel, 2, 5);
personalLayout->addWidget(zipLineEdit, 3, 5, 1, 1);
personalLayout->addWidget(provLabel, 4, 2);
personalLayout->addWidget(provinceLineEdit, 5, 2, 1, 1);
personalLayout->addWidget(countryLabel, 4, 5);
personalLayout->addWidget(countryLineEdit, 5, 5, 1, 1);
//personalLayout->addWidget();
//QHBoxLayout *personalAllLayout = new QHBoxLayout();
//personalAllLayout->addLayout(nameLayout);
//personalAllLayout->addLayout(personalLayout);
personalTab->setLayout(personalLayout);
// Station Tab
rig1LineEdit = new QLineEdit;
rig2LineEdit = new QLineEdit;
rig3LineEdit = new QLineEdit;
ant1LineEdit = new QLineEdit;
ant2LineEdit = new QLineEdit;
ant3LineEdit = new QLineEdit;
//powerLineEdit = new QLineEdit;
myPowerSpinBox = new QDoubleSpinBox;
myPowerSpinBox->setDecimals(2);
myPowerSpinBox->setMaximum(9999);
rig1LineEdit->setToolTip(tr("Enter your rig #1 information"));
rig2LineEdit->setToolTip(tr("Enter your rig #2 information"));
rig3LineEdit->setToolTip(tr("Enter your rig #3 information"));
ant1LineEdit->setToolTip(tr("Enter your antenna #1 information"));
ant2LineEdit->setToolTip(tr("Enter your antenna #2 information"));
ant3LineEdit->setToolTip(tr("Enter your antenna #3 information"));
myPowerSpinBox->setToolTip(tr("Enter your power information"));
QLabel *rig1Label = new QLabel(tr("Rig 1"));
QLabel *rig2Label = new QLabel(tr("Rig 2"));
QLabel *rig3Label = new QLabel(tr("Rig 3"));
QLabel *antenna1Label = new QLabel(tr("Antenna 1"));
QLabel *antenna2Label = new QLabel(tr("Antenna 2"));
QLabel *antenna3Label = new QLabel(tr("Antenna 2"));
QLabel *powerLabel = new QLabel(tr("Power"));
//void addWidget ( QWidget * widget, int fromRow, int fromColumn, int rowSpan, int columnSpan, Qt::Alignment alignment = 0 )
// 0 1 2 3
QGridLayout *stationLayout = new QGridLayout();
stationLayout->addWidget(rig1Label, 0, 0);
stationLayout->addWidget(rig1LineEdit, 1, 0, 1, 1);
stationLayout->addWidget(rig2Label, 2, 0);
stationLayout->addWidget(rig2LineEdit, 3, 0, 1, 1);
stationLayout->addWidget(rig3Label, 4, 0);
stationLayout->addWidget(rig3LineEdit, 5, 0, 1, 1);
stationLayout->addWidget(antenna1Label, 0, 2);
stationLayout->addWidget(ant1LineEdit, 1, 2, 1, 1);
stationLayout->addWidget(antenna2Label, 2, 2);
stationLayout->addWidget(ant2LineEdit, 3, 2, 1, 1);
stationLayout->addWidget(antenna3Label, 4, 2);
stationLayout->addWidget(ant3LineEdit, 5, 2, 1, 1);
stationLayout->addWidget(powerLabel, 0, 4);
stationLayout->addWidget(myPowerSpinBox, 1, 4);
stationTab->setLayout(stationLayout);
//TODO:Defining ALL the tooltips
qrzLineEdit->setToolTip(tr("Enter the station callsign that will be used for logging"));
operatorsLineEdit->setToolTip(tr("Enter the operators (comma separated if more than one)."));
myLocatorLineEdit->setToolTip(tr("Enter the locator of your station. KLog will propose one locator based on your callsign"));
QLabel *qrzLabel = new QLabel(tr("QRZ"));
QLabel *operatorsLabel = new QLabel (tr("Operators"));
QLabel *cqzLabel = new QLabel(tr("CQ Zone"));
QLabel *ituzLabel = new QLabel(tr("ITU Zone"));
myLocatorLabel = new QLabel(tr("Locator"));
cqzLineEdit->setInputMask("09");
ituzLineEdit->setInputMask("09");
cqzLineEdit->setText("00");
ituzLineEdit->setText("00");
//QHBoxLayout *operatorLayout = new QHBoxLayout;
//operatorLayout->addWidget(qrzLabel);
//operatorLayout->addWidget(qrzLineEdit);
//operatorLayout->addWidget(operatorsLabel);
//operatorLayout->addWidget(operatorsLineEdit);
//QGridLayout *operatorLayout = new QGridLayout();
//operatorLayout->addWidget(qrzLabel, 0, 0);
//operatorLayout->addWidget(qrzLineEdit, 1, 0);
////operatorLayout->addWidget(nameLabel, 0, 1);
////operatorLayout->addWidget(nameLineEdit, 1, 1);
/*
QGridLayout *zonesBoxLayout = new QGridLayout;
zonesBoxLayout->addWidget(myLocatorLabel,0,0);
zonesBoxLayout->addWidget(cqzLabel,0,1);
zonesBoxLayout->addWidget(ituzLabel,0,2);
zonesBoxLayout->addWidget(myLocatorLineEdit,1,0);
zonesBoxLayout->addWidget(cqzLineEdit,1,1);
zonesBoxLayout->addWidget(ituzLineEdit,1,2);
QVBoxLayout *userdataLayout = new QVBoxLayout();
userdataLayout->addLayout(operatorLayout);
userdataLayout->addLayout(zonesBoxLayout);
*/
QGridLayout *userdataLayout = new QGridLayout;
userdataLayout->addWidget(qrzLabel, 0, 0);
userdataLayout->addWidget(qrzLineEdit, 1, 0);
userdataLayout->addWidget(operatorsLabel, 0, 1);
userdataLayout->addWidget(operatorsLineEdit, 1, 1, 1, -1);
userdataLayout->addWidget(myLocatorLabel, 3, 0);
userdataLayout->addWidget(myLocatorLineEdit, 4, 0);
userdataLayout->addWidget(cqzLabel, 3, 1);
userdataLayout->addWidget(cqzLineEdit, 4, 1);
userdataLayout->addWidget(ituzLabel, 3, 2);
userdataLayout->addWidget(ituzLineEdit, 4, 2);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addLayout(userdataLayout);
mainLayout->addWidget(tabWidget);
//mainLayout->addStretch(1);
connect(qrzLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotQRZTextChanged() ) );
connect(myLocatorLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotMyLocatorTextChanged() ) );
connect(operatorsLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotOperatorsChanged() ) );
setLayout(mainLayout);
}
SetupPageUserDataPage::~SetupPageUserDataPage()
{
//qDebug() << "SetupPageUserDataPage::~SetupPageUserDataPage" << endl;
}
QString SetupPageUserDataPage::getStationQrz()
{
operatorOK = world.checkQRZValidFormat(qrzLineEdit->text());
if (operatorOK)
{
return qrzLineEdit->text();
}
else
{
return QString();
}
}
void SetupPageUserDataPage::slotQRZTextChanged()
{
//qDebug() << "SetupPageUserDataPage::slotQRZTextChanged: " << qrzLineEdit->text() << " / Length: " << QString::number((qrzLineEdit->text()).size()) << endl;
int i = qrzLineEdit->cursorPosition();
QString _a = qrzLineEdit->text();
if ((_a.at(i-1)).isSpace())
{
qrzLineEdit->setText(_a.remove(i-1, 1));
}
qrzLineEdit->setText(((qrzLineEdit->text())).simplified());
qrzLineEdit->setText((qrzLineEdit->text()).toUpper());
cqzLineEdit->setText(QString::number(world.getQRZCqz(qrzLineEdit->text())));
ituzLineEdit->setText(QString::number(world.getQRZItuz(qrzLineEdit->text())));
myLocatorLineEdit->setText(world.getQRZLocator(qrzLineEdit->text()));
qrzLineEdit->setCursorPosition(i);
/*
if (!locator->isValidLocator(myLocatorLineEdit->text()) )
{
myLocatorLineEdit->setText(world.getQRZLocator(qrzLineEdit->text()));
}
*/
}
int SetupPageUserDataPage::getCQz(){
return (cqzLineEdit->text()).toInt();
}
int SetupPageUserDataPage::getITUz(){
return (ituzLineEdit->text()).toInt();
}
bool SetupPageUserDataPage::setStationQrz(const QString _qrz){
qrzLineEdit->setText((_qrz).toUpper());
return true;
}
bool SetupPageUserDataPage::setCQz(const int _cqz){
cqzLineEdit->setText(QString::number(_cqz));
return true;
}
bool SetupPageUserDataPage::setITUz(const int _ituz){
ituzLineEdit->setText(QString::number(_ituz));
return true;
}
void SetupPageUserDataPage::slotMyLocatorTextChanged()
{
//qDebug() << "SetupPageUserDataPage::slotMyLocatorTextChanged: " << myLocatorLineEdit->text() << endl;
//int i;
myLocatorLineEdit->setText(((myLocatorLineEdit->text())).simplified());
myLocatorLineEdit->setText((myLocatorLineEdit->text()).toUpper());
if ( ((myLocatorLineEdit->text()).length()) >3 )
{
if (!(locator->isValidLocator(myLocatorLineEdit->text()) ))
{
myLocatorLabel->setText(tr("Locator (not valid)"));
}
else
{
myLocatorLabel->setText(tr("Locator"));
}
}
}
QString SetupPageUserDataPage::getStationLocator()
{
if (!(locator->isValidLocator(myLocatorLineEdit->text()) ))
{
return "";
}
else
{
return (myLocatorLineEdit->text()).toUpper();
}
}
bool SetupPageUserDataPage::setStationLocator(const QString _loc)
{
if (!(locator->isValidLocator(_loc) ))
{
return false;
}
else
{
myLocatorLineEdit->setText((_loc).toUpper());
return true;
}
}
QString SetupPageUserDataPage::getName()
{
return nameLineEdit->text();
}
QStringList SetupPageUserDataPage::getAddress()
{
QStringList a;
a.clear();
a << address1LineEdit->text() << address2LineEdit->text() << address3LineEdit->text() << address4LineEdit->text();
return a;
}
QString SetupPageUserDataPage::getAddress1()
{
return address1LineEdit->text();
}
QString SetupPageUserDataPage::getAddress2()
{
return address2LineEdit->text();
}
QString SetupPageUserDataPage::getAddress3()
{
return address3LineEdit->text();
}
QString SetupPageUserDataPage::getAddress4()
{
return address4LineEdit->text();
}
QString SetupPageUserDataPage::getRig1()
{
return rig1LineEdit->text();
}
QString SetupPageUserDataPage::getRig2()
{
return rig2LineEdit->text();
}
QString SetupPageUserDataPage::getRig3()
{
return rig3LineEdit->text();
}
QString SetupPageUserDataPage::getAntenna1()
{
return ant1LineEdit->text();
}
QString SetupPageUserDataPage::getAntenna2()
{
return ant2LineEdit->text();
}
QString SetupPageUserDataPage::getAntenna3()
{
return ant3LineEdit->text();
}
QString SetupPageUserDataPage::getCity()
{
return cityLineEdit->text();
}
QString SetupPageUserDataPage::getZipCode()
{
return zipLineEdit->text();
}
QString SetupPageUserDataPage::getProvince()
{
return provinceLineEdit->text();
}
QString SetupPageUserDataPage::getCountry()
{
return countryLineEdit->text();
}
bool SetupPageUserDataPage::setName (const QString _aux)
{
nameLineEdit->setText(_aux);
return true;
}
bool SetupPageUserDataPage::setAddress (const QStringList _aux)
{
address1LineEdit->setText(_aux.at(0));
address2LineEdit->setText(_aux.at(1));
address3LineEdit->setText(_aux.at(2));
address4LineEdit->setText(_aux.at(3));
return true;
}
bool SetupPageUserDataPage::setAddress1 (const QString _aux)
{
address1LineEdit->setText(_aux);
return true;
}
bool SetupPageUserDataPage::setAddress2 (const QString _aux)
{
address2LineEdit->setText(_aux);
return true;
}
bool SetupPageUserDataPage::setAddress3 (const QString _aux)
{
address3LineEdit->setText(_aux);
return true;
}
bool SetupPageUserDataPage::setAddress4 (const QString _aux)
{
address4LineEdit->setText(_aux);
return true;
}
bool SetupPageUserDataPage::setCity (const QString _aux)
{
cityLineEdit->setText(_aux);
return true;
}
bool SetupPageUserDataPage::setZipCode(const QString _aux)
{
zipLineEdit->setText(_aux);
return true;
}
bool SetupPageUserDataPage::setProvince (const QString _aux)
{
provinceLineEdit->setText(_aux);
return true;
}
bool SetupPageUserDataPage::setCountry (const QString _aux)
{
countryLineEdit->setText(_aux);
return true;
}
QStringList SetupPageUserDataPage::getRigs()
{
QStringList a;
a.clear();
a << rig1LineEdit->text() << rig2LineEdit->text() << rig3LineEdit->text();
return a;
}
QStringList SetupPageUserDataPage::getAntennas()
{
QStringList a;
a.clear();
a << ant1LineEdit->text() << ant2LineEdit->text() << ant3LineEdit->text();
return a;
}
QString SetupPageUserDataPage::getPower()
{
return QString::number(myPowerSpinBox->value());
}
bool SetupPageUserDataPage::setPower(const QString _aux)
{
myPowerSpinBox->setValue(_aux.toFloat());
return true;
}
bool SetupPageUserDataPage::setRig1 (const QString _aux)
{
rig1LineEdit->setText(_aux);
return true;
}
bool SetupPageUserDataPage::setRig2 (const QString _aux)
{
rig2LineEdit->setText(_aux);
return true;
}
bool SetupPageUserDataPage::setRig3 (const QString _aux)
{
rig3LineEdit->setText(_aux);
return true;
}
bool SetupPageUserDataPage::setAntenna1 (const QString _aux)
{
ant1LineEdit->setText(_aux);
return true;
}
bool SetupPageUserDataPage::setAntenna2 (const QString _aux)
{
ant2LineEdit->setText(_aux);
return true;
}
bool SetupPageUserDataPage::setAntenna3 (const QString _aux)
{
ant3LineEdit->setText(_aux);
return true;
}
void SetupPageUserDataPage::slotOperatorsChanged()
{
//qDebug() << "SetupPageUserDataPage::slotOperatorsChanged" << endl;
//QString _operators = operatorsLineEdit->text();
if (operatorsLineEdit->text().length() < 1)
return;
int i = operatorsLineEdit->cursorPosition();
//QColor defaultColor = (operatorsLineEdit->palette()).color(QPalette::WindowText);
int ent = -1;
//qDebug() << "SetupPageUserDataPage::slotOperatorsChanged-00" << endl;
QString _a = operatorsLineEdit->text();
if ((_a.at(i-1)).isSpace())
{
operatorsLineEdit->setText(_a.remove(i-1, 1));
}
//qDebug() << "SetupPageUserDataPage::slotOperatorsChanged-01" << endl;
//operatorsLineEdit->setText(((operatorsLineEdit->text())).simplified());
//operatorsLineEdit->setText((operatorsLineEdit->text()).toUpper());
operatorsLineEdit->setText(_a.simplified().toUpper());
_a = operatorsLineEdit->text();
QStringList operators = _a.split(",", QString::SkipEmptyParts);
//qDebug() << "SetupPageUserDataPage::slotOperatorsChanged-02" << endl;
//qDebug() << "SetupPageUserDataPage::slotOperatorsChanged-02.5 Size: " << QString::number(operators.size()) << endl;
for (int ii = 0; ii < operators.size(); ++ii)
{
//qDebug() << "SetupPageUserDataPage::slotOperatorsChanged-03 - " << QString::number(ii) << endl;
operatorsOK = world.checkQRZValidFormat(operators.at(ii));
//ent = world.getQRZARRLId(operators.at(ii));
if (operatorsOK)
{
//qDebug() << "SetupPageUserDataPage::slotOperatorsChanged: NO VALID CALL: " << operators.at(ii) << endl;
}
else
{
//qDebug() << "SetupPageUserDataPage::slotOperatorsChanged: VALID CALL: " << operators.at(ii) << endl;
}
}
// cout << fonts.at(i).toLocal8Bit().constData() << endl;
//qDebug() << "SetupPageUserDataPage::slotOperatorsChanged-04" << endl;
if (operatorsOK)
{
//qDebug() << "SetupPageUserDataPage::slotOperatorsChanged: VALID FORMAT" << endl;
//QColor defaultColor = (operatorsLineEdit->palette()).color(QPalette::WindowText);
operatorsLineEdit->setPalette(*defaultPalette);
}
else
{
operatorsLineEdit->setPalette(*wrongPalette);
//qDebug() << "SetupPageUserDataPage::slotOperatorsChanged: NOT VALID FORMAT" << endl;
}
//qDebug() << "SetupPageUserDataPage::slotOperatorsChanged-05" << endl;
/*
cqzLineEdit->setText(QString::number(world.getQRZCqz(qrzLineEdit->text())));
ituzLineEdit->setText(QString::number(world.getQRZItuz(qrzLineEdit->text())));
myLocatorLineEdit->setText(world.getQRZLocator(qrzLineEdit->text()));
*/
//operatorsLineEdit->setText(_a);
operatorsLineEdit->setCursorPosition(i);
//qDebug() << "SetupPageUserDataPage::slotOperatorsChanged-END" << endl;
}
QString SetupPageUserDataPage::getOperators()
{
if (operatorsOK)
{
return operatorsLineEdit->text();
}
else
{
return QString();
}
}
bool SetupPageUserDataPage::setOperators(const QString _aux)
{
if (checkOperatorsLineQString(_aux))
{
operatorsLineEdit->setText(_aux);
return true;
}
return false;
}
bool SetupPageUserDataPage::checkOperatorsLineQString(const QString _auxLine)
{
QStringList _aux = _auxLine.split(',');
for (int ii = 0; ii < _aux.size(); ++ii)
{
operatorsOK = world.checkQRZValidFormat(_aux.at(ii));
if (!operatorsOK)
return operatorsOK;
}
return true;
}

157
setuppageuserdata.h Normal file
View File

@ -0,0 +1,157 @@
#ifndef SETUPPAGEUSERDATA_H
#define SETUPPAGEUSERDATA_H
/***************************************************************************
setuppageuserdata.h - description
-------------------
begin : sept 2011
copyright : (C) 2011 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
#include <QtGui>
//#include <QtWidgets>
#include "world.h"
#include "locator.h"
class SetupPageUserDataPage : public QWidget {
Q_OBJECT
public:
SetupPageUserDataPage(QWidget *parent=0);
~SetupPageUserDataPage();
QString getStationQrz();
QString getOperators();
QString getStationLocator();
int getCQz();
int getITUz();
QString getName();
QStringList getAddress();
QString getAddress1();
QString getAddress2();
QString getAddress3();
QString getAddress4();
QString getCity();
QString getZipCode();
QString getProvince();
QString getCountry();
bool setName (const QString _aux);
bool setAddress1 (const QString _aux);
bool setAddress2 (const QString _aux);
bool setAddress3 (const QString _aux);
bool setAddress4 (const QString _aux);
bool setAddress (const QStringList _aux);
bool setCity (const QString _aux);
bool setZipCode (const QString _aux);
bool setProvince (const QString _aux);
bool setCountry (const QString _aux);
bool setStationQrz(const QString _qrz);
bool setOperators(const QString _aux);
bool setStationLocator(const QString _loc);
bool setCQz(const int _cqz);
bool setITUz(const int _ituz);
QString getRig1();
QString getRig2();
QString getRig3();
QString getAntenna1();
QString getAntenna2();
QString getAntenna3();
QStringList getRigs();
QStringList getAntennas();
QString getPower();
bool setRigs(const QStringList _aux);
bool setAntennas(const QStringList _aux);
bool setPower(const QString _aux);
bool setRig1 (const QString _aux);
bool setRig2 (const QString _aux);
bool setRig3 (const QString _aux);
bool setAntenna1 (const QString _aux);
bool setAntenna2 (const QString _aux);
bool setAntenna3 (const QString _aux);
private slots:
void slotMyLocatorTextChanged();
void slotOperatorsChanged();
void slotQRZTextChanged();
// void slotContestOverLayChanged(int i);
private:
bool checkOperatorsLineQString(const QString _auxLine);
QTabWidget *tabWidget;
QLineEdit *qrzLineEdit; // Station Callsign
QLineEdit *operatorsLineEdit; //Operators
QLineEdit *cqzLineEdit;
QLineEdit *ituzLineEdit;
QLineEdit *myLocatorLineEdit;
QLabel *myLocatorLabel;
//Personal Tab
QLineEdit *nameLineEdit;
QTextEdit *addressTextEdit;
QLineEdit *address1LineEdit;
QLineEdit *address2LineEdit;
QLineEdit *address3LineEdit;
QLineEdit *address4LineEdit;
QLineEdit *cityLineEdit;
QLineEdit *zipLineEdit;
QLineEdit *provinceLineEdit;
QLineEdit *countryLineEdit;
// Station Tab
QLineEdit *rig1LineEdit;
QLineEdit *rig2LineEdit;
QLineEdit *rig3LineEdit;
QLineEdit *ant1LineEdit;
QLineEdit *ant2LineEdit;
QLineEdit *ant3LineEdit;
//QLineEdit *powerLineEdit;
QDoubleSpinBox *myPowerSpinBox;
QPalette *defaultPalette, *wrongPalette;
QColor redColor;
Locator *locator;
World world;
bool operatorsOK;
bool operatorOK;
};
#endif // SETUPPAGEUSERDATA_H

255
setuppageworldeditor.cpp Normal file
View File

@ -0,0 +1,255 @@
#include "setuppageworldeditor.h"
SetupPageWorldEditor::SetupPageWorldEditor(QWidget *parent) : QWidget(parent)
{
//qDebug() << "SetupPageWorldEditor::SetupPageWorldEditor" << endl;
//worldPanel = new QWidget;
world = new World();
setupEntityDialog = new SetupEntityDialog();
worldModel = new QSqlRelationalTableModel(this);
worldView = new QTableView;
worldView->setContextMenuPolicy(Qt::CustomContextMenu);
worldView->setSortingEnabled(true);
createWorldModel();
createWorldPanel();
worldView->setCurrentIndex(worldModel->index(0, 0));
addEntityPushButton = new QPushButton;
delEntityPushButton = new QPushButton;
editEntityPushButton = new QPushButton;
exportWorldPushButton = new QPushButton;
loadWorldPushButton = new QPushButton;
addEntityPushButton->setText("Add");
delEntityPushButton->setText("Delete");
editEntityPushButton->setText("Edit");
exportWorldPushButton->setText("Export World");
loadWorldPushButton->setText("Import World");
addEntityPushButton->setEnabled(false);
delEntityPushButton->setEnabled(false);
editEntityPushButton->setEnabled(false);
addEntityPushButton->setToolTip("Still not implemented.");
delEntityPushButton->setToolTip("Still not implemented.");
editEntityPushButton->setToolTip("Still not implemented.");
exportWorldPushButton->setEnabled(false);
loadWorldPushButton->setEnabled(false);
exportWorldPushButton->setToolTip("Still not implemented.");
loadWorldPushButton->setToolTip("Still not implemented.");
QHBoxLayout *buttonsLayout = new QHBoxLayout;
buttonsLayout->addWidget(exportWorldPushButton);
buttonsLayout->addWidget(loadWorldPushButton);
buttonsLayout->addSpacerItem(new QSpacerItem(10,0,QSizePolicy::Expanding,QSizePolicy::Maximum));
buttonsLayout->addWidget(addEntityPushButton);
buttonsLayout->addWidget(editEntityPushButton);
buttonsLayout->addWidget(delEntityPushButton);
/*
QHBoxLayout *wbuttonsLayout = new QHBoxLayout;
wbuttonsLayout->addSpacerItem(new QSpacerItem(10,0,QSizePolicy::Expanding,QSizePolicy::Maximum));
wbuttonsLayout->addWidget(exportWorldPushButton);
wbuttonsLayout->addWidget(loadWorldPushButton);
QHBoxLayout *buttonsLayout = new QHBoxLayout;
buttonsLayout->addLayout(wbuttonsLayout);
buttonsLayout->addLayout(ebuttonsLayout);
*/
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(worldView);
layout->addLayout(buttonsLayout);
setLayout(layout);
createActions();
}
SetupPageWorldEditor::~SetupPageWorldEditor()
{
//qDebug() << "SetupPageWorldEditor::~SetupPageWorldEditor" << endl;
}
void SetupPageWorldEditor::createWorldPanel()
{
worldView->setModel(worldModel);
QString stringQuery = QString("SELECT * FROM entity");
QSqlQuery query(stringQuery);
QSqlRecord rec = query.record(); // Number of columns
int columns = rec.count();
for (int i = 0; i < columns; i++ ){
worldView->setColumnHidden(i, true);
}
columns = rec.indexOf("mainprefix");
worldView->setColumnHidden(columns, false);
columns = rec.indexOf("name");
worldView->setColumnHidden(columns, false);
columns = rec.indexOf("dxcc");
worldView->setColumnHidden(columns, false);
columns = rec.indexOf("continent");
worldView->setColumnHidden(columns, false);
columns = rec.indexOf("cqz");
worldView->setColumnHidden(columns, false);
columns = rec.indexOf("ituz");
worldView->setColumnHidden(columns, false);
columns = rec.indexOf("utc");
worldView->setColumnHidden(columns, false);
columns = rec.indexOf("latitude");
worldView->setColumnHidden(columns, false);
columns = rec.indexOf("longitude");
worldView->setColumnHidden(columns, false);
columns = rec.indexOf("deleted");
worldView->setColumnHidden(columns, false);
columns = rec.indexOf("sincedate");
worldView->setColumnHidden(columns, false);
columns = rec.indexOf("todate");
worldView->setColumnHidden(columns, false);
worldView->setItemDelegate(new QSqlRelationalDelegate(this));
worldView->setSelectionMode( QAbstractItemView::SingleSelection);
worldView->setSelectionBehavior(QAbstractItemView::SelectRows);
worldView->resizeColumnsToContents();
worldView->horizontalHeader()->setStretchLastSection(true);
}
void SetupPageWorldEditor::createWorldModel()
{
/*
WORLD_DXCCid = 0,
WORLD_Nameid = 1,
WORLD_MainPrefix = 2,
WORLD_CQZ = 3,
WORLD_ITUZ = 4,
WORLD_Cont = 5
*/
QString stringQuery = QString("SELECT * FROM entity");
QSqlQuery q(stringQuery);
QSqlRecord rec = q.record();
int nameCol;
//worldModel = new QSqlRelationalTableModel(this);
worldModel->setTable("entity");
worldModel->setEditStrategy(QSqlTableModel::OnFieldChange);
nameCol = rec.indexOf("mainprefix");
worldModel->setSort(nameCol, Qt::AscendingOrder);
worldModel->setHeaderData(nameCol, Qt::Horizontal, tr("Prefix"));
nameCol = rec.indexOf("name");
worldModel->setHeaderData(nameCol, Qt::Horizontal, tr("Entity"));
nameCol = rec.indexOf("dxcc");
worldModel->setHeaderData(nameCol, Qt::Horizontal, tr("ARRL id"));
nameCol = rec.indexOf("continent");
worldModel->setHeaderData(nameCol, Qt::Horizontal, tr("Continent"));
nameCol = rec.indexOf("cqz");
worldModel->setHeaderData(nameCol, Qt::Horizontal, tr("CQ Zone"));
nameCol = rec.indexOf("ituz");
worldModel->setHeaderData(nameCol, Qt::Horizontal, tr("ITU Zone"));
nameCol = rec.indexOf("utc");
worldModel->setHeaderData(nameCol, Qt::Horizontal, tr("UTC"));
nameCol = rec.indexOf("latitude");
worldModel->setHeaderData(nameCol, Qt::Horizontal, tr("Latitude"));
nameCol = rec.indexOf("longitude");
worldModel->setHeaderData(nameCol, Qt::Horizontal, tr("Longitude"));
nameCol = rec.indexOf("deleted");
worldModel->setHeaderData(nameCol, Qt::Horizontal, tr("Deleted"));
nameCol = rec.indexOf("sincedate");
worldModel->setHeaderData(nameCol, Qt::Horizontal, tr("Since Date"));
nameCol = rec.indexOf("deleted");
worldModel->setHeaderData(nameCol, Qt::Horizontal, tr("To Date"));
worldModel->select();
}
void SetupPageWorldEditor::createActions()
{
//qDebug() << "SetupPageWorldEditor::createActions" << endl;
connect(addEntityPushButton, SIGNAL(clicked()), this, SLOT(slotAddButtonClicked()) );
connect(delEntityPushButton, SIGNAL(clicked()), this, SLOT(slotDelButtonClicked()) );
connect(editEntityPushButton, SIGNAL(clicked()), this, SLOT(slotEditButtonClicked()) );
connect(worldView, SIGNAL(doubleClicked ( const QModelIndex& ) ), this, SLOT(slotDoubleClickEntity( const QModelIndex& ) ) );
//SIGNAL received from the setupEntityDialog
// void entityAdded(const QStringList _qs); // entity
connect(setupEntityDialog, SIGNAL(entityAdded(QStringList)), this, SLOT(slotAnalyzeEntityAddedSignal(QStringList) ) );
}
void SetupPageWorldEditor::slotAnalyzeEntityAddedSignal(const QStringList _qs)
{
/*
//qDebug() << "SetupPageWorldEditor::slotAnalyzeEntityAddedSignal\n" <<
_qs.at(0) << "\n" <<
_qs.at(1) << "\n" <<
_qs.at(2) << "\n" <<
_qs.at(3) << "\n" <<
_qs.at(4) << "\n" <<
_qs.at(5) << "\n" <<
_qs.at(6) << "\n" <<
_qs.at(7) << "\n" <<
_qs.at(8) << "\n" <<
_qs.at(9) << "\n" <<
_qs.at(10) << "\n" << endl;
*/
}
void SetupPageWorldEditor::slotAddButtonClicked()
{
//qDebug() << "SetupPageWorldEditor::slotAddButtonClicked" << endl;
setupEntityDialog->exec();
//TODO
}
void SetupPageWorldEditor::slotDelButtonClicked()
{
//qDebug() << "SetupPageWorldEditor::slotDelButtonClicked" << endl;
//TODO
}
void SetupPageWorldEditor::slotEditButtonClicked()
{
//qDebug() << "SetupPageWorldEditor::slotEditButtonClicked" << endl;
//TODO
}
void SetupPageWorldEditor::slotDoubleClickEntity( const QModelIndex & index)
{
//qDebug() << "SetupPageWorldEditor::slotDoubleClickEntity" << endl;
//TODO
QSqlQuery query;
QString queryString;
int row = index.row();
//qDebug() << "SetupPageWorldEditor::slotDoubleClickEntity: ARRLid: " << QString::number((worldModel->index(row, 8)).data(0).toInt()) << endl;
}

81
setuppageworldeditor.h Normal file
View File

@ -0,0 +1,81 @@
#ifndef SETUPPAGEWORLDEDITOR_H
#define SETUPPAGEWORLDEDITOR_H
/***************************************************************************
setuppageworldeditor.h - description
-------------------
begin : jun 2012
copyright : (C) 2012 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
//#include <QtWidgets>
#include <QtGui>
#include <QtSql>
#include <QDialog>
#include "world.h"
#include "setupentitydialog.h"
enum
{
WORLD_DXCCid = 0,
WORLD_Nameid = 1,
WORLD_MainPrefix = 2,
WORLD_CQZ = 3,
WORLD_ITUZ = 4,
WORLD_Cont = 5
};
class SetupPageWorldEditor : public QWidget {
Q_OBJECT
public:
SetupPageWorldEditor(QWidget *parent=0);
~SetupPageWorldEditor();
private slots:
void slotAddButtonClicked();
void slotDelButtonClicked();
void slotEditButtonClicked();
void slotDoubleClickEntity( const QModelIndex & index);
void slotAnalyzeEntityAddedSignal(const QStringList _qs);
private:
World *world;
void createWorldPanel();
void createWorldModel();
void createActions();
QSqlRelationalTableModel *worldModel;
QWidget *worldPanel;
QTableView *worldView;
QTreeWidget *searchResultsTreeWidget;
QPushButton *addEntityPushButton, *delEntityPushButton, *editEntityPushButton, *exportWorldPushButton, *loadWorldPushButton;
SetupEntityDialog *setupEntityDialog;
};
#endif // SETUPPAGEWORLDEDITOR_H

1051
startwizard.cpp Normal file

File diff suppressed because it is too large Load Diff

156
startwizard.h Normal file
View File

@ -0,0 +1,156 @@
#ifndef STARTWIZARD_H
#define STARTWIZARD_H
#include <QWizard>
#include <QWizardPage>
#include <QtGui>
//#include <QtWidgets>
#include <QTranslator>
#include <QLocale>
#include <QLibraryInfo>
#include <QProgressDialog>
#include "downloadcty.h"
class FileOrMemoryPage;
class CTYPage;
class StartWizard : public QWizard
{
Q_OBJECT
public:
enum { Page_Intro, Page_Lic, Page_Mem, Page_CTY };
StartWizard(const QString _kontestDir, const QString _softVersion, QWidget *parent = 0);
void setVersion(QString tversion);
//~StartWizard();
protected:
private slots:
void slotCancelWizard();
void slotRunInMemory(bool checked);
void slotButtonFinishedClicked();
//void fin();
private:
FileOrMemoryPage *fileOrMemoryPage;
CTYPage *ctyPage;
QString version;
bool inMemory;
QString kontestDir;
};
class IntroPage : public QWizardPage
{
Q_OBJECT
public:
IntroPage(QWidget *parent = 0);
int nextId() const;
private:
QLabel *topLabel;
QTextEdit *welcomeBrowser;
};
class LicPage : public QWizardPage
{
Q_OBJECT
public:
LicPage(QWidget *parent = 0);
void setNextButtonActive(const bool _active);
int nextId() const;
private:
QLabel *topLabel;
QTextEdit *licenseBrowser;
QCheckBox *aceptLicCheckBox;
};
class FileOrMemoryPage : public QWizardPage
{
Q_OBJECT
public:
FileOrMemoryPage(QWidget *parent = 0);
int nextId() const;
//int nextId() const;
private slots:
void slotRunningModeSelectedFile(bool checked);
void slotRunningModeSelectedMemory(bool checked);
signals:
void exeInMemory(const bool mem);
private:
bool downloadCTYFile();
QLabel *topLabel;
QRadioButton *memoryRadioButton;
QRadioButton *fileRadioButton;
bool runInMemory;
};
class CTYPage : public QWizardPage
{
Q_OBJECT
public:
CTYPage(const QString _kontestDir, QWidget *parent = 0);
void updateProgress (qint64 v,qint64 t);
private slots:
/*
void slotCTYCheckButtonTogled(int state);
void slotDownloadCTY(bool checked);
void slotDownloadFinished();
void slotValueReturnedFromDownload(int value);
void slotDownloadButtonClicked();
*/
void slotUpdateDownloadProgress(qint64 received, qint64 total);
void slotDownloadButtonClicked();
void slotIgnoreDownloadButtonClicked();
void slotDownloadFinished(const int ret);
void slotDownloadError(const int ret);
signals:
void downloadTheFileSignal(const bool mem);
private:
bool prepareTheDownload();
bool doTheDownload();
//bool isComplete();
bool downloadCTYFile, CTYFileDownloaded;
int downloadValueResult;
//QString kontestDir;
int total;
//bool completed;
DownLoadCTY *dl;
QLabel *topLabel;
QTextEdit *ctyBrowser;
QCheckBox *downloadCTYCheckBox;
QProgressBar *progressBar;
QPushButton *downloadButton, *ignoreDownloadButton;
QCheckBox *hiddenCheckBox;
};
#endif // STARTWIZARD_H

12
tips-for-devel.txt Normal file
View File

@ -0,0 +1,12 @@
SQLite
http://www.w3schools.com/sql/default.asp
Transfer or populate sqlite table to another table
INSERT INTO TABLE2 (COL1, COL2, COL3) SELECT COL1, COL4, COL7 FROM TABLE1
Select only different DXCC
select count (distinct dxcc) from log
DELETED ENTITIES:
http://www.ng3k.com/Dxcc/dxccde.html

1735
world.cpp Normal file

File diff suppressed because it is too large Load Diff

144
world.h Normal file
View File

@ -0,0 +1,144 @@
#ifndef WORLD_H
#define WORLD_H
/***************************************************************************
world.h - description
-------------------
begin : sept 2011
copyright : (C) 2011 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog 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. *
* *
* KLog 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 KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
//#include <QtWidgets>
#include <QString>
#include <QFile>
#include <QStringList>
#include <QSqlRelationalTableModel>
#include <QSqlQuery>
#include <QSqlError>
#include <QProgressBar>
#include <QProgressDialog>
#include <QtGlobal>
#include <QtDebug>
#include "locator.h"
//#include "awards.h"
class QStringList;
enum
{
Entity_Name = 1,
Entity_Continent = 2
};
class World : public QWidget
{
//friend class Awards;
public:
World();
World(const QString _kontestDir);
World(const QString _kontestDir, const QString _kontestVer);
~World();
bool create(const QString _kontestDir);
bool recreate(const QString _kontestDir);
QString getQRZEntityName(const QString _qrz);
QString getEntityName(const int _entityN);
QString getQRZEntityMainPrefix(const QString _qrz);
QString getEntityMainPrefix(const int _entityN);
QString getQRZContinentNumber(const QString _qrz); // Returns the continent id number
int getContinentNumber(const int _enti); // Returns the continent id number
QString getQRZContinentShortName(const QString _qrz); // Returns the continent shortName (EU, AF, ...)
QString getContinentShortName(const int _enti);
QString getQRZLocator(const QString _qrz); // Returns the entity locator
QString getLocator(const int _entityN); // Returns the entity locator
double getQRZLongitude(const QString _qrz); // Returns the longitude of the Entity
double getLongitude(const int _enti); // Returns the longitude of the Entity
double getQRZLatitude(const QString _qrz); // Returns the latitude of the Entity
double getLatitude(const int _enti); // Returns the latitude of the Entity
int getQRZCqz(const QString _qrz);
int getEntityCqz(const int _enti);
int getQRZItuz(const QString _qrz);
int getEntityItuz(const int _enti);
int getQRZARRLId(const QString _qrz); //Returns the ARRL id of the Entity from a QRZ & Returns -1 if not found.
bool isNewCQz(const int _cqz);
bool isNewEntity(const int _entityN);
int getBandIdFromFreq(const QString fr);
QString getQRZEntityPrefixes(const QString _qrz);
QString getEntityPrefixes(const int _enti);
bool checkQRZValidFormat(const QString _qrz);
QStringList getEntitiesNames();
private slots:
private:
int getPrefixId(const QString _qrz);
bool readCTYDAT();
bool readCTYCSV();
QStringList processLine(const QString _line);
QStringList processLineP(const QString _line, const int _processingEntity);
void createWorldModel();
QStringList readZones(const QString &pref, const int _cq, const int _itu);
QString changeSlashAndFindPrefix(const QString _qrz); // Changes the \ into / and find the country prefix
int progressBarPosition;
bool created;
QString kontestDir, kontestVersion;
int cqz, ituz, numberOfEntities;
QString entityName;
QString currentPrefix; // Used in the progressBar
bool ret;
QStringList list, prefixAndZones;
QString continentName, prefix;
int continentId;
double lat, lon, utc;
//QString line;
//bool readingDataOfAnEntity;
int nullValue;
QSqlRelationalTableModel *worldModel;
//QProgressBar *progressBar;
Locator *locator;
//Awards *awards;
};
#endif // WORLD_H