COPYING 0000664 0001750 0001750 00000104516 12344062235 011167 0 ustar yakov yakov GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Copyright (C)
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
.
HercConfiguration/ 0000775 0001750 0001750 00000000000 12346767636 013561 5 ustar yakov yakov HercConfiguration/DeviceListView.h 0000664 0001750 0001750 00000002435 12300664722 016602 0 ustar yakov yakov /*
* File: DeviceListView.h
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* This object manages the device list presented during run time by Devices
*
* 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 .
*
*/
#ifndef DEVICELISTVIEW_H_
#define DEVICELISTVIEW_H_
#include "HerculesStudio.h"
#include
#include
#include
class DeviceListView : public QListView
{
Q_OBJECT
public:
DeviceListView(QWidget * parent);
virtual ~DeviceListView();
protected:
void mousePressEvent ( QMouseEvent * e );
signals:
void deviceClick(QMouseEvent *);
};
#endif /* DEVICELISTVIEW_H_ */
HercConfiguration/DevicesRename.h 0000664 0001750 0001750 00000002655 12300664722 016432 0 ustar yakov yakov /*
* File: DevicesPane.h
*
* Author: Jacob Dekel
* Created on: Nov 1, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* This object handles the re-initialization of devices during hercules run time
*
* 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 .
*
*/
#ifndef DEVICESRENAME_H
#define DEVICESRENAME_H
#include "Configuration.h"
#include
#include "ui_DevicesRename.h"
class DevicesRename : public QDialog
{
Q_OBJECT
public:
DevicesRename(int value, int newValue, QWidget *parent = 0);
virtual ~DevicesRename();
public slots:
void ok();
void notok();
signals:
void accepted(QString oldValue, QString newValue);
void rejected();
private:
Ui::DevicesRenameClass ui;
int mInitialDevNum;
Configuration::HexSpinBox* mSpinBox;
};
#endif // DEVICESRENAME_H
HercConfiguration/hercconfiguration.ui 0000664 0001750 0001750 00000000656 12300664722 017616 0 ustar yakov yakov
HercConfigurationClass
0
0
400
300
HercConfiguration
HercConfiguration/DasdProperties.cpp 0000644 0001750 0001750 00000020045 12344062251 017167 0 ustar yakov yakov /*
* File: DasdProperties.cpp
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* 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 .
*
*/
#include "DasdProperties.h"
#include "Preferences.h"
#include
#include
#include
std::string DasdProperties::ckd[] = {"2305", "2311", "2314", "3330", "3340", "3350",
"3375", "3380", "3390", "9345", ""};
std::string DasdProperties::fba[] = {"3310", "3370", "9332", "9335", "9336", "0671", ""};
DasdProperties::DasdProperties(ConfigLine& configLine, QWidget *parent)
: GenericDeviceProperties(configLine, parent)
{
ui.setupUi(this);
connect(ui.okButton, SIGNAL(clicked()), this, SLOT(ok()));
connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(cancel()));
connect(ui.typeCombo, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(typeChanged(const QString &)));
connect(ui.localRadioButton,SIGNAL(toggled(bool)), this, SLOT(localInetChanged()));
connect(ui.browseButton, SIGNAL(clicked()), this, SLOT(browseClicked()));
connect(ui.browseShadowButton, SIGNAL(clicked()), this, SLOT(browseShadowClicked()));
initialize(configLine);
}
DasdProperties::~DasdProperties()
{
}
void DasdProperties::ok()
{
if (!deviceNumberValidator(ui.deviceNumber))
return;
std::stringstream newLineBuff;
newLineBuff << ui.deviceNumber->text().toStdString() << " "
<< ui.typeCombo->currentText().toStdString();
if (ui.localRadioButton->isChecked())
{
if (ui.filename->text().isEmpty())
{
QMessageBox * p = new QMessageBox(this);
p->setText("Please enter file name");
p->exec();
ui.filename->setFocus();
return;
}
newLineBuff << " " << ui.filename->text().toStdString();
}
else
{
if (!validateIp(ui.remotehost, false, false))
return;
newLineBuff << " " << ui.remotehost->text().toStdString() << ":" << ui.portSpinBox->value() << ":" << ui.devnoSpinBox->value();
}
if (ui.nosynchioCheckBox->isChecked())
newLineBuff << " nosyncio";
if (!ui.shadow->text().isEmpty())
newLineBuff << " sf=" << ui.shadow->text().toStdString();
if (!isFba(ui.typeCombo->currentText().toStdString()))
{
if (ui.cuComboBox->currentIndex()>0)
newLineBuff << " cu=" << ui.cuComboBox->currentText().toStdString();
if (!ui.standardRadioButton->isChecked())
{
newLineBuff << (ui.ReadonlyRadioButton->isChecked() ? " readonly" : " fakewrite");
}
}
else
{
//TODO
}
newLineBuff << "\n";
mLine.replaceLine(newLineBuff.str());
emit updateLine(true);
this->deleteLater();
}
void DasdProperties::cancel()
{
emit updateLine(false);
this->deleteLater();
}
void DasdProperties::browseClicked()
{
std::string s = QFileDialog::getOpenFileName(this,
"Locate DASD File",
Preferences::getInstance().configDir().c_str(),
tr("All files(*)")).toUtf8().data();
ui.filename->setText(s.c_str());
}
void DasdProperties::browseShadowClicked()
{
std::string s = QFileDialog::getOpenFileName(this,
"Locate Shadow DASD File",
Preferences::getInstance().configDir().c_str(),
tr("All files(*)")).toUtf8().data();
ui.shadow->setText(s.c_str());
}
void DasdProperties::typeChanged(const QString& newValue)
{
if (isFba(newValue.toStdString()))
setFba(true);
else
setCkd(true);
}
void DasdProperties::localInetChanged()
{
if (ui.localRadioButton->isChecked())
{
setLocal(true);
}
else
setInet(true);
}
void DasdProperties::setLocal(bool set)
{
if (set)
setInet(!set);
ui.filenameLabel->setVisible(set);
ui.filename->setVisible(set);
ui.browseButton->setVisible(set);
ui.shadowLabel->setVisible(set);
ui.shadow->setVisible(set);
ui.browseShadowButton->setVisible(set);
}
void DasdProperties::setInet(bool set)
{
if (set)
setLocal(!set);
ui.remotehostLabel->setVisible(set);
ui.remotehost->setVisible(set);
ui.portLabel->setVisible(set);
ui.portSpinBox->setVisible(set);
ui.devnoLabel->setVisible(set);
ui.devnoSpinBox->setVisible(set);
}
bool DasdProperties::isFba(const std::string& dev)
{
int i=0;
while (fba[i] != "")
{
if (dev == fba[i])
return true;
i++;
}
return false;
}
void DasdProperties::setFba(bool set)
{
if (set) setCkd(false);
}
void DasdProperties::setCkd(bool set)
{
if (set) setFba(false);
ui.ioModeGroupbox->setVisible(set);
ui.cuComboBox->setVisible(set);
ui.cuLabel->setVisible(set);
}
bool DasdProperties::isInet(const std::string& fileName, stringArray & vec)
{
int count;
size_t ppos= -1;
size_t pos = -2;
for (count = 0; count < 3 && pos != std::string::npos; count++)
{
pos = fileName.find(':',ppos+1);
if (pos != std::string::npos)
{
std::string s = fileName.substr(ppos+1,pos-ppos-1);
vec[count] = s;
ppos = pos;
}
else if (count ==2)
vec[2] = fileName.substr(ppos+1);
}
return count==3;
}
void DasdProperties::initialize(ConfigLine& line)
{
ui.deviceNumber->setText(line.getToken(0).c_str());
int origType = ui.typeCombo->currentIndex();
for (int i=0; imaxCount(); i++)
{
ui.typeCombo->setCurrentIndex(i);
if (ui.typeCombo->currentText().toStdString() == line.getToken(1))
break;
else
ui.typeCombo->setCurrentIndex(-1);
}
if (ui.typeCombo->currentIndex() == -1)
ui.typeCombo->setCurrentIndex(origType);
std::string vec[3];
if (isInet(line.getToken(2), vec))
{
ui.remotehost->setText(vec[0].c_str());
ui.portSpinBox->setValue(atoi(vec[1].c_str()));
ui.devnoSpinBox->setValue(atoi(vec[2].c_str()));
ui.inetRadioButton->setChecked(true);
}
else
{
std::string token = line.getToken(2);
ui.filename->setText(token.c_str());
}
for (int i=2; isetText(line.getToken(i).substr(3).c_str());
}
else if (line.getToken(i) == "nosyncio" || line.getToken(i) == "syio")
{
ui.nosynchioCheckBox->setChecked(true);
}
else if (line.getToken(i) == "nosyncio" || line.getToken(i) == "syio")
{
ui.nosynchioCheckBox->setChecked(true);
}
else if (line.getToken(i) == "readonly" || line.getToken(i) == "rdonly"|| line.getToken(i) == "ro")
{
ui.ReadonlyRadioButton->setChecked(true);
}
else if (line.getToken(i) == "fakewrite" || line.getToken(i) == "fakewrt"|| line.getToken(i) == "fw")
{
ui.fakeWritesRadioButton->setChecked(true);
}
else if (line.getToken(i).substr(0,3) == "cu=")
{
std::string cu = line.getToken(i).substr(3);
for (int ii=0; iimaxCount(); ii++)
{
ui.cuComboBox->setCurrentIndex(ii);
if (ui.cuComboBox->currentText().toStdString() == cu)
break;
else
ui.cuComboBox->setCurrentIndex(-1);
}
}
}
localInetChanged();
typeChanged(ui.typeCombo->currentText());
}
HercConfiguration/TerminalProperties.h 0000664 0001750 0001750 00000002745 12300664722 017550 0 ustar yakov yakov /*
* File: TerminalProperties.h
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* This object manages the terminal configuration properties
*
* 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 .
*
*/
#ifndef TERMINALPROPERTIES_H
#define TERMINALPROPERTIES_H
#include "ConfigLine.h"
#include "GenericDeviceProperties.h"
#include "HerculesStudio.h"
#include "ui_TerminalProperties.h"
class TerminalProperties : public GenericDeviceProperties
{
Q_OBJECT
public:
TerminalProperties(ConfigLine& line,QWidget *parent = 0);
virtual ~TerminalProperties();
protected:
Ui::TerminalPropertiesClass & getUi() { return ui;};
virtual bool isSysg();
private:
Ui::TerminalPropertiesClass ui;
private slots:
void ok();
void cancel();
signals:
void updateLine(bool keep);
};
#endif // TERMINALPROPERTIES_H
HercConfiguration/SystemConfigLine.cpp 0000664 0001750 0001750 00000002061 12300664722 017464 0 ustar yakov yakov /*
* File: SystemConfigLine.cpp
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* 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 .
*
*/
#include "SystemConfigLine.h"
#include "HerculesStudio.h"
SystemConfigLine::SystemConfigLine(const char *line) :
ConfigLine(line)
{
}
SystemConfigLine::~SystemConfigLine()
{
}
std::string SystemConfigLine::getKeyword() const
{
return getToken(0);
}
HercConfiguration/DevicesPane.cpp 0000644 0001750 0001750 00000033535 12344062251 016435 0 ustar yakov yakov /*
* File: DevicesPane.cpp
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* 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 .
*
*/
#include "DevicesPane.h"
#include "DevicesRename.h"
#include "MainWindow.h"
#include "VisualizedDeviceEntry.h"
#include "Environment.h"
#include "HerculesStudio.h"
#include "GenericDeviceProperties.h"
#include "StringTokenizer.h"
#include
#include
#include
#include
#include
#include
DevicesPane::DevicesPane(QWidget *parent)
: DeviceMenuProcessor(parent),
StatusUpdateCollector(),
mLayout(NULL),
mListView(NULL),
mModel(NULL),
mRenameDlg(NULL),
mOldDevNum(-1)
{
ui.setupUi(this);
std::string iconsPath = Environment::getIconsPath() + "/yellow.png";
mYellowIcon = new QIcon(iconsPath.c_str());
iconsPath = Environment::getIconsPath() + "/yellowhigh.png";
mYellowHighIcon = new QIcon(iconsPath.c_str());
mMainWindow = dynamic_cast(parent);
}
DevicesPane::~DevicesPane()
{
delete mYellowIcon;
delete mYellowHighIcon;
delete mListView;
mDevices.clear();
}
bool DevicesPane::notify(const QByteArray& statusLine)
{
hOutDebug(1,"devices notify:" << statusLine.data() << ".");
const struct DynDeviceLine * line = reinterpret_cast(statusLine.data());
int devNo;
VisualizedDeviceEntry deviceEntry;
bool deviceAdded = false;
if (strncmp(line->DEV,"DEV",3) == 0)
{
DeviceTypes::Type devType = DeviceTypes::Other;
switch (line->action)
{
case('A'):
if (strncmp(line->devType,"DASD",4)==0)
devType= DeviceTypes::DASD;
else if (strncmp(line->devType,"CTC",3)==0)
devType= DeviceTypes::CTC;
else if (strncmp(line->devType,"OSA",3)==0)
devType= DeviceTypes::Comm;
else if (strncmp(line->devType,"QETH",4)==0)
devType= DeviceTypes::Comm;
else if (strncmp(line->devType,"RDR ",4)==0)
devType= DeviceTypes::CardReader;
else if (strncmp(line->devType,"PCH ",4)==0)
devType= DeviceTypes::CardReader;
else if (strncmp(line->devType,"PRT ",4)==0)
devType= DeviceTypes::Printer;
else if (strncmp(line->devType,"DSP ",4)==0)
devType= DeviceTypes::Terminal;
else if (strncmp(line->devType,"TAPE",4)==0)
devType= DeviceTypes::Tape;
else if (strncmp(line->devType,"CON",3)==0)
devType= DeviceTypes::Console;
devNo = strtol(line->devNo, NULL, 16);
{
VisualizedDeviceEntry deviceEntryPtr(devNo, devType, statusLine.data());
std::pair toinsert(devNo, deviceEntryPtr);
mDevices.insert(toinsert);
hOutDebug(5, "to be added:" << statusLine.data() << " " << (devNo !=0 ? "added" : "NOT ADDED")) ;
if (devNo !=0) deviceAdded = true; // after disconnect and attach, herculess starts sending DEVA instead of DEVC
}
break;
case('C'):
devNo = strtol(line->devNo, NULL, 16);
if (mDevices.find(devNo) != mDevices.end())
{
deviceEntry = mDevices[devNo];
if (deviceEntry.getItem() != NULL)
{
if (line->statusBytes[1] == '1')
{
deviceEntry.getItem()->setIcon(*mYellowHighIcon);
}
else
{
deviceEntry.getItem()->setIcon(*mYellowIcon);
}
}
}
else
{
hOutDebug(1,"sending restart");
mDevices.clear();
//emit restartDevices();
}
break;
case('D'):
{
devNo = strtol(line->devNo, NULL, 16);
std::map ::iterator it = mDevices.find(devNo);
if (it != mDevices.end())
{
mDevices.erase(it);
deviceAdded = true;
}
}
break;
default:
break;
}
}
if (deviceAdded)
{
hOutDebug(3,mDevices.size() << " Devices.");
if (mModel == NULL) mModel = new QStandardItemModel();
mModel->clear();
QStandardItem *parentItem = mModel->invisibleRootItem();
int currLine = 0;
std::map::iterator it;
for (int curDev=0; curDev<=DeviceTypes::Comm; curDev++ )
{
hOutDebug(5,"curDev:" << curDev);
bool titleDevAdded = false;
for (it = mDevices.begin(); it != mDevices.end(); it++)
{
VisualizedDeviceEntry& ent = it->second;
if (ent.getType() == curDev)
{
hOutDebug(5,"ent:" << ent.getDeviceNumber()<<" "<setEditable(false);
parentItem->appendRow(item);
currLine++;
titleDevAdded=true;
}
char ss[255];
std::string def = ent.getDefinition();
size_t pos=def.find('\r');
while (pos != std::string::npos)
{
def.replace(pos,def.size()," ");
pos = def.find('\r');
}
sprintf(ss,"%4.4X %s",ent.getDeviceNumber(), def.substr(25).c_str());
if (ent.getIcon() == NULL)
{
ent.setIcon(mYellowIcon);
}
ent.setItem(new QStandardItem(*ent.getIcon(), ss));
ent.getItem()->setEditable(false);
std::string tt = ent.getDefinition().substr(10,10).c_str() ;
tt += ent.getDefinition().substr(25).c_str();
ent.getItem()->setToolTip(tt.c_str());
ent.setLineNumber(currLine++);
parentItem->appendRow(ent.getItem());
}
}
}
if (mListView != NULL)
{
mListView->close();
delete mListView;
mListView = NULL;
}
mListView = new DeviceListView(this);
mListView->setModel(mModel);
mListView->setVisible(true);
adjustSize();
connect(mListView, SIGNAL(pressed(QModelIndex)),this,SLOT(mousePressed(QModelIndex)));
connect(mListView, SIGNAL(deviceClick(QMouseEvent *)), this, SLOT(devicesClick(QMouseEvent *)));
return true;
}
else
{
return false;
}
}
void DevicesPane::mousePressed(const QModelIndex index)
{
hOutDebug(1,"pressed " << index.row());
mClickRow = index.row();
}
void DevicesPane::adjustSize()
{
if (mListView != NULL)
mListView->setGeometry(0,0,this->size().width()-10,this->size().height()-10);
}
void DevicesPane::resizeEvent ( QResizeEvent * )
{
adjustSize();
}
QSize DevicesPane::sizeHint() const
{
return QSize(160, 100);
}
void DevicesPane::clear()
{
hOutDebug(1,"DevicesPane clear");
mDevices.clear();
if (mModel != NULL)
mModel->clear();
if (mListView == NULL)
return;
adjustSize();
}
bool DevicesPane::isRealDev(int lineNumber)
{
std::map::iterator it;
for (it = mDevices.begin(); it != mDevices.end(); it++)
{
VisualizedDeviceEntry& ent = it->second;
hOutDebug(5,"compare: " << ent.getLineNumber() << " with " << lineNumber);
if (ent.getLineNumber() == lineNumber) return true;
}
return false;
}
DeviceTypes::Type DevicesPane::getType(int lineNumber)
{
std::map::iterator it;
for (it = mDevices.begin(); it != mDevices.end(); it++)
{
VisualizedDeviceEntry& ent = it->second;
hOutDebug(5,"compare: " << ent.getLineNumber() << " with " << lineNumber);
if (ent.getLineNumber() == lineNumber) return ent.getType();
}
return DeviceTypes::Other;
}
bool DevicesPane::canAddSYSG()
{
return false;
}
bool DevicesPane::realDevice()
{
return (isRealDev(mClickRow));
}
void DevicesPane::doAddDevice(bool)
{
hOutDebug(2,mCandidateLine->getLine());
std::string command = mCandidateLine->getLine();
if (command.length() == 0) return;
command = "attach " + command ;
mMainWindow->issueCommand(command);
mClickRow = -1;
}
void DevicesPane::menuRename()
{
std::map::iterator it = mDevices.begin();
while(it != mDevices.end())
{
hOutDebug(2, "rename " << mLastClick << " " << it->second.getDeviceNumber()
<< " " << it->second.getLineNumber());
if (it->second.getLineNumber() == mLastClick)
{
int devno = it->second.getDeviceNumber();
mRenameDlg = new DevicesRename(devno, getNextDev(it), this);
connect (mRenameDlg,SIGNAL(accepted(QString, QString)),this, SLOT(doRename(QString, QString)));
connect (mRenameDlg,SIGNAL(rejected()), this, SLOT(rejected()));
mRenameDlg->exec();
break;
}
it++;
}
mClickRow=-1;
}
void DevicesPane::doRename(QString oldDevNum, QString newDevNum)
{
hOutDebug(2, "rename " << oldDevNum.toStdString() << " " << newDevNum.toStdString());
mOldDevNum = ConfigurationEditor::parseNum(oldDevNum.toStdString(), 16);
std::stringstream command;
command << "define " << oldDevNum.toStdString() << " " << newDevNum.toStdString() ;
mMainWindow->issueCommand(command.str());
disconnect(mRenameDlg,0,0,0);
mRenameDlg->deleteLater();
}
int DevicesPane::getNextDev(std::map::iterator it) const
{
int ret = it->second.getDeviceNumber()+1;
++it;
while (it != mDevices.end())
{
hOutDebug(5,"examining ret=" << ret << " to:" << it->second.getDeviceNumber());
if (it->second.getDeviceNumber() != ret)
return ret;
else
ret = it->second.getDeviceNumber()+1;
++it;
}
return ret;
}
void DevicesPane::rejected()
{
hOutDebug(3, "rejected");
disconnect(mRenameDlg,0,0,0);
mRenameDlg->deleteLater();
}
void DevicesPane::menuDelete()
{
VisualizedDeviceEntry * entry = getDeviceEntry();
if (entry != NULL)
{
std::stringstream command;
command << "detach " << std::hex << entry->getDeviceNumber() ;
mMainWindow->issueCommand(command.str());
}
mClickRow=-1;
return;
}
void DevicesPane::menuInterrupt()
{
VisualizedDeviceEntry * entry = getDeviceEntry();
if (entry != NULL)
{
std::stringstream command;
command << "i " << std::hex << entry->getDeviceNumber() ;
mMainWindow->issueCommand(command.str());
}
mClickRow=-1;
return;
}
void DevicesPane::menuStatus()
{
VisualizedDeviceEntry * entry = getDeviceEntry();
if (entry != NULL)
{
std::stringstream command;
command << "ds " << std::hex << entry->getDeviceNumber() ;
mMainWindow->issueCommand(command.str());
}
mClickRow=-1;
return;
}
bool DevicesPane::traced()
{
VisualizedDeviceEntry * entry = getDeviceEntry();
if (entry != NULL)
{
return entry->traced();
}
return false;
}
void DevicesPane::menuTraceCCW()
{
VisualizedDeviceEntry * entry = getDeviceEntry();
if (entry != NULL)
{
std::stringstream command;
command << "t" << (entry->traced() ? "- " : "+ ") << std::hex << entry->getDeviceNumber() ;
mMainWindow->issueCommand(command.str());
entry->setTraced(!entry->traced());
}
mClickRow=-1;
return;
}
bool DevicesPane::hasConfig()
{
VisualizedDeviceEntry * entry = getDeviceEntry();
if (entry == NULL) return false;
QString devNo = textFromValue(entry->getDeviceNumber());
mCandidateLine = mMainWindow->getConfigurationFile()->getDevice(devNo.toStdString());
return mCandidateLine!= NULL;
}
void DevicesPane::menuProperties()
{
hOutDebug(3,"line=" << mCandidateLine->getLine());
GenericDeviceProperties * mProp = NULL;
try
{
mProp = GenericDeviceProperties::classFactory(*mCandidateLine,
this,
mCandidateLine->getDeviceType());
}
catch (...)
{
hOutDebug(2, "exception caught in class factory (add)");
}
connect(mProp, SIGNAL(updateLine(bool)), this, SLOT(updateDevice(bool)));
mProp->setVisible(true);
mClickRow=-1;
}
void DevicesPane::updateDevice(bool done)
{
if (!done || mCandidateLine == NULL)
{
mClickRow = -1;
return;
}
hOutDebug(5,mCandidateLine->getLine());
std::string command = mCandidateLine->getLine();
command = mCandidateLine->getToken(0) + " " + mCandidateLine->getMultiToken(2, 0);
if (command.length() == 0) return;
command = "devinit " + command ;
mMainWindow->issueCommand(command);
mClickRow = -1;
}
void DevicesPane::doLoadTape(QString& tapeFileName)
{
VisualizedDeviceEntry * entry = getDeviceEntry();
if (entry != NULL)
{
std::stringstream command;
command << "devinit " << std::hex << entry->getDeviceNumber() << " " <issueCommand(command.str());
}
mClickRow=-1;
return;
}
VisualizedDeviceEntry* DevicesPane::getDeviceEntry()
{
hOutDebug(3,"getDeviceEntry - mLastClick=" << mLastClick);
std::map::iterator it = mDevices.begin();
while(it != mDevices.end())
{
if (it->second.getLineNumber() == mLastClick)
{
return &(it->second);
break;
}
it++;
}
return NULL;
}
QString DevicesPane::textFromValue(int value) const
{
std::stringstream ss;
ss << std::hex << value;
char formatted[5];
if (value <= 0xffff)
sprintf(formatted,"%4.4X",(value));
else
strcpy(formatted,"0000");
QString ret(formatted);
hOutDebug(5,"textFromValue:" << value << "='" << ret.toStdString());
return ret;
}
HercConfiguration/ConfigurationEditor.cpp 0000644 0001750 0001750 00000062274 12344062251 020227 0 ustar yakov yakov /*
* File: ConfigurationEditor.cpp
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* 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 .
*
*/
#include "ConfigurationEditor.h"
#include "HerculesStudio.h"
#include
#include
#include
#include
#define min(a,b) ((a) < (b) ? (a) : (b)) //util
#define max(a,b) ((a) > (b) ? (a) : (b)) //util
#define TextItem(PARM,_parm) \
void ConfigurationEditor::PARM(Ui::ConfigurationClass * configUi, const ConfigLine * configLine, Direction dir) \
{ \
handleText(configUi->_parm, configLine, dir);\
}
#define SliderItem(PARM,_parm) \
void ConfigurationEditor::PARM(Ui::ConfigurationClass * configUi, const ConfigLine * configLine, Direction dir) \
{ \
handleSlider(configUi->_parm, configLine, dir); \
}
#define CheckBoxItem(PARM,parm, CHECKED, UNCHECKED) \
void ConfigurationEditor::PARM(Ui::ConfigurationClass * configUi, const ConfigLine * configLine, Direction dir) \
{ \
handleCheckbox(configUi->parm, configLine, dir, #CHECKED, #UNCHECKED); \
}
#define SpinItem(PARM,_parm, default_) \
void ConfigurationEditor::PARM(Ui::ConfigurationClass * configUi, const ConfigLine * configLine, Direction dir) \
{\
handleSpin(configUi->_parm, configLine, dir, default_); \
}
void ConfigurationEditor::handleText(QLineEdit * lineEdit, const ConfigLine * configLine, Direction dir)
{
std::string parm = configLine->getToken(1);
hOutDebug(4,configLine->getToken(0) << std::endl);
if (dir == toScreen)
{
if (configLine->getToken(2).length() != 0)
configLine->setInError(configLine->getAbsoluteTokenColumn(2));
lineEdit->setText(parm.c_str());
}
else
{
/*TODO: verification routine*/
if (lineEdit->isModified())
{
const_cast(configLine)->replaceParameters(lineEdit->text().toStdString());
}
}
}
void ConfigurationEditor::handleSpin(QSpinBox * spinBox, const ConfigLine * configLine, Direction dir, int dflt)
{
std::string keyword = configLine->getUppercaseToken(0);
std::string parm = configLine->getToken(1);
hOutDebug(4,parm);
if (dir == toScreen)
{
std::string parm = configLine->getToken(1);
if (parm.length() > 0)
{
if (parm[0] == '+') parm = parm.substr(1);
int num = parseNum(parm);
if (parm.length() > 0 && num == 0 && parm[0] != '0')
{
num = dflt;
configLine->setInError(configLine->getAbsoluteTokenColumn(1));
}
spinBox->setValue(num);
}
else
{
spinBox->setValue(0);
}
mSpinMap[keyword] = spinBox->value();
if (configLine->getToken(2).length() != 0)
configLine->setInError(configLine->getAbsoluteTokenColumn(2));
}
else
{
/*TODO: verification routine*/
if (mSpinMap[keyword] != spinBox->value())
const_cast(configLine)->replaceParameters(spinBox->text().toStdString());
}
}
void ConfigurationEditor::handleSpin(QDoubleSpinBox * doubleSpinBox, const ConfigLine * configLine, Direction dir, int dflt)
{
std::string parm = configLine->getToken(1);
hOutDebug(4, parm);
if (dir == toScreen)
{
std::string parm = configLine->getToken(1);
if (parm.length() > 0)
{
if (parm[0] == '+') parm = parm.substr(1);
int num = parseNum(parm);
if (parm.length() > 0 && num == 0 && parm[0] != '0')
{
num = dflt;
configLine->setInError(configLine->getAbsoluteTokenColumn(1));
}
doubleSpinBox->setValue(num);
}
else
{
doubleSpinBox->setValue(0);
}
mSpinMap[parm] = doubleSpinBox->value();
if (configLine->getToken(2).length() != 0)
configLine->setInError(configLine->getAbsoluteTokenColumn(2));
}
else
{
/*TODO: verification routine*/
if (mSpinMap[parm] != doubleSpinBox->value())
const_cast(configLine)->replaceParameters(doubleSpinBox->text().toStdString());
}
}
void ConfigurationEditor::handleSlider(QSlider * slider, const ConfigLine * configLine, Direction dir)
{
std::string keyword = configLine->getToken(0);
std::string parm = configLine->getToken(1);
if (dir == toScreen)
{
int num = parseNum(parm);
if (parm[0] == '-' || parm[0] == '+') parm = parm.substr(1);
if (num == 0 && parm.find_first_not_of("0123456789") != std::string::npos)
configLine->setInError(configLine->getAbsoluteTokenColumn(1));
slider->setValue(num);
mSpinMap[keyword] = slider->value();
if (configLine->getToken(2).length() != 0)
configLine->setInError(configLine->getAbsoluteTokenColumn(2));
}
else
{
if(slider->isWindowModified()){};
/*TODO: verification routine*/
if (mSpinMap[keyword] != slider->value())
{
std::stringstream s;
s << slider->value();
std::string parm = s.str();
const_cast(configLine)->replaceParameters(s.str());
}
}
}
void ConfigurationEditor::handleCheckbox(QCheckBox * checkbox, const ConfigLine * configLine, Direction dir, QString checked, QString unchecked)
{
QString name=configLine->getToken(0).c_str();
QString parm=configLine->getToken(1).c_str();
hOutDebug(2,parm.toStdString());
if (dir == toScreen)
{
if (parm=="") parm=unchecked;
checkbox->setChecked( (parm.toUpper() == checked ) ? true : false);
mCheckBoxMap[name.toStdString()] = checkbox->isChecked();
if (configLine->getToken(2).length() != 0)
configLine->setInError(configLine->getAbsoluteTokenColumn(2));
}
else
{
if ( (checkbox->isChecked() != mCheckBoxMap[name.toStdString()]) )
{
if (checkbox->isChecked())
const_cast(configLine)->replaceParameters(checked.toStdString());
else
const_cast(configLine)->replaceParameters(unchecked.toStdString());
}
}
}
std::mapConfigurationEditor::mCheckBoxMap;
std::mapConfigurationEditor::mSpinMap;
ConfigurationEditor::ConfigurationEditor()
{
hOutDebug(5,"ConfigurationEditor::ConfigurationEditor");
}
ConfigurationEditor::~ConfigurationEditor()
{
}
void ConfigurationEditor::ARCHMODE(Ui::ConfigurationClass * configUi, const ConfigLine * configLine, Direction dir)
{
if (dir == toScreen)
{
hOutDebug(4,"ARCHMODE");
std::string token = configLine->getLowercaseToken(1);
if (token == "s/370")
configUi->s370Button->setChecked(true);
else if (token == "esa/390")
configUi->ESA390Button->setChecked(true);
else if ((token == "esame") || (token == "z/arch") || (token == "z/arch"))
configUi->ZArchButton->setChecked(true);
else
{
configLine->setInError(configLine->getAbsoluteTokenColumn(1));
}
int value;
if (configUi->s370Button->isChecked()) value = 0;
else if (configUi->ESA390Button->isChecked()) value = 1;
else value = 2;
mSpinMap["ARCHMODE"] = value;
validateMaxTokens(configLine, 1);
}
else
{
int value;
if (configUi->s370Button->isChecked()) value = 0;
else if (configUi->ESA390Button->isChecked()) value = 1;
else value = 2;
if (value != mSpinMap["ARCHMODE"])
{
std::string parm;
if (configUi->s370Button->isChecked())
parm="S/370";
else if(configUi->ESA390Button->isChecked())
parm="ESA/390";
else
parm="z/Arch";
const_cast(configLine)->replaceParameters(parm);
}
}
}
CheckBoxItem(ASN_AND_LX_REUSE,alrfCheck, ENABLE, DISABLE)
//CheckBoxItem(ALRF,alrfCheck, ENABLE, DISABLE)
void ConfigurationEditor::ALRF(Ui::ConfigurationClass * configUi, const ConfigLine * configLine, Direction dir)
{
handleCheckbox(configUi->alrfCheck, configLine, dir, "ENABLE", "DISABLE");
}
void ConfigurationEditor::AUTO_MOUNT(Ui::ConfigurationClass * configUi, const ConfigLine * configLine, Direction dir)
{
// TODO: accept "-", but do not generate one
hOutDebug(4,"AUTO_MOUNT");
if (dir == toScreen)
{
std::string parm=configLine->getToken(1);
if (parm=="+" || parm == "-")
parm=configLine->getToken(1);
configUi->autoMountDir->setText(parm.c_str());
}
else if (configUi->autoMountDir->isModified())
{
const std::string val = configUi->autoMountDir->text().toStdString();
const_cast(configLine)->replaceParameters(val);
}
}
void ConfigurationEditor::AUTO_SCSI_MOUNT(Ui::ConfigurationClass * configUi, const ConfigLine * configLine, Direction dir)
{
hOutDebug(4,"AUTO_SCSI_MOUNT");
if (dir == toScreen)
{
std::string parm = configLine->getLowercaseToken(1);
int num = parseNum(parm);
if (parm.length() == 0)
num = 50;
if (parm.length() != 0 && parm.compare("yes") == 0)
{
configUi->autoScsiMountCheck->setChecked(true);
configUi->autoScisiSecSpin->setDisabled(false);
configUi->autoScisiSecSpin->setValue(50);
}
else if (parm.length() != 0 && parm.compare("no") == 0)
{
configUi->autoScsiMountCheck->setChecked(true);
configUi->autoScisiSecSpin->setDisabled(false);
configUi->autoScisiSecSpin->setValue(num);
}
else
{
configUi->autoScsiMountCheck->setChecked(false);
configUi->autoScisiSecSpin->setValue(num);
configUi->autoScisiSecSpin->setDisabled(true);
}
mCheckBoxMap["AUTO_SCSI_MOUNT"] = configUi->autoScsiMountCheck->isChecked();
mSpinMap["AUTO_SCSI_MOUNT"] = configUi->autoScisiSecSpin->value();
}
else if (mCheckBoxMap["AUTO_SCSI_MOUNT"] != configUi->autoScsiMountCheck->isChecked() ||
mSpinMap["AUTO_SCSI_MOUNT"] != configUi->autoScisiSecSpin->value() )
{
std::string parm;
if (!configUi->autoScsiMountCheck->isChecked())
{
parm = "NO";
}
else
{
int val = configUi->autoScisiSecSpin->value();
std::stringstream s;
s << val;
parm = s.str();
}
hOutDebug(3,"parm=" << parm);
const_cast(configLine)->replaceParameters(parm);
}
}
SpinItem(CNSLPORT,ConsolePortSpin, 3270)
void ConfigurationEditor::CONKPALV(Ui::ConfigurationClass *, const ConfigLine * configLine, Direction dir)
{
if (dir == toScreen)
{
// just parse (we do not yet have a screen display for this parameter
QRegExp exp("\\s+\\((\\d*),(\\d*),(\\d*)\\)");
QString line(configLine->getLine().substr(8).c_str());
if (exp.indexIn(line) == -1)
configLine->setInError(8);
else
configLine->setNoError();
}
}
TextItem(CPUMODEL,CpuModel)
SliderItem(CPUPRIO,cpuPrioSlider)
TextItem(CPUSERIAL,cpuSerial)
TextItem(CPUVERID,cpuVerid)
SliderItem(DEVPRIO,devPrioSlider)
SpinItem(DEVTMAX,devTMaxSpin, 0)
void ConfigurationEditor::DIAG8CMD(Ui::ConfigurationClass * configUi, const ConfigLine * configLine, Direction dir)
{
hOutDebug(4,"DIAG8CMD");
if (dir == toScreen)
{
std::string enableDisable = configLine->getLowercaseToken(1);
std::string echoNoEcho = configLine->getLowercaseToken(2);
if (enableDisable.compare("enable") == 0)
configUi->diag8CmdCheckBox->setChecked(true);
else if (enableDisable.compare("disable") == 0)
configUi->diag8CmdCheckBox->setChecked(false);
else
configLine->setInError(configLine->getAbsoluteTokenColumn(1));
if (echoNoEcho.length() > 0 && echoNoEcho.compare("echo") == 0)
configUi->diag8EchoCheckBox->setChecked(true);
else if (echoNoEcho.length() > 0 && echoNoEcho.compare("noecho") == 0)
configUi->diag8EchoCheckBox->setChecked(false);
else if (echoNoEcho.length() == 0)
configUi->diag8EchoCheckBox->setChecked(false);
else configLine->setInError(configLine->getAbsoluteTokenColumn(2));
validateMaxTokens(configLine, 2);
mCheckBoxMap["DIAG8CMD"]=configUi->diag8CmdCheckBox->isChecked();
mCheckBoxMap["DIAG8ECHO"]=configUi->diag8EchoCheckBox->isChecked();
}
else if (mCheckBoxMap["DIAG8CMD"] != configUi->diag8CmdCheckBox->isChecked() ||
mCheckBoxMap["DIAG8ECHO"]!= configUi->diag8EchoCheckBox->isChecked())
{
std::string enable, echo;
if (configUi->diag8EchoCheckBox->isChecked())
echo = "ECHO";
else
echo = "NOECHO";
if (configUi->diag8CmdCheckBox->isChecked())
enable = "ENABLE";
else
enable = "DISABLE";
std::string parm = enable + " " + echo;
const_cast(configLine)->replaceParameters(parm);
}
}
TextItem(ENGINES,engines)
void ConfigurationEditor::ECPSVM(Ui::ConfigurationClass * configUi, const ConfigLine * configLine, Direction dir)
{
hOutDebug(4,"ECPSVM");
if (dir == toScreen)
{
if (configLine->getLowercaseToken(1) == "yes" || configLine->getLowercaseToken(1) == "level")
{
configUi->ecpSvmSpin->setEnabled(true);
configUi->ecpSvm->setChecked(true);
int level = 20;
if (configLine->getToken(2) != "")
level = parseNum(configLine->getToken(2));
configUi->ecpSvmSpin->setValue(level);
}
else if (configLine->getLowercaseToken(1) == "no")
{
configUi->ecpSvm->setChecked(false);
configUi->ecpSvmSpin->setValue(20);
configUi->ecpSvmSpin->setEnabled(false);
}
else configLine->setInError(configLine->getAbsoluteTokenColumn(1));
mCheckBoxMap["ECPSVM"] = configUi->ecpSvm->isChecked();
mSpinMap["ECPSVM"] = configUi->ecpSvmSpin->value();
validateMaxTokens(configLine, 1);
}
else if ( mCheckBoxMap["ECPSVM"] != configUi->ecpSvm->isChecked() ||
mSpinMap["ECPSVM"] != configUi->ecpSvmSpin->value() )
{
std::string parm;
if (configUi->ecpSvm->isChecked())
{
std::stringstream ss;
ss << configUi->ecpSvmSpin->value();
parm = "LEVEL " + ss.str();
}
else parm = "NO";
const_cast(configLine)->replaceParameters(parm);
}
}
SliderItem(HERCPRIO,hercPrioSlider)
void ConfigurationEditor::HTTPPORT(Ui::ConfigurationClass * configUi, const ConfigLine * configLine, Direction dir) \
{
hOutDebug(4,"HTTPPORT");
if (dir == toScreen)
{
std::string parm = configLine->getToken(1);
if ( parm.find_first_not_of("01234567890") != std::string::npos )
configLine->setInError(configLine->getAbsoluteTokenColumn(1));
int num = parseNum(parm);
if (num !=0)
{
configUi->httpPortSpin->setValue(num);
configUi->httpPortSpin->setEnabled(true);
configUi->httpPortCheckBox->setChecked(true);
}
else
{
configUi->httpPortCheckBox->setChecked(false);
configUi->httpPortSpin->setValue(0);
configUi->httpPortSpin->setEnabled(false);
}
mSpinMap["HTTPPORT"] = configUi->httpPortSpin->value();
validateMaxTokens(configLine,1);
}
else
{
if (mSpinMap["HTTPPORT"] != configUi->httpPortSpin->value())
const_cast(configLine)->replaceParameters(configUi->httpPortSpin->text().toStdString());
}
}
void ConfigurationEditor::HTTPROOT(Ui::ConfigurationClass * configUi, const ConfigLine * configLine, Direction dir)
{
hOutDebug(4,"HTTPROOT");
if (dir == toScreen)
{
std::string parm=configLine->getToken(1);
if (parm=="+" || parm == "-")
parm=configLine->getToken(1);
configUi->httpRootDir->setText(parm.c_str());
validateMaxTokens(configLine,1);
}
else if (configUi->httpRootDir->isModified())
{
const std::string val = configUi->httpRootDir->text().toStdString();
const_cast(configLine)->replaceParameters(val);
}
}
SpinItem(IODELAY,ioDelaySpin, 0)
TextItem(LDMOD,ldmod)
void ConfigurationEditor::LEGACYSENSEID(Ui::ConfigurationClass * configUi, const ConfigLine * configLine, Direction dir)
{
hOutDebug(4,"LEGACYSENSEID");
if (dir == toScreen)
{
std::string parm=configLine->getUppercaseToken(1);
if ( (parm == "ON") || (parm == "ENABLE") )
configUi->legacySenseIdCheckbox->setChecked(true);
else if ( (parm == "OFF") || (parm == "DISABLE") )
configUi->legacySenseIdCheckbox->setChecked(false);
else
configLine->setInError(configLine->getAbsoluteTokenColumn(1));
validateMaxTokens(configLine,1);
mCheckBoxMap["LEGACYSENSEID"] = configUi->legacySenseIdCheckbox->isChecked();
}
else
{
if (mCheckBoxMap["LEGACYSENSEID"] != configUi->legacySenseIdCheckbox->isChecked())
{
if (configUi->legacySenseIdCheckbox->isChecked())
const_cast(configLine)->replaceParameters("ENABLE");
else
const_cast(configLine)->replaceParameters("DISABLE");
}
}
}
TextItem(LOADPARM,loadParm)
CheckBoxItem(LOGOPT,logopt, TIMESTAMP, NOTIMESTAMP)
TextItem(LPARNAME,lparName)
SpinItem(MAINSIZE,mainSizeSpin, 64)
TextItem(MANUFACTURER,manufacturer)
TextItem(MODEL,model)
CheckBoxItem(MOUNTED_TAPE_REINIT,mountedTapeReinitCheckbox,ALLOW,DISALLOW)
void ConfigurationEditor::MODPATH(Ui::ConfigurationClass * configUi, const ConfigLine * configLine, Direction dir)
{
hOutDebug(4,"MODPATH");
if (dir == toScreen)
{
std::string parm=configLine->getToken(1);
configUi->modPath->setText(parm.c_str());
validateMaxTokens(configLine,1);
}
else if (configUi->modPath->isModified())
{
const std::string val = configUi->modPath->text().toStdString();
const_cast(configLine)->replaceParameters(val);
}
}
SpinItem(NUMCPU,numCpuSpin, 1)
SpinItem(NUMVEC,numVecSpin, 0)
void ConfigurationEditor::OSTAILOR(Ui::ConfigurationClass * configUi, const ConfigLine * configLine, Direction dir)
{
hOutDebug(4,"OSTAILOR");
if (dir == toScreen)
{
std::string parm = configLine->getUppercaseToken(1);
int initialValue = 0;
if (parm == "QUIET")
{
configUi->quiet->setChecked(true);
initialValue = 1;
}
else if (parm == "VM")
{
configUi->vm->setChecked(true);
initialValue = 2;
}
else if (parm == "VSE")
{
configUi->vse->setChecked(true);
initialValue = 3;
}
else if (parm == "LINUX")
{
configUi->linuxb->setChecked(true);
initialValue = 4;
}
else if (parm == "OS/390")
{
configUi->os390->setChecked(true);
initialValue = 5;
}
else if (parm == "Z/OS")
{
configUi->zOS->setChecked(true);
initialValue = 6;
}
else if (parm == "")
{
configUi->none->setChecked(true);
initialValue = 0;
}
else
{
configLine->setInError(configLine->getAbsoluteTokenColumn(1));
}
validateMaxTokens(configLine,1);
mSpinMap["OSTAILOR"] = initialValue;
}
else
{
int value;
if (configUi->quiet->isChecked()) value=1;
else if (configUi->vm->isChecked()) value=2;
else if (configUi->vse->isChecked()) value=3;
else if (configUi->linuxb->isChecked()) value=4;
else if (configUi->os390->isChecked()) value=5;
else if (configUi->zOS->isChecked()) value=6;
else value=0;
if (value != mSpinMap["OSTAILOR"])
{
if (configUi->quiet->isChecked())
const_cast(configLine)->replaceParameters("QUIET");
else if (configUi->vm->isChecked())
const_cast(configLine)->replaceParameters("VM");
else if (configUi->vse->isChecked())
const_cast(configLine)->replaceParameters("VSE");
else if (configUi->linuxb->isChecked())
const_cast(configLine)->replaceParameters("LINUX");
else if (configUi->os390->isChecked())
const_cast(configLine)->replaceParameters("OS/390");
else if (configUi->zOS->isChecked())
const_cast(configLine)->replaceParameters("z/OS");
else if (configUi->none->isChecked())
const_cast(configLine)->replaceParameters("NONE");
}
}
}
void ConfigurationEditor::PANRATE(Ui::ConfigurationClass * configUi, const ConfigLine * configLine, Direction dir)
{
hOutDebug(4,"PANRATE");
if (dir == toScreen)
{
std::string panRateSpin = configLine->getLowercaseToken(1);
if (panRateSpin.length() == 0)
configLine->setInError(configLine->getAbsoluteTokenColumn(1));
if (panRateSpin[0] == '+') panRateSpin = panRateSpin.substr(1);
int num = parseNum(panRateSpin);
if (panRateSpin.length() > 0 && num == 0)
{
if (panRateSpin.compare("fast") == 0) num=50;
else if (panRateSpin.compare("slow") == 0) num=500;
else
{
num = 500;
configLine->setInError(configLine->getAbsoluteTokenColumn(1));
}
}
configUi->panRateSpin->setValue(num);
mSpinMap["PANRATE"] = configUi->panRateSpin->value();
if (configLine->getToken(2).length() != 0)
configLine->setInError(configLine->getAbsoluteTokenColumn(2));
}
else
{
/*TODO: verification routine*/
if (mSpinMap["PANRATE"] != configUi->panRateSpin->value())
const_cast(configLine)->replaceParameters(configUi->panRateSpin->text().toStdString());
}
}
CheckBoxItem(PGMPRDOS,pgmPrdOs,LICENSED,RESTRICTED)
TextItem(PLANT,plant)
CheckBoxItem(SHCMDOPT,shCmdOpt,DISABLE, NODIAG8)
SpinItem(SHRDPORT,shrdPortSpin, 3990)
SpinItem(SYSEPOCH,sysepochSpin, 1900)
SpinItem(TIMERINT,timerIntSpin, 50)
SpinItem(TODDRAG,todDragSpin, 0)
SliderItem(TODPRIO,todPrioSlider)
void ConfigurationEditor::TZOFFSET(Ui::ConfigurationClass * configUi, const ConfigLine * configLine, Direction dir)
{
hOutDebug(5,"TZOFFSET:");
if (dir == toScreen)
{
std::string parm = configLine->getToken(1);
if (parm.length() < 4)
{
configLine->setInError(configLine->getAbsoluteTokenColumn(1));
return;
}
hOutDebug(5,"parm=" << parm);
int hh = 0, mm = 0;
int sig = 1;
if (parm[0] == '+') parm = parm.substr(1);
if (parm[0] == '-')
{
parm = parm.substr(1);
sig = -1;
}
if (parm.length() == 3)
{
hh = sig*(parm[0]-'0');
mm = parseNum(parm.substr(1));
}
else if (parm.length() == 4)
{
hh = sig*parseNum(parm.substr(0,2));
mm = parseNum(parm.substr(2,2));
}
else
{
configLine->setInError(configLine->getAbsoluteTokenColumn(1));
}
configUi->tzOffsetHH->setValue(hh);
configUi->tzOffsetMM->setValue(mm);
hOutDebug(5,"HH:" << hh << "MM:" << mm);
mSpinMap["TZOFFSET"] = parseNum(parm);
validateMaxTokens(configLine,1);
}
else
{
int iParm = configUi->tzOffsetHH->value()*100 + configUi->tzOffsetMM->value();
if (mSpinMap["TZOFFSET"] != iParm)
{
QString parm = configUi->tzOffsetHH->text() + configUi->tzOffsetMM->text();
hOutDebug(5, "parm:" << parm.toUtf8().data());
const_cast(configLine)->replaceParameters(parm.toStdString());
}
}
}
SpinItem(XPNDSIZE,xpndSizeSpin, 0)
SpinItem(YROFFSET,yrOffsetSpin, 0)
/////////////////////////////////////////////////////////////////////////////////////////////////
bool ConfigurationEditor::validateNum(const std::string& str, int base)
{
if (base == 16)
{
QString qstr = str.c_str();
if (qstr.toLower().toStdString().find_first_not_of("0123456789abcdef") != std::string::npos)
return false;
else
return true;
}
return true;
}
int ConfigurationEditor::parseNum(const std::string& str, int base)
{
int ret=0;
int sign = 1;
const char *c = str.c_str();
static std::string digits = "0123456789abcdef";
if (*c == '-')
{
sign = -1;
c++;
}
for ( ; *c != '\0' ; c++)
{
char pc = *c;
if (base==10 && !isdigit(pc)) break;
if ( (pc <= 'Z') && (pc >= 'A') ) pc+=('a'-'A');
ret *= base;
//ret += (*c-'0');
size_t i = digits.find_first_of(pc) ;
ret += i;
}
return ret*sign;
}
std::string ConfigurationEditor::normalizeNum(const std::string& str, int width, int base)
{
int devno = parseNum(str,base);
std::stringstream newLine;
newLine << std::hex << std::setw(width) << std::setfill('0') << std::uppercase
<< devno ;
return newLine.str();
}
void ConfigurationEditor::validateMaxTokens(const ConfigLine * configLine, int maxNum)
{
if (configLine->size() > maxNum+1) // size is 1-based maxNum is 0-based
configLine->setInError(configLine->getAbsoluteTokenColumn(maxNum+1));
}
HercConfiguration/SysgProperties.cpp 0000664 0001750 0001750 00000002470 12300664722 017250 0 ustar yakov yakov /*
* File: SysgProperties.cpp
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* 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 .
*
*/
#include "SysgProperties.h"
SysgProperties::SysgProperties(ConfigLine& line, QWidget *parent)
: TerminalProperties(line, parent)
{
getUi().terminalCombo->clear();
getUi().terminalCombo->insertItems(0, QStringList()
<< QApplication::translate("TerminalPropertiesClass", "SYSG", 0)
);
getUi().terminalCombo->setEnabled(false);
getUi().deviceNumber->setText("0000");
getUi().deviceNumber->setEnabled(false);
}
SysgProperties::~SysgProperties()
{
}
bool SysgProperties::isSysg()
{
return true;
}
HercConfiguration/ConfigurationFreeEditor.cpp 0000664 0001750 0001750 00000005321 12300664722 021024 0 ustar yakov yakov #include "ConfigurationFreeEditor.h"
#include "HerculesStudio.h"
#include
ConfigurationFreeEditor::ConfigurationFreeEditor(QWidget *parent) :
QPlainTextEdit(parent)
{
mLineNumberArea = new LineNumberArea(this);
connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int)));
connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int)));
connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine()));
updateLineNumberAreaWidth(0);
highlightCurrentLine();
}
int ConfigurationFreeEditor::lineNumberAreaWidth()
{
int digits = 1;
int max = qMax(1, blockCount());
while (max >= 10) {
max /= 10;
++digits;
}
int space = 3 + fontMetrics().width(QLatin1Char('9')) * digits;
return space;
}
void ConfigurationFreeEditor::updateLineNumberAreaWidth(int /* newBlockCount */)
{
setViewportMargins(lineNumberAreaWidth(), 0, 0, 0);
}
void ConfigurationFreeEditor::updateLineNumberArea(const QRect &rect, int dy)
{
if (dy)
mLineNumberArea->scroll(0, dy);
else
mLineNumberArea->update(0, rect.y(), mLineNumberArea->width(), rect.height());
if (rect.contains(viewport()->rect()))
updateLineNumberAreaWidth(0);
}
void ConfigurationFreeEditor::resizeEvent(QResizeEvent *e)
{
QPlainTextEdit::resizeEvent(e);
QRect cr = contentsRect();
mLineNumberArea->setGeometry(QRect(cr.left(), cr.top(), lineNumberAreaWidth(), cr.height()));
}
void ConfigurationFreeEditor::highlightCurrentLine()
{
QList extraSelections;
if (!isReadOnly())
{
QTextEdit::ExtraSelection selection;
QColor lineColor = QColor(Qt::yellow).lighter(170);
selection.format.setBackground(lineColor);
selection.format.setProperty(QTextFormat::FullWidthSelection, true);
selection.cursor = textCursor();
selection.cursor.clearSelection();
extraSelections.append(selection);
}
setExtraSelections(extraSelections);
}
void ConfigurationFreeEditor::lineNumberAreaPaintEvent(QPaintEvent *event)
{
QPainter painter(mLineNumberArea);
painter.fillRect(event->rect(), Qt::gray);
QTextBlock block = firstVisibleBlock();
int blockNumber = block.blockNumber();
int top = (int) blockBoundingGeometry(block).translated(contentOffset()).top();
int bottom = top + (int) blockBoundingRect(block).height();
while (block.isValid() && top <= event->rect().bottom())
{
if (block.isVisible() && bottom >= event->rect().top())
{
QString number = QString::number(blockNumber + 1);
painter.setPen(Qt::black);
painter.drawText(0, top, mLineNumberArea->width(), fontMetrics().height(),
Qt::AlignRight, number);
}
block = block.next();
top = bottom;
bottom = top + (int) blockBoundingRect(block).height();
++blockNumber;
}
}
HercConfiguration/DeviceConfigLine.cpp 0000644 0001750 0001750 00000023460 12344062251 017400 0 ustar yakov yakov /*
* File: DeviceConfigLine.cpp
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* 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 .
*
*/
#include "HerculesStudio.h"
#include "DeviceConfigLine.h"
#include "ConfigurationEditor.h"
#include
#include
DeviceConfigLine::DeviceTypesMap *DeviceConfigLine::mDeviceTypes = NULL;
std::map *DeviceConfigLine::mDeviceBaseTypes = NULL;
DeviceConfigLine::DeviceConfigLine(const char *line):
ConfigLine(line), mMultiCount(0)
{
initilize();
handleMultiLine();
}
DeviceConfigLine::~DeviceConfigLine()
{
hOutDebug(5,"~DeviceConfigLine");
}
void DeviceConfigLine::clear()
{
if (mDeviceTypes != NULL) mDeviceTypes->clear();
if (mDeviceBaseTypes != NULL) mDeviceBaseTypes->clear();
}
int DeviceConfigLine::getDeviceNumber() const
{
return std::strtol(getToken(0).c_str(),NULL, 16);
}
DeviceTypes::Type DeviceConfigLine::getDeviceType() const
{
QString token = getToken(1).c_str();
DeviceTypesMap::iterator it = (*mDeviceTypes).find(token.toUpper().toStdString());
if (it == (*mDeviceTypes).end())
return (*mDeviceTypes)["0000"];
hOutDebug(5,"getDeviceType " << token.toStdString());
return it->second;
}
void DeviceConfigLine::handleMultiLine()
{
std::string devno = getToken(0);
int first = -1, last = -1;
size_t dash = devno.find_first_of("-");
if (dash != std::string::npos)
{
first = ConfigurationEditor::parseNum(devno.substr(0,dash), 16);
last = ConfigurationEditor::parseNum(devno.substr(dash+1), 16);
}
size_t dot = devno.find_first_of(".");
if (dot != std::string::npos)
{
first = ConfigurationEditor::parseNum(devno.substr(0,dot), 16);
last = first+ConfigurationEditor::parseNum(devno.substr(dot+1), 10)-1;
}
size_t comma = devno.find_first_of(",");
if (comma != std::string::npos)
{
first = ConfigurationEditor::parseNum(devno.substr(0,comma), 16);
last = ConfigurationEditor::parseNum(devno.substr(comma+1), 16);
}
if (first > -1)
{
mMultiCount = last-first+1;
hOutDebug(5, devno << " multiCount:" << mMultiCount);
std::stringstream line;
line << std::hex << first ;
line << " " + getMultiToken(1,0) + "\n";
replaceLine(line.str());
}
else
{
first = ConfigurationEditor::parseNum(devno, 16);
}
}
int DeviceConfigLine::getMultiCount()
{
hOutDebug(5, "get multiCount:" << mMultiCount);
return mMultiCount;
}
void DeviceConfigLine::initilize()
{
if (mDeviceTypes != NULL)
return;
mDeviceTypes = new std::map;
mDeviceBaseTypes = new std::map;
mDeviceTypes->insert(std::pair("0000",DeviceTypes::Other));
mDeviceTypes->insert(std::pair("3270",DeviceTypes::Terminal));
mDeviceTypes->insert(std::pair("3287",DeviceTypes::Terminal));
mDeviceTypes->insert(std::pair("SYSG",DeviceTypes::Sysg));
mDeviceTypes->insert(std::pair("1052",DeviceTypes::Console));
mDeviceTypes->insert(std::pair("3215",DeviceTypes::Console));
mDeviceTypes->insert(std::pair("1052-C",DeviceTypes::Console));
mDeviceTypes->insert(std::pair("3215-C",DeviceTypes::Console));
mDeviceTypes->insert(std::pair("1442",DeviceTypes::CardReader));
mDeviceTypes->insert(std::pair("2501",DeviceTypes::CardReader));
mDeviceTypes->insert(std::pair("3505",DeviceTypes::CardReader));
mDeviceTypes->insert(std::pair("3525",DeviceTypes::CardPunch));
mDeviceTypes->insert(std::pair("1403",DeviceTypes::Printer));
mDeviceTypes->insert(std::pair("3211",DeviceTypes::Printer));
mDeviceTypes->insert(std::pair("3410",DeviceTypes::Tape));
mDeviceTypes->insert(std::pair("3420",DeviceTypes::Tape));
mDeviceTypes->insert(std::pair("3422",DeviceTypes::Tape));
mDeviceTypes->insert(std::pair("3430",DeviceTypes::Tape));
mDeviceTypes->insert(std::pair("3480",DeviceTypes::Tape));
mDeviceTypes->insert(std::pair("3490",DeviceTypes::Tape));
mDeviceTypes->insert(std::pair("3590",DeviceTypes::Tape));
mDeviceTypes->insert(std::pair("9347",DeviceTypes::Tape));
mDeviceTypes->insert(std::pair("8809",DeviceTypes::Tape));
mDeviceTypes->insert(std::pair("3088",DeviceTypes::CTC));
mDeviceTypes->insert(std::pair("CTCI",DeviceTypes::CTC));
mDeviceTypes->insert(std::pair("LCS", DeviceTypes::CTC));
mDeviceTypes->insert(std::pair("QETH", DeviceTypes::CTC));
mDeviceTypes->insert(std::pair("CTCT", DeviceTypes::CTC));
mDeviceTypes->insert(std::pair("2305",DeviceTypes::DASD));
mDeviceTypes->insert(std::pair("2311",DeviceTypes::DASD));
mDeviceTypes->insert(std::pair("2314",DeviceTypes::DASD));
mDeviceTypes->insert(std::pair("3330",DeviceTypes::DASD));
mDeviceTypes->insert(std::pair("3340",DeviceTypes::DASD));
mDeviceTypes->insert(std::pair("3350",DeviceTypes::DASD));
mDeviceTypes->insert(std::pair("3375",DeviceTypes::DASD));
mDeviceTypes->insert(std::pair("3380",DeviceTypes::DASD));
mDeviceTypes->insert(std::pair("3390",DeviceTypes::DASD));
mDeviceTypes->insert(std::pair("9345",DeviceTypes::DASD));
mDeviceTypes->insert(std::pair("3310",DeviceTypes::DASD));
mDeviceTypes->insert(std::pair("3370",DeviceTypes::DASD));
mDeviceTypes->insert(std::pair("9332",DeviceTypes::DASD));
mDeviceTypes->insert(std::pair("9335",DeviceTypes::DASD));
mDeviceTypes->insert(std::pair("9336",DeviceTypes::DASD));
mDeviceTypes->insert(std::pair("0671",DeviceTypes::DASD));
mDeviceTypes->insert(std::pair("2703",DeviceTypes::Comm));
mDeviceBaseTypes->insert(std::pair("3088",DeviceTypes::CTCT));
mDeviceBaseTypes->insert(std::pair("CTCI",DeviceTypes::CTCI));
mDeviceBaseTypes->insert(std::pair("LCS", DeviceTypes::LCS));
mDeviceBaseTypes->insert(std::pair("QETH", DeviceTypes::QETH));
mDeviceBaseTypes->insert(std::pair("2305",DeviceTypes::CKD));
mDeviceBaseTypes->insert(std::pair("2311",DeviceTypes::CKD));
mDeviceBaseTypes->insert(std::pair("2314",DeviceTypes::CKD));
mDeviceBaseTypes->insert(std::pair("3330",DeviceTypes::CKD));
mDeviceBaseTypes->insert(std::pair("3340",DeviceTypes::CKD));
mDeviceBaseTypes->insert(std::pair("3350",DeviceTypes::CKD));
mDeviceBaseTypes->insert(std::pair("3375",DeviceTypes::CKD));
mDeviceBaseTypes->insert(std::pair("3380",DeviceTypes::CKD));
mDeviceBaseTypes->insert(std::pair("3390",DeviceTypes::CKD));
mDeviceBaseTypes->insert(std::pair("9345",DeviceTypes::CKD));
mDeviceBaseTypes->insert(std::pair("3310",DeviceTypes::FBA));
mDeviceBaseTypes->insert(std::pair("3370",DeviceTypes::FBA));
mDeviceBaseTypes->insert(std::pair("9332",DeviceTypes::FBA));
mDeviceBaseTypes->insert(std::pair("9335",DeviceTypes::FBA));
mDeviceBaseTypes->insert(std::pair("9336",DeviceTypes::FBA));
mDeviceBaseTypes->insert(std::pair("9336",DeviceTypes::FBA));
}
std::string DeviceConfigLine::toString() const
{
int i=mLine.length()-3;
while (i>=0)
{
if ( (mLine[i] != ' ') && (mLine[i] != '\t') && (mLine[i] != '\n') && (mLine[i] != '\r') )
break;
--i;
}
return mLine.substr(0,i);
}
HercConfiguration/SystemConfigLine.h 0000664 0001750 0001750 00000002207 12300664722 017133 0 ustar yakov yakov /*
* File: SystemConfigLine.h
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* This object manages a configuration line of system parameters
*
* 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 .
*
*/
#ifndef SYSTEMCONFIGLINE_H_
#define SYSTEMCONFIGLINE_H_
#include "ConfigLine.h"
class SystemConfigLine: public ConfigLine
{
public:
SystemConfigLine(const char *line);
virtual ~SystemConfigLine();
std::string getKeyword() const;
};
#endif /* SYSTEMCONFIGLINE_H_ */
HercConfiguration/ConfigurationFreeEditor.h 0000664 0001750 0001750 00000004045 12300664722 020473 0 ustar yakov yakov /*
* File: FreeConfigurationEditor.h
*
* Author: Jacob Dekel
* Created on: Apr 19, 2011
*
* Copyright (c) 2011 Jacob Dekel.
* Adapted from Nokia sample CodeEditor -
* (Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies))
* $Id: TerminalProperties.h 67 2010-09-13 14:06:31Z dekeljacob $
*
* This object manages the terminal configuration properties
*
* 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 .
*
*/
#ifndef FREECONFIGURATIONEDITOR_H
#define FREECONFIGURATIONEDITOR_H
#include
class ConfigurationFreeEditor : public QPlainTextEdit
{
Q_OBJECT
public:
explicit ConfigurationFreeEditor(QWidget *parent = 0);
void lineNumberAreaPaintEvent(QPaintEvent *event);
int lineNumberAreaWidth();
protected:
void resizeEvent(QResizeEvent *event);
private slots:
void updateLineNumberAreaWidth(int newBlockCount);
void highlightCurrentLine();
void updateLineNumberArea(const QRect &, int);
private:
QWidget *mLineNumberArea;
};
class LineNumberArea : public QWidget
{
public:
LineNumberArea(ConfigurationFreeEditor *editor) : QWidget(editor) {
freeConfigurationEditor = editor;
}
QSize sizeHint() const {
return QSize(freeConfigurationEditor->lineNumberAreaWidth(), 0);
}
protected:
void paintEvent(QPaintEvent *event) {
freeConfigurationEditor->lineNumberAreaPaintEvent(event);
}
private:
ConfigurationFreeEditor *freeConfigurationEditor;
};
#endif // FREECONFIGURATIONEDITOR_H
HercConfiguration/ConsoleProperties.h 0000664 0001750 0001750 00000002702 12300664722 017370 0 ustar yakov yakov /*
* File: ConsoleProperties.h
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* This object handles the configuration of the console
*
* 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 .
*
*/
#ifndef CONSOLEPROPERTIES_H
#define CONSOLEPROPERTIES_H
#include "ConfigLine.h"
#include "GenericDeviceProperties.h"
#include "ui_ConsoleProperties.h"
class ConsoleProperties : public GenericDeviceProperties
{
Q_OBJECT
public:
ConsoleProperties(ConfigLine & line, QWidget *parent = 0);
virtual ~ConsoleProperties();
private:
Ui::ConsolePropertiesClass ui;
ConfigLine & mLine;
void setIntegrated(bool integrated);
signals:
void updateLine(bool);
private slots:
void ok();
void cancel();
void deviceTypeChanged(int index);
};
#endif // CONSOLEPROPERTIES_H
HercConfiguration/DasdProperties.h 0000664 0001750 0001750 00000003447 12300664722 016650 0 ustar yakov yakov /*
* File: DasdProperties.h
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
*
* This object handles the configuration of DASDs
*
* 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 .
*
*/
#ifndef DASDPROPERTIES_H
#define DASDPROPERTIES_H
#include "ConfigLine.h"
#include "GenericDeviceProperties.h"
#include
#include "ui_DasdProperties.h"
typedef std::string stringArray[3];
class DasdProperties : public GenericDeviceProperties
{
Q_OBJECT
public:
DasdProperties(ConfigLine& configLine, QWidget *parent = 0);
virtual ~DasdProperties();
private:
Ui::DasdPropertiesClass ui;
static std::string ckd[];
static std::string fba[];
void initialize(ConfigLine& line);
bool isInet(const std::string& fileName, stringArray & vec);
bool isFba(const std::string& dev);
void setInet(bool set);
void setLocal(bool set);
void setFba(bool set);
void setCkd(bool set);
private slots:
virtual void ok();
virtual void cancel();
void browseClicked();
void browseShadowClicked();
void typeChanged(const QString &);
void localInetChanged();
};
#endif // DASDPROPERTIES_H
HercConfiguration/SysgProperties.h 0000664 0001750 0001750 00000002246 12300664722 016716 0 ustar yakov yakov /*
* File: SysgProperties.h
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* This class extends TerminalProperties for the SYSG integrated console
*
* 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 .
*
*/
#ifndef SYSGPROPERTIES_H_
#define SYSGPROPERTIES_H_
#include "TerminalProperties.h"
class SysgProperties: public TerminalProperties
{
public:
SysgProperties(ConfigLine& line,QWidget *parent = 0);
virtual ~SysgProperties();
protected:
virtual bool isSysg();
};
#endif /* SYSGPROPERTIES_H_ */
HercConfiguration/DevicesRename.ui 0000664 0001750 0001750 00000003626 12300664722 016617 0 ustar yakov yakov
DevicesRenameClass
0
0
400
143
DevicesRename
20
10
201
16
Rename Device Unit Address
20
50
41
16
From
80
40
61
26
HHHH;
true
150
50
41
16
To
220
100
166
32
QDialogButtonBox::Cancel|QDialogButtonBox::Ok
HercConfiguration/NewReaderFile.h 0000664 0001750 0001750 00000002555 12300664722 016373 0 ustar yakov yakov /*
* File: NewReaderFile
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* 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 .
*
*/
#ifndef NEWREADERFILE_H_
#define NEWREADERFILE_H_
#include
#include
#include
#include
class NewReaderFile : public QDialog
{
Q_OBJECT
public:
NewReaderFile(QWidget * parent = 0);
virtual ~NewReaderFile();
private:
QLabel mLabel;
QLineEdit mFileName;
QPushButton mBrowseButton;
QPushButton mOKButton;
QPushButton mCancelButton;
void initialize();
private slots:
void doCancel();
void doOK();
void doBrowse();
signals:
void okPressed(QString&);
};
#endif /* NEWREADERFILE_H_ */
HercConfiguration/DeviceMenuProcessor.cpp 0000644 0001750 0001750 00000012012 12344062251 020156 0 ustar yakov yakov /*
* File: DeviceMenuProcessor.cpp
*
* Author: Jacob Dekel
* Created on: Oct, 14 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* 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 .
*
*/
#include "HerculesStudio.h"
#include "DeviceMenuProcessor.h"
#include "GenericDeviceProperties.h"
#include "NewReaderFile.h"
#include
DeviceMenuProcessor::DeviceMenuProcessor(QWidget *parent) :
QWidget(parent), mClickRow(-1)
{
}
DeviceMenuProcessor::~DeviceMenuProcessor()
{
}
void DeviceMenuProcessor::devicesClick(QMouseEvent * event)
{
hOutDebug(5, "devicesClick(" << mClickRow << "): " <<
(event->button() == Qt::RightButton ? "Right " : " ?" )
<< " at" << event->x());
mLastClick = mClickRow;
if ( event->button() == Qt::RightButton )
{
mMenu.clear();
QMenu * mMenuAdd;
mMenuAdd = mMenu.addMenu("Add...");
mMenuAdd->clear();
mMenuAdd->addAction("Terminal", this, SLOT(menuAddTerminal()));
if (canAddSYSG())
mMenuAdd->addAction("SYSG", this, SLOT(menuAddSYSG()));
mMenuAdd->addAction("Console", this, SLOT(menuAddConsole()));
mMenuAdd->addAction("Printer", this, SLOT(menuAddPrinter()));
mMenuAdd->addAction("Card Reader", this, SLOT(menuAddCardReader()));
mMenuAdd->addAction("Card Punch", this, SLOT(menuAddCardPunch()));
mMenuAdd->addAction("Tape Drives", this, SLOT(menuAddTape()));
mMenuAdd->addAction("CTC", this, SLOT(menuAddCTC()));
mMenuAdd->addAction("Dasd", this, SLOT(menuAddDasd()));
if (realDevice())
{
mMenu.addAction("Delete", this, SLOT(menuDelete()));
if (!isConfig())
{
mMenu.addAction("Rename", this, SLOT(menuRename()));
if (hasConfig())
mMenu.addAction("Re-Initialize...", this, SLOT(menuProperties()));
mMenu.addAction("Attention Interrupt", this, SLOT(menuInterrupt()));
mMenu.addAction("Subchannel Status", this, SLOT(menuStatus()));
if (traced())
mMenu.addAction(*new QIcon(":/icons/16x16/check.png"),"Trace CCW", this, SLOT(menuTraceCCW()));
else
mMenu.addAction("Trace CCW", this, SLOT(menuTraceCCW()));
if (this->getType(mClickRow) == DeviceTypes::Tape)
{
hOutDebug(3, "TAPE");
mMenu.addSeparator();
mMenu.addAction("Load Tape", this, SLOT(menuLoad()));
mMenu.addAction("Unload Tape", this, SLOT(menuUnload()));
}
else
{
hOutDebug(3, "not tape");
}
}
else
{
mMenu.addSeparator();
mMenu.addAction("Properties...", this, SLOT(menuProperties()));
mMenu.move(event->globalX(), event->globalY());
}
}
mMenu.move(event->globalX(), event->globalY());
mMenu.setVisible(true);
mClickRow = -1;
}
}
void DeviceMenuProcessor::menuAddTerminal()
{
menuAddItem(DeviceTypes::Terminal);
}
void DeviceMenuProcessor::menuAddConsole()
{
menuAddItem(DeviceTypes::Console);
}
void DeviceMenuProcessor::menuAddPrinter()
{
menuAddItem(DeviceTypes::Printer);
}
void DeviceMenuProcessor::menuAddCardReader()
{
menuAddItem(DeviceTypes::CardReader);
}
void DeviceMenuProcessor::menuAddCardPunch()
{
menuAddItem(DeviceTypes::CardPunch);
}
void DeviceMenuProcessor::menuAddTape()
{
menuAddItem(DeviceTypes::Tape);
}
void DeviceMenuProcessor::menuAddCTC()
{
menuAddItem(DeviceTypes::CTC);
}
void DeviceMenuProcessor::menuAddDasd()
{
menuAddItem(DeviceTypes::DASD);
}
void DeviceMenuProcessor::menuAddSYSG()
{
menuAddItem(DeviceTypes::Sysg);
}
void DeviceMenuProcessor::menuAddItem(int iType)
{
hOutDebug(5, "add Item" << mClickRow);
if (iType < 0 || iType > DeviceTypes::Comm) return;
DeviceTypes::Type type = static_cast (iType);
mCandidateLine = new DeviceConfigLine("\n");
mCandidateLine->setNew(true);
GenericDeviceProperties * mProp = NULL;
try
{
mProp = GenericDeviceProperties::classFactory(*mCandidateLine,this,type);
}
catch (...)
{
hOutDebug(2,"exception caught in class factory (add)");
}
connect(mProp, SIGNAL(updateLine(bool)), this, SLOT(doAddDevice(bool)));
mProp->setVisible(true);
mClickRow=-1;
}
void DeviceMenuProcessor::menuLoad()
{
NewReaderFile * newTapeFile = new NewReaderFile(this);
connect(newTapeFile, SIGNAL(okPressed(QString&)), this, SLOT(newTapeFileOK(QString&)));
newTapeFile->exec();
}
void DeviceMenuProcessor::menuUnload()
{
QString s("*");
if (!isConfig()) doLoadTape(s);
}
void DeviceMenuProcessor::newTapeFileOK(QString& tapeFileName)
{
if (!isConfig()) doLoadTape(tapeFileName);
}
HercConfiguration/TapeProperties.h 0000664 0001750 0001750 00000002732 12300664722 016662 0 ustar yakov yakov /*
* File: TapeProperties.h
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* This object manages the tape configuration properties
*
* 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 .
*
*/
#ifndef TAPEPROPERTIES_H
#define TAPEPROPERTIES_H
#include "ConfigLine.h"
#include "GenericDeviceProperties.h"
#include
#include "ui_TapeProperties.h"
class TapeProperties : public GenericDeviceProperties
{
Q_OBJECT
public:
TapeProperties(ConfigLine& line,QWidget *parent = 0);
virtual ~TapeProperties();
private:
Ui::TapePropertiesClass ui;
static const std::string types[];
void initialize(ConfigLine & line);
private slots:
void ok();
void cancel();
void standard(bool set=true);
void scsi(bool set=true);
void fileBrowse();
};
#endif // TAPEPROPERTIES_H
HercConfiguration/TerminalProperties.cpp 0000644 0001750 0001750 00000005532 12344062251 020073 0 ustar yakov yakov /*
* File: TerminalProperties.cpp
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* 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 .
*
*/
#include "TerminalProperties.h"
#include "ConfigLine.h"
#include
TerminalProperties::TerminalProperties(ConfigLine & line, QWidget *parent)
: GenericDeviceProperties(line, parent)
{
ui.setupUi(this);
if (!line.isNew())
{
ui.deviceNumber->setText(mLine.getToken(0).c_str());
ui.terminalCombo->setCurrentIndex( (mLine.getToken(1) == "3287") ? 1 : 0);
if (mLine.size() > 2)
{
int index = 2;
if (mLine.getToken(index).compare("SYSGCONS") == 0)
index++;
if (mLine.getToken(index)[0] == '*')
index++;
else
ui.groupName->setText(mLine.getToken(index++).c_str());
if (mLine.size() >= index)
ui.IPAddress->setText(mLine.getToken(index).c_str());
}
}
connect(ui.OKButton, SIGNAL(clicked()), this, SLOT(ok()));
connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(cancel()));
}
TerminalProperties::~TerminalProperties()
{
}
void TerminalProperties::ok()
{
if (!deviceNumberValidator(ui.deviceNumber))
return;
std::stringstream newLineBuff;
std::string ip;
if (ui.IPAddress->text().toStdString() == "...") // no address
ip = "";
else
{
if (!validateIp(ui.IPAddress,false, false))
return;
ip = ui.IPAddress->text().toStdString();
}
std::string sysgText;
if (isSysg()) sysgText = "SYSGCONS ";
newLineBuff << ui.deviceNumber->text().toStdString()
<< " " << ui.terminalCombo->currentText().toStdString()
<< " " << sysgText;
if (ui.groupName->text().length() == 0)
{
newLineBuff << " *";
}
else
{
newLineBuff << " " << ui.groupName->text().toStdString();
}
newLineBuff << " " << ip + "\n";
hOutDebug(3,"terminal: new line:" << newLineBuff.str()
<< " " << &mLine);
mLine.replaceLine(newLineBuff.str());
emit updateLine(true);
this->deleteLater();
}
bool TerminalProperties::isSysg()
{
return false;
}
void TerminalProperties::cancel()
{
emit updateLine(false);
this->deleteLater();
}
HercConfiguration/DeviceConfigView.h 0000664 0001750 0001750 00000002516 12300664722 017074 0 ustar yakov yakov /*
* File: DeviceConfigView.h
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* This object presents the devices in the configuration window
*
* 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 .
*
*/
#ifndef DEVICECONFIGVIEW_H_
#define DEVICECONFIGVIEW_H_
#include "HerculesStudio.h"
#include
#include
#include
class DeviceConfigView : public QTableView
{
Q_OBJECT
public:
DeviceConfigView(QWidget * parent);
virtual ~DeviceConfigView();
protected:
virtual void mousePressEvent ( QMouseEvent * e );
signals:
void deviceClick(QMouseEvent *);
void deviceDoubleClick(QMouseEvent *);
};
#endif /* DEVICECONFIGVIEW_H_ */
HercConfiguration/ConfigFile.cpp 0000644 0001750 0001750 00000030211 12344062251 016240 0 ustar yakov yakov /*
* File: ConfigFile.cpp
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* 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 .
*
*/
#include "ConfigFile.h"
#include "HerculesStudio.h"
#include "ConfigurationEditor.h"
#include "SystemConfigLine.h"
#include "DeviceConfigLine.h"
#include
#include
#include
#include
#include
using namespace std;
#define synonymEntry(keyword1, keyword2) {#keyword1, #keyword2}, {#keyword2, #keyword1},
struct SynonymTableEntry ConfigFile::mSynonyms[] = {
synonymEntry(ASN_AND_LX_REUSE,ALRF)
{"", ""}
};
ConfigFile::ConfigFile(const string& fileName) :
mEditor(NULL), mLastSys(-1), mChanged(false), mNewConfig(false)
{
mFileName = fileName;
initialize();
}
void ConfigFile::initialize()
{
mFile = fopen(mFileName.c_str(), "r");
if (mFile==NULL)
{
hOutDebug(4, "file not found:" << mFileName << std::endl);
openTemplate();
}
buildConfig(ConfigFile::File);
if (mFile != NULL)
{
fclose(mFile);
mFile = NULL;
}
}
void ConfigFile::updateEditor(QPlainTextEdit& editor)
{
mEditor = &editor;
mEditorIterator = mEditor->document()->begin();
buildConfig(ConfigFile::TextEdit);
// TODO: build yourself by doing a merge:
//1. Search the line in mFileArray
//2. if not found - add.
//3. compare if the same text - if not - flag with update.
char buff[MAX_CONFIG_LINE];
while ( getNextLine(buff, MAX_CONFIG_LINE, ConfigFile::TextEdit))
{
std::string s(buff);
for (int i=0; i 1)
{
int additions = l.getMultiCount();
while (additions>1)
{
devno++;
newLine.str("");
newLine << std::hex << std::setw(4) << std::setfill('0') << std::uppercase
<< devno << " " << l.getMultiToken(1,0) << "\n";
DeviceConfigLine n(newLine.str().c_str());
mFileArray.push_back(n);
additions--;
}
}
}
}
hOutDebug(3, "### last sys=" << mLastSys << " size=" << mFileArray.size() << std::endl);
hOutDebug(3, mFileArray[mLastSys].getLine() << std::endl)
}
ConfigFile::~ConfigFile()
{
mFileArray.clear();
}
void ConfigFile::addNonDev(SystemConfigLine * configLine)
{
FileArray::iterator it = mFileArray.begin() + mLastSys+1;
mFileArray.insert(it, *configLine);
++mLastSys;
mChanged = true;
}
void ConfigFile::addDev(DeviceConfigLine * configLine)
{
hOutDebug(2, "add dev after " << mFileArray.size() << " line:'" << configLine->getLine() << std::endl);
configLine->parseLine();
mFileArray.push_back(*configLine);
mChanged = true;
}
const std::string& ConfigFile::getFileName() const
{
return mFileName;
}
DeviceConfigLine * ConfigFile::getDevice(int index) const
{
if (index <= mLastSys)
{
hOutDebug(0, "ConfigFile[" << index << "] requested where lastsys=" << mLastSys);
abort();
}
if (static_cast(index) >= mFileArray.size())
{
hOutDebug(0,"ConfigFile[" << index << "] requested where size=" << mFileArray.size());
abort();
}
return static_cast (const_cast(&mFileArray.at(index)));
}
int ConfigFile::numberOfDevices()
{
int num=0;
for (size_t i=mLastSys+1 ; iisRemark() &&
!getDevice(i)->isDeleted() )
num++;
}
return num;
}
DeviceConfigLine * ConfigFile::getDevice(const std::string& devno) const
{
for (size_t i=mLastSys+1; igetToken(0) == devno) return l;
}
return NULL;
}
DeviceConfigLine * ConfigFile::findFirstDeviceByType(const char * type) const
{
DeviceConfigLine * ret;
for (unsigned int i=mLastSys+1; i < mFileArray.size() ; i++)
{
ret = getDevice(i);
if (ret->getToken(1) == type)
return ret;
}
return NULL;
}
SystemConfigLine * ConfigFile::operator[] (int index) const
{
if (index > mLastSys)
{
hOutDebug(5, "ConfigFile[" << index << "] requested where lastsys=" << mLastSys << std::endl);
abort();
}
return static_cast (const_cast(&mFileArray.at(index)));
}
int ConfigFile::size() const
{
return mFileArray.size();
}
bool ConfigFile::write(const string& fileName)
{
FILE * f = fopen(fileName.c_str(), "w");
if (f==NULL) return false;
for (int i=0; igetLine() << "=='" << (*this)[i]->getToken(0) << "'" <isRemark() && ((*this)[i]->getUppercaseToken(0) == keyword))
{
hOutDebug(5,"token(0):'" << (*this)[i]->getLine() << "'" << std::endl);
return (*this)[i];
}
}
// look in new lines
for (unsigned int i=0; igetLine() << std::endl);
if (cl->getToken(0) == keyword)
{
hOutDebug(4,"found" << std::endl);
return cl;
}
}
if (synonyms)
{
hOutDebug(4, "locating in synonyms " << keyword << " in synonyms " << std::endl);
for (int i=0; mSynonyms[i].keyword1.length() > 0; i++)
{
if (mSynonyms[i].keyword1.compare(keyword) == 0)
{
const ConfigLine * tmp = locateLine(mSynonyms[i].keyword2, false, false);
if (tmp != NULL)
{
hOutDebug(4, "found in synonyms" << std::endl);
return tmp;
}
}
}
}
SystemConfigLine * ret = NULL;
if (create)
{
std::string line(keyword + "\n");
ret = new SystemConfigLine(line.c_str());
ret->setNew(true);
hOutDebug(3, "new line 1:" << ret->getToken(0) << " 2:" << ret->getToken(1) << std::endl);
mNewLines.push_back(*ret);
}
return ret;
}
void ConfigFile::appendNewLines()
{
hOutDebug(4, "append new lines:" << mNewLines.size() << std::endl);
// append new system lines
for (unsigned int i=0; idocument()->end())
{
len = mEditorIterator.length();
if (len > 0)
{
strncpy(buff,mEditorIterator.text().toUtf8().data(),len-1);
buff[len-1] = '\0';
}
else
buff[0] = '\0';
mEditorIterator = mEditorIterator.next();
return buff;
}
else
return NULL;
}
}
const char * ConfigFile::configTemplate[52] = {
"#------------------------------------------------------------------------------\n",
"# CPU Configuration\n",
"#------------------------------------------------------------------------------\n",
"\n",
" CPUSERIAL 002623 # CPU serial number\n",
" CPUMODEL 3090 # CPU model number\n",
" MODEL EMULATOR # STSI returned model\n",
" PLANT ZZ # STSI returned plant\n",
" MANUFACTURER HRC # STSI returned manufacturer\n",
" LPARNAME HERCULES # DIAG 204 returned lparname\n",
" CPUVERID FD # CPU Version Identification\n",
" MAINSIZE 128 # Main storage size in megabytes\n",
" NUMCPU 1 # Number of CPUs"
"\n",
"#------------------------------------------------------------------------------\n",
"# OS Tailoring\n",
"#------------------------------------------------------------------------------\n",
"\n",
" LOADPARM 0120.... # IPL parameter\n",
"\n",
"#------------------------------------------------------------------------------\n",
"# Hercules Service Processor and Hercules Application Window\n",
"#------------------------------------------------------------------------------\n",
"\n",
" DIAG8CMD disable echo # OS may not issue commands via DIAG 8\n",
"\n",
"# HTTPPORT 8081 noauth userid password # HTTP server port\n",
"\n",
" PANRATE FAST # Panel refresh rate\n",
"\n",
"\n",
"#-------------------------------------------------------------------------------\n",
"# Advanced Hercules Performance Tailoring\n",
"#\n",
"# +----------------------------------------------------------------+\n",
"# | Caution: Modification of these parameters may adversely |\n",
"# | affect the performance of the host system |\n",
"# | and/or Hercules. |\n",
"# +----------------------------------------------------------------+\n",
"#-------------------------------------------------------------------------------\n",
"\n",
" HERCPRIO 0 # Hercules process runs at Normal priority\n",
" CPUPRIO 15 # CPU thread(s) run at Low priority\n",
" DEVPRIO 8 # Device thread(s) run at Below Normal priority\n",
" TODPRIO -20 # TOD Clock and timer thread are Time Critical\n",
"\n",
"#------------------------------------------------------------------------------\n",
"# I/O Devices\n",
"#------------------------------------------------------------------------------\n",
" 0009 3270\n",
"\n",
"EOF"};
HercConfiguration/ConfigLine.h 0000664 0001750 0001750 00000004753 12300664722 015736 0 ustar yakov yakov /*
* File: ConfigLine.h
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* This object manages one line of the configuration file
*
* 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 .
*
*/
#ifndef CONFIGLINE_H
#define CONFIGLINE_H
#include
#include
#include
typedef std::pair TokenPair;
class ConfigLine
{
public:
ConfigLine(const char *line);
virtual ~ConfigLine();
void replaceLine(const std::string& newLine);
void replaceParameters(const std::string& newParm);
void setDeleted(bool parm);
const std::string& getLine() const;
inline bool isRemark() const { return mRemark; }
inline bool isDeleted() const { return mDeleted; }
inline bool isNew() const { return mNew; }
inline bool isUpdated() const { return mUpdated; }
inline bool inError() const { return mInError; }
inline int errorColumn() const { return mErrorColumn; }
inline void setNew(bool newVal) { mNew=newVal; } ;
inline void setUpdated(bool updated) { mUpdated=updated; } ;
inline void setInError(int column) const { mInError=true; mErrorColumn=column; }
inline void setNoError() const { mInError=false; mErrorColumn=-1; }
std::string getToken(int i) const;
std::string getLowercaseToken(int i) const;
std::string getUppercaseToken(int i) const;
int getAbsoluteTokenColumn(int i) const;
int getAbsoluteTokenEnd(int i) const;
std::string getMultiToken(int from, int to) const;
inline int size() const {return mSize;}
void parseLine();
protected:
std::string mLine;
private:
bool mRemark;
bool mDeleted;
bool mUpdated;
bool mNew;
int mSize;
mutable bool mInError;
mutable int mErrorColumn;
std::string::size_type mKeyStart;
std::string mKeyword;
std::vector mTokens;
void tokenize(const std::string& delimiters = " ");
};
#endif // #ifdef CONFIGLINE_H
HercConfiguration/StatusUpdateCollector.cpp 0000664 0001750 0001750 00000001677 12300664722 020553 0 ustar yakov yakov /*
* File: StatusUpdateCollector.cpp
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* 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 .
*
*/
#include "StatusUpdateCollector.h"
StatusUpdateCollector::StatusUpdateCollector()
{
}
StatusUpdateCollector::~StatusUpdateCollector()
{
}
HercConfiguration/DeviceConfigView.cpp 0000664 0001750 0001750 00000002144 12300664722 017424 0 ustar yakov yakov /*
* File: DeviceConfigView.cpp
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* 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 .
*
*/
#include "DeviceConfigView.h"
#include
DeviceConfigView::DeviceConfigView(QWidget * parent)
:QTableView(parent)
{
}
DeviceConfigView::~DeviceConfigView()
{
}
void DeviceConfigView::mousePressEvent ( QMouseEvent * event )
{
QTableView::mousePressEvent(event);
emit deviceClick(event);
}
HercConfiguration/DeviceTypes.h 0000664 0001750 0001750 00000003072 12300664722 016136 0 ustar yakov yakov /*
* File: DeviceTypes.h
*
* Author: Jacob Dekel
* Created on: Oct 15, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* This object is an interface for driving devices through menus
* (used by both the devices pane and the devices configuration tab)
*
* 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 .
*
*/
#ifndef DEVICETYPES_H_
#define DEVICETYPES_H_
#include
class DeviceTypes
{
public:
static DeviceTypes& instance();
virtual ~DeviceTypes();
enum Type { Other = 0,
Terminal, Sysg, Console, Printer, CardReader, CardPunch,
LinePrinter, Tape, CTC, DASD , Comm };
enum BaseType { CTCT=100 , CTCI, LCS, QETH, CKD, FBA};
QIcon & getIcon(DeviceTypes::Type type) ;
const char * getName(Type type);
private:
DeviceTypes();
static DeviceTypes mInstance;
const static char *sDeviceNames[];
const static char *sDeviceIconNames[];
static std::vector sDeviceIcons;
};
#endif /* DEVICETYPES_H_ */
HercConfiguration/DevicesWidget.cpp 0000644 0001750 0001750 00000013534 12344062251 016772 0 ustar yakov yakov /*
* File: DevicesWidget.cpp
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* 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 .
*
*/
#include "DevicesWidget.h"
#include "Configuration.h"
#include "DeviceConfigLine.h"
#include "GenericDeviceProperties.h"
#include "Environment.h"
#include
#include
#include
#include
#include
DevicesWidget::DevicesWidget(ConfigFile * configFile, QWidget * parent) :
DeviceMenuProcessor(parent) , mConfigFile(configFile), mConfigView()
{
mConfigView = new DeviceConfigView(this);
mConfigView->setAutoScroll(false);
mConfigView->setGeometry(0,0, 680,420);
mConfigView->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
QString iconPath = Environment::getIconsPath().c_str();
mCardIcon = new QIcon(iconPath + "/card.jpg");
mConsoleIcon = new QIcon(iconPath + "/card.jpg");
mDasdIcon = new QIcon(iconPath + "/dasd.jpg");
mNetIcon = new QIcon(iconPath + "/net.jpg");
mPrinterIcon = new QIcon(iconPath + "/printer.jpg");
mTapeIcon = new QIcon(iconPath + "/tape.jpg");
mTerminalIcon = new QIcon(iconPath + "/terminal.jpg");
mUnknownIcon = new QIcon(iconPath + "/unknown.jpg");
initialize();
QPushButton * okButton = new QPushButton(this);
okButton->setText("OK");
okButton->move(10,630);
QPushButton * cancelButton = new QPushButton(this);
cancelButton->setText("Cancel");
cancelButton->move(710,630);
mConfigView->setVisible(true);
connect(mConfigView, SIGNAL(pressed(QModelIndex)),this,SLOT(mousePressed(QModelIndex)));
connect(mConfigView, SIGNAL(deviceClick(QMouseEvent *)),this,SLOT(devicesClick(QMouseEvent *)));
}
DevicesWidget::~DevicesWidget()
{
}
void DevicesWidget::update(ConfigFile *configFile)
{
mConfigFile = configFile;
initialize();
}
void DevicesWidget::mousePressed(const QModelIndex index)
{
hOutDebug(3, "widget mouse pressed " << index.row())
mClickRow = index.row();
}
bool DevicesWidget::realDevice()
{
return (mClickRow >=0 && isRealDev(mClickRow));
}
bool DevicesWidget::canAddSYSG()
{
return (mConfigFile->findFirstDeviceByType("SYSG") == NULL);
}
DeviceTypes::Type DevicesWidget::getType(int lineNumber)
{
hOutDebug(3, "getType " << lineNumber << " " << mLastClick << std::endl);
DeviceConfigLine * line = mConfigFile->getDevice(mDialogToFile[lineNumber]);
return line->getDeviceType();
}
void DevicesWidget::menuDelete()
{
hOutDebug(5, "delete " << mLastClick);
mConfigFile->deleteLine(mDialogToFile[mLastClick]);
initialize();
}
void DevicesWidget::menuProperties()
{
hOutDebug(3, "properties " << mLastClick);
mCandidateLine = mConfigFile->getDevice(mDialogToFile[mLastClick]);
mCandidateLine->setNew(false);
GenericDeviceProperties * mProp = NULL;
try
{
mProp = GenericDeviceProperties::classFactory(*mCandidateLine, this);
}
catch (hsException e)
{
std::string msg = e.what();
QMessageBox::critical(this, "Invalid Device Line", msg.c_str() , QMessageBox::Ok);
}
catch (...)
{
hOutDebug(2, "exception caught in class factory (properties) ");
}
if (mProp != NULL)
{
connect(mProp, SIGNAL(updateLine(bool)), this, SLOT(updateDevice(bool)));
mProp->setVisible(true);
}
}
void DevicesWidget::doAddDevice(bool keep)
{
hOutDebug(5,"Update Line ");
std::stringstream newLine;
newLine << ConfigurationEditor::normalizeNum(mCandidateLine->getToken(0),4,16);
newLine << " " << mCandidateLine->getMultiToken(1,0) << "\n";
mCandidateLine->replaceLine(newLine.str());
if (mCandidateLine != NULL)
{
if (keep && mCandidateLine->isNew())
mConfigFile->addDev(mCandidateLine);
mCandidateLine = NULL;
}
initialize();
}
bool DevicesWidget::isUnique(std::string devno)
{
return (mConfigFile->getDevice(devno) == NULL);
}
void DevicesWidget::initialize()
{
int lastSys = mConfigFile->getLastSys();
QStandardItemModel * model = new QStandardItemModel(0,1);
model->clear();
QStringList labels = (QStringList() << "Device");
model->setHorizontalHeaderLabels(labels);
QStandardItem *parentItem = model->invisibleRootItem();
mDialogToFile.clear();
hOutDebug(5, "DeviceDlg::initilize from " <size());
int lineNum=-1;
for (int i=lastSys+1; isize(); i++)
{
const DeviceConfigLine * line = mConfigFile->getDevice(i);
hOutDebug(5,"line=" << line->getLine() << line->isRemark());
if (line->isRemark()) continue;
std::string strLine = line->getToken(0);
strLine.resize(10,' ');
strLine += line->getToken(1).c_str();
strLine.resize(20,' ');
strLine += line->getMultiToken(2,0).c_str();
strLine.resize(133,' ');
QStandardItem * item = new QStandardItem(strLine.c_str());
item->setIcon(DeviceTypes::instance().getIcon(line->getDeviceType()));
parentItem->appendRow(item);
++lineNum;
mDialogToFile[lineNum] = i;
}
mConfigView->setModel(model);
mConfigView->setColumnWidth(0,800);
QFont font("Mono", 10);
mConfigView->setFont(font);
for (int i=0; irowCount(); i++)
mConfigView->setRowHeight(i,18);
mConfigView->setGridStyle(Qt::NoPen);
mConfigView->setEditTriggers(QAbstractItemView::NoEditTriggers);
}
void DevicesWidget::updateDevice(bool done)
{
if (!done || mCandidateLine == NULL)
{
mClickRow = -1;
return;
}
initialize();
mClickRow = -1;
}
HercConfiguration/CtcProperties.cpp 0000644 0001750 0001750 00000034121 12344062251 017025 0 ustar yakov yakov /*
* File: CtcProperties.cpp
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* 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 .
*
*/
#include "HerculesStudio.h"
#include "CtcProperties.h"
#include "ConfigurationEditor.h"
#include "Preferences.h"
#include
#include
#include
CtcProperties::CtcProperties(ConfigLine& configLine, QWidget *parent)
: GenericDeviceProperties(configLine, parent)
{
ui.setupUi(this);
initialize(configLine);
connect(ui.okButton, SIGNAL(clicked()), this, SLOT(ok()));
connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(cancel()));
connect(ui.typeCombo, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(typeChanged(const QString &)));
connect(ui.oatBrowseButton, SIGNAL(clicked()), this, SLOT(oatBrowse()));
connect(ui.tun0CheckBox, SIGNAL(stateChanged(int)), this, SLOT(tun0Check(int)));
}
CtcProperties::~CtcProperties()
{
}
void CtcProperties::ok()
{
if (!deviceNumberValidator(ui.deviceNumber))
return;
std::stringstream newLineBuff;
newLineBuff << ui.deviceNumber->text().toStdString();
newLineBuff << " " << ui.typeCombo->currentText().toStdString();
if (ui.typeCombo->currentIndex() == 0) // lcs
{
if (!ui.tun->text().isEmpty())
{
newLineBuff << " -n " << ui.tun->text().toStdString();
}
if (!ui.oat->text().isEmpty())
{
newLineBuff << " -o " << ui.oat->text().toStdString();
}
if (!(ui.mac->text() == ":::::"))
{
if (macValidator(ui.mac->text().toStdString()))
{
newLineBuff << " -m " << ui.mac->text().toStdString() ;
}
else
return;
}
if ( !ui.guestIP->text().isEmpty() && (ui.guestIP->text() != "..." ) )
{
if (validateIp(ui.guestIP, false, false))
{
newLineBuff << " " << ui.guestIP->text().toStdString() ;
}
else
return;
}
}
else if (ui.typeCombo->currentIndex() == 2) // ctct
{
if (!validateIp(ui.hostIP,false, false))
return;
newLineBuff << " " << ui.lportSpinbox->text().toStdString() ;
newLineBuff << " " << ui.hostIP->text().toStdString();
newLineBuff << " " << ui.hostPortSpinbox->text().toStdString();
newLineBuff << " " << ui.buffsizeSpinBox->text().toStdString();
}
else if (ui.typeCombo->currentIndex() == 1) // ctci
{
if (ui.tun0CheckBox->isChecked())
{
newLineBuff << " tun0";
}
else
{
if (!validateIp(ui.guestIP,false, false))
return;
if (!validateIp(ui.hostIP,false, false))
return;
if (!ui.tun->text().isEmpty())
{
newLineBuff << " -n " << ui.tun->text().toStdString();
}
if (!(ui.mac->text() == ":::::"))
{
if (macValidator(ui.mac->text().toStdString()))
{
newLineBuff << " -m " << ui.mac->text().toStdString() ;
}
else
return;
}
if (!(ui.mask->text() == "..."))
{
if (validateIp(ui.mask, false, false))
{
newLineBuff << " -s " << ui.mask->text().toStdString() ;
}
else
return;
}
if (!(ui.guestIP->text() == "..."))
{
if (validateIp(ui.guestIP, false, false))
{
newLineBuff << " " << ui.guestIP->text().toStdString() ;
}
else
return;
}
if (!(ui.hostIP->text() == "..."))
{
if (validateIp(ui.hostIP, false, false))
{
newLineBuff << " " << ui.hostIP->text().toStdString() ;
}
else
return;
}
}
}
else // qeth
{
if (!(ui.hostIP->text() == "..."))
{
if (validateIp(ui.hostIP, false, false))
{
newLineBuff << " " << ui.hostIP->text().toStdString() ;
}
else
return;
}
}
newLineBuff << "\n";
mLine.replaceLine(newLineBuff.str());
emit updateLine(true);
this->deleteLater();
}
void CtcProperties::cancel()
{
emit updateLine(false);
this->deleteLater();
}
bool CtcProperties::macValidator(const std::string& mac)
{
bool ret = true;
if (mac.length() != 17)
ret = false;
QString qmac = mac.c_str();
for (int i=0; i<6 && ret; i++)
{
int pos = i*3;
if (i>0 && qmac.toStdString().substr(i*3-1,1) != ":")
ret=false;
std::string c1 = qmac.toLower().toStdString().substr(pos,1).c_str();
std::string c2 = qmac.toLower().toStdString().substr(pos+1,1).c_str();
if (c1[0] < '0' || c1[0] > 'f' || c2[0] < '0' || c2[0] > 'f')
{
ret=false;
}
}
if (!ret)
{
QMessageBox::warning(this, "Illegal MAC address", "Please provide device name\nhh:hh:hh:hh:hh:hh", QMessageBox::Ok);
return false;
}
return true;
}
void CtcProperties::typeChanged(const QString &newValue)
{
if (newValue.toLower() == "qeth") arrangeQeth(true);
else if (newValue.toLower() == "lcs") arrangeLcs(true);
else if (newValue.toLower() == "ctct") arrangeCtct(true);
else arrangeCtc(true);
}
void CtcProperties::arrangeQeth(bool set)
{
hOutDebug(5, "qeth " << (set ? "true" : "false"));
if (set)
{
arrangeCtc(!set);
arrangeCtct(!set);
arrangeLcs(!set);
ui.hostIP->setInputMask("000.000.000.000;");
}
ui.hostIPLabel->setVisible(set);
ui.hostIP->setVisible(set);
ui.hostIPLabel->setGeometry(20,50,53,16);
ui.hostIP->setGeometry(110,40,113,26);
}
void CtcProperties::arrangeLcs(bool set)
{
hOutDebug(5, "lcs " << (set ? "true" : "false") );
if (set)
{
arrangeCtc(!set);
arrangeCtct(!set);
arrangeQeth(!set);
ui.hostIP->setInputMask("000.000.000.000;");
}
ui.guestIPLabel->setVisible(set);
ui.guestIP->setVisible(set);
ui.tunLabel->setVisible(set);
ui.tun->setVisible(set);
ui.macLabel->setVisible(set);
ui.mac->setVisible(set);
ui.macLabel2->setVisible(set);
ui.oatFilenameLabel->setVisible(set);
ui.oat->setVisible(set);
ui.oatBrowseButton->setVisible(set);
//ui.oatEditButton->setVisible(set);
ui.hostIPLabel->setGeometry(20,70,53,16);
ui.hostIP->setGeometry(110,60,113,26);
ui.tunLabel->setGeometry(20,70,81,16);
ui.tun->setGeometry(110,60,301,26);
ui.macLabel->setGeometry(20,110,53,16);
ui.mac->setGeometry(110,100,171,26);
ui.macLabel2->setGeometry(300,100,53,16);
ui.oatFilenameLabel->setGeometry(20,150,91,16);
ui.oat->setGeometry(110,140,211,26);
ui.oatBrowseButton->setGeometry(330,140,21,26);
//ui.oatEditButton->setGeometry(360,140,52,26);
}
void CtcProperties::arrangeCtc(bool set)
{
bool nonTunSet = set;
hOutDebug(5, "ctc " << (set ? "true" : "false"));
if (set)
{
arrangeLcs(!set);
arrangeCtct(!set);
arrangeQeth(!set);
ui.hostIP->setInputMask("000.000.000.000;");
}
ui.tun0CheckBox->setVisible(set);
nonTunSet = !(ui.tun0CheckBox->isChecked());
ui.guestIPLabel->setVisible(set);
ui.guestIP->setVisible(set);
ui.maskLabel->setVisible(set);
ui.mask->setVisible(set);
ui.hostIPLabel->setVisible(set);
ui.hostIP->setVisible(set);
ui.tunLabel->setVisible(set);
ui.tun->setVisible(set);
ui.macLabel->setVisible(set);
ui.mac->setVisible(set);
ui.macLabel2->setVisible(set);
//disable if tun0 is set
ui.guestIPLabel->setEnabled(nonTunSet);
ui.guestIP->setEnabled(nonTunSet);
ui.maskLabel->setEnabled(nonTunSet);
ui.mask->setEnabled(nonTunSet);
ui.hostIPLabel->setEnabled(nonTunSet);
ui.hostIP->setEnabled(nonTunSet);
ui.tunLabel->setEnabled(nonTunSet);
ui.tun->setEnabled(nonTunSet);
ui.macLabel->setEnabled(nonTunSet);
ui.mac->setEnabled(nonTunSet);
ui.macLabel2->setEnabled(nonTunSet);
ui.hostIPLabel->setGeometry(20,70,53,16);
ui.hostIP->setGeometry(110,60,113,26);
ui.tunLabel->setGeometry(20,110,81,16);
ui.tun->setGeometry(110,100,301,26);
ui.macLabel->setGeometry(20,150,53,16);
ui.mac->setGeometry(110,140,171,26);
ui.macLabel2->setGeometry(300,140,53,16);
ui.tun0CheckBox->setGeometry(250,110,140,24);
}
void CtcProperties::arrangeCtct(bool set)
{
hOutDebug(3,"ctct " << (set ? "true" : "false"));
if (set)
{
arrangeCtc(!set);
arrangeLcs(!set);
arrangeQeth(!set);
ui.hostIP->setInputMask("000.000.000.000;");
}
ui.hostIPLabel->setVisible(set);
ui.hostIP->setVisible(set);
ui.hostPortLabel->setVisible(set);
ui.hostPortSpinbox->setVisible(set);
ui.lportLabel->setVisible(set);
ui.lportSpinbox->setVisible(set);
ui.buffsizeLabel->setVisible(set);
ui.buffsizeSpinBox->setVisible(set);
ui.hostIPLabel->setGeometry(20,30,53,16);
ui.hostIP->setGeometry(110,20,113,26);
ui.hostPortLabel->setGeometry(240,30,61,16);
ui.hostPortSpinbox->setGeometry(320,20,61,26);
ui.lportLabel->setGeometry(20,70,61,16);
ui.lportSpinbox->setGeometry(110,60,61,26);
ui.buffsizeLabel->setGeometry(20,110,71,16);
ui.buffsizeSpinBox->setGeometry(110,100,71,26);
}
void CtcProperties::arrangeByType()
{
if (ui.typeCombo->currentText().toLower() == "qeth")
{
arrangeQeth(true);
}
else if (ui.typeCombo->currentText().toLower() == "lcs")
{
arrangeLcs(true);
}
else if (ui.typeCombo->currentText().toLower() == "ctct")
{
arrangeCtct(true);
}
else
{
arrangeCtc(true);
}
}
void CtcProperties::oatBrowse()
{
std::string s = QFileDialog::getOpenFileName(this,
"Locate OAT File Name",
Preferences::getInstance().configDir().c_str(),
tr("All files(*)")).toUtf8().data();
ui.oat->setText(s.c_str());
}
void CtcProperties::tun0Check(int)
{
arrangeByType();
}
void CtcProperties::initialize(ConfigLine & configLine)
{
if (configLine.size() > 0)
ui.deviceNumber->setText(configLine.getToken(0).c_str());
QString type = configLine.getToken(1).c_str();
if (type.toLower() == "qeth")
{
ui.typeCombo->setCurrentIndex(3);
if (configLine.size() >= 2)
{
ui.hostIP->setText(configLine.getToken(2).c_str());
}
}
else if (type.toLower() == "lcs")
{
ui.typeCombo->setCurrentIndex(0);
for (int i=2; isetText(configLine.getToken(++i).c_str());
}
else if (configLine.getToken(i) == "-o" ||
configLine.getToken(i) == "--oat")
{
ui.oat->setText(configLine.getToken(++i).c_str());
}
else if (configLine.getToken(i) == "-m" ||
configLine.getToken(i) == "--mac")
{
ui.mac->setText(configLine.getToken(++i).c_str());
}
else if (i+1 == configLine.size())
{
ui.guestIP->setText(configLine.getToken(i).c_str());
}
}
}
else if (type.toLower() == "ctct")
{
ui.typeCombo->setCurrentIndex(2);
int port = atoi(configLine.getToken(2).c_str());
ui.lportSpinbox->setValue(port);
ui.hostIP->setInputMask("");
ui.hostIP->setText(configLine.getToken(3).c_str());
port = atoi(configLine.getToken(4).c_str());
ui.hostPortSpinbox->setValue(port);
if (configLine.size() > 5)
{
int size = atoi(configLine.getToken(5).c_str());
ui.buffsizeSpinBox->setValue(size);
}
}
else
{
ui.typeCombo->setCurrentIndex(1);
QString tun0;
if (configLine.size() > 2) tun0 = configLine.getToken(2).c_str();
if (tun0 == "tun0")
{
ui.tun0CheckBox->setChecked(true);
}
else
{
ui.tun0CheckBox->setChecked(false);
for (int i=2; isetText(configLine.getToken(++i).c_str());
}
else if (configLine.getToken(i) == "-m" ||
configLine.getToken(i) == "--mac")
{
ui.mac->setText(configLine.getToken(++i).c_str());
}
else if (configLine.getToken(i) == "-s")
{
ui.mask->setText(configLine.getToken(++i).c_str());
}
else if (i+1 == configLine.size())
{
ui.hostIP->setText(configLine.getToken(i).c_str());
}
else if (i+2 == configLine.size())
{
ui.guestIP->setText(configLine.getToken(i).c_str());
}
}
ui.tun0CheckBox->setChecked(false);
}
}
arrangeByType();
}
HercConfiguration/Configuration.ui 0000664 0001750 0001750 00000321222 12346767636 016731 0 ustar yakov yakov
ConfigurationClass
Qt::ApplicationModal
0
0
732
575
8
Configuration
20
20
691
491
0
0
Qt::LeftToRight
0
Architecture
20
60
641
341
Architecture
30
30
261
41
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'DejaVu Sans'; font-size:8pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> specifies the initial architecture mode:</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> * use S/370 for OS/360, VM/370, and MVS 3.8.</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> * use ESA/390 for MVS/XA, MVS/ESA, OS/390, VM/ESA, VSE/ESA, Linux/390, and ZZSA.</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> * use z/Arch or ESAME for z/OS and zLinux. </p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">ESAME is a synonym for z/Arch. </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">When z/Arch or ESAME is specified, the machine will always IPL in ESA/390mode, but is capable of being switched into z/Architecture mode after IPL.</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This is handled automatically by all z/Architecture operating systems. </p></body></html>
Type
10
12
71
22
S/370
true
90
12
97
22
ESA/390
190
12
61
22
Z/Arch
30
130
161
17
Cpu Serial number:
30
155
161
17
Cpu Model number:
30
180
171
17
Cpu Version code:
220
203
81
23
QAbstractSpinBox::UpDownArrows
1
64
30
205
171
17
Number of CPUs:
30
230
181
17
Number of Vector Facilities:
220
229
81
22
QAbstractSpinBox::UpDownArrows
1
64
30
255
181
17
Main Storage (MB):
220
255
81
24
QAbstractSpinBox::UpDownArrows
2
65535
64
30
280
181
17
Expanded Storage:
220
280
81
23
QAbstractSpinBox::UpDownArrows
0
1024
0
220
130
71
20
Times New Roman
220
154
71
22
Times New Roman
220
180
71
23
Times New Roman
330
130
131
22
Enable ECPSVM
false
470
130
54
23
20
20
330
160
221
22
Enable ASN and LX Reuse
102
90
191
23
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Sans Serif'; font-size:8pt; font-weight:400; font-style:normal;">
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">specifies the type of engine for each installed processor. The default engine type is CP. </p>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">nn</span>* is an optional repeat count. </p>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Examples: </p>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">ENGINES CP,CP,AP,IP</span> <br />specifies that processor engines 0 and 1 are of type CP, engine 2 is type AP, and engine 3 is type IP. </p>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">ENGINES 4*CP,2*AP,2*IP</span> <br />specifies that the first four processor engines (engines 0-3) are of type CP, the next two (engines 4-5) are of type AP, and the next two (engines 6-7) are of type IP. </p>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The number of installed processor engines is determined by the compile time variable MAX_CPU_ENGINES. If the ENGINES statement specifies more than MAX_CPU_ENGINES, the excess engines are ignored. If fewer than MAX_CPU_ENGINES are specified, the remaining engines are set to type CP. </p>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">See the <a href="http://www.hercules-390.org/hercconf.html#NUMCPU"><span style=" text-decoration: underline; color:#0000ff;">NUMCPU</span></a> statement for a discussion of MAX_CPU_ENGINES. </p></body></html>
30
92
56
17
Engines
330
40
131
17
Manufacturer
470
40
131
23
330
70
121
17
Model
470
70
131
23
470
100
131
23
330
100
121
17
Plant
true
340
270
97
22
true
20
20
57
19
File Name:
100
20
551
19
Courier New
Performance
20
60
651
161
Execution priority
false
180
40
311
20
-20
20
Qt::Horizontal
60
40
131
17
Hercules process:
60
70
131
17
TOD clock thread:
60
100
131
17
Device I/O threads:
60
130
131
17
CPU threads:
180
70
311
20
-20
20
20
-20
Qt::Horizontal
180
100
311
20
-20
20
8
Qt::Horizontal
180
130
311
20
-20
20
-15
Qt::Horizontal
490
50
161
20
Arial
8
PreferDefault
true
Caution: process priorities have
490
62
161
20
Arial
8
PreferDefault
true
a direct impact on how thread
490
74
161
20
Arial
8
PreferDefault
true
priorities are interpreted. You
490
86
161
20
Arial
8
PreferDefault
true
should not modify one without
490
98
161
20
Arial
8
PreferDefault
true
understanding how doing so
490
110
161
20
Arial
8
PreferDefault
true
impacts the other.
180
20
31
20
-20
20
40
35
22
255
255
255
80
80
80
120
120
120
100
100
100
40
40
40
53
53
53
255
255
255
255
255
255
255
255
255
0
0
0
80
80
80
0
0
0
40
40
40
255
255
220
0
0
0
255
255
255
80
80
80
120
120
120
100
100
100
40
40
40
53
53
53
255
255
255
255
255
255
255
255
255
0
0
0
80
80
80
0
0
0
40
40
40
255
255
220
0
0
0
40
40
40
80
80
80
120
120
120
100
100
100
40
40
40
53
53
53
40
40
40
255
255
255
40
40
40
80
80
80
80
80
80
0
0
0
80
80
80
255
255
220
0
0
0
QFrame::NoFrame
QFrame::Sunken
true
3
0.000000000000000
0
20
70
35
22
255
255
255
80
80
80
120
120
120
100
100
100
40
40
40
53
53
53
255
255
255
255
255
255
255
255
255
0
0
0
80
80
80
0
0
0
40
40
40
255
255
220
0
0
0
255
255
255
80
80
80
120
120
120
100
100
100
40
40
40
53
53
53
255
255
255
255
255
255
255
255
255
0
0
0
80
80
80
0
0
0
40
40
40
255
255
220
0
0
0
40
40
40
80
80
80
120
120
120
100
100
100
40
40
40
53
53
53
40
40
40
255
255
255
40
40
40
80
80
80
80
80
80
0
0
0
80
80
80
255
255
220
0
0
0
QFrame::NoFrame
QFrame::Sunken
true
3
-20.000000000000000
-20
20
100
35
22
255
255
255
80
80
80
120
120
120
100
100
100
40
40
40
53
53
53
255
255
255
255
255
255
255
255
255
0
0
0
80
80
80
0
0
0
40
40
40
255
255
220
0
0
0
255
255
255
80
80
80
120
120
120
100
100
100
40
40
40
53
53
53
255
255
255
255
255
255
255
255
255
0
0
0
80
80
80
0
0
0
40
40
40
255
255
220
0
0
0
40
40
40
80
80
80
120
120
120
100
100
100
40
40
40
53
53
53
40
40
40
255
255
255
40
40
40
80
80
80
80
80
80
0
0
0
80
80
80
255
255
220
0
0
0
9
QFrame::NoFrame
QFrame::Sunken
true
3
8.000000000000000
8
20
130
35
22
255
255
255
80
80
80
120
120
120
100
100
100
40
40
40
53
53
53
255
255
255
255
255
255
255
255
255
0
0
0
80
80
80
0
0
0
40
40
40
255
255
220
0
0
0
255
255
255
80
80
80
120
120
120
100
100
100
40
40
40
53
53
53
255
255
255
255
255
255
255
255
255
0
0
0
80
80
80
0
0
0
40
40
40
255
255
220
0
0
0
40
40
40
80
80
80
120
120
120
100
100
100
40
40
40
53
53
53
40
40
40
255
255
255
40
40
40
80
80
80
80
80
80
0
0
0
80
80
80
255
255
220
0
0
0
QFrame::NoFrame
QFrame::Sunken
true
3
-15.000000000000000
-15
310
20
52
15
0
Qt::AlignCenter
440
20
52
15
20
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
30
340
121
17
Max device threads
150
340
91
23
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-1
0
20
20
57
19
File Name:
100
20
551
19
Courier New
30
260
121
17
Timer Update Interval:
150
260
91
23
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
1
1000000
50
150
300
91
23
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
1
5000
50
250
300
57
19
(milisec)
30
300
111
17
Panel Refresh Rate
O/S Tailor
20
60
641
391
O/S Tailor
20
90
120
271
O/S Tailor
10
20
97
22
Quiet
true
10
122
97
22
Linux
10
224
97
22
None
10
54
97
22
VM
10
88
97
22
VSE
10
156
97
22
OS/390
10
190
97
22
z/OS
540
20
80
27
Browse...
140
22
391
23
20
30
111
17
Auto Mount Directory
330
230
83
22
Echo
150
140
221
22
Allow Mounted Tape Replacement
150
170
151
22
Allow Shell Commands
150
230
181
22
Enable DIAG 8 Interface
150
200
171
22
Auto detect SCSI tape mounts
150
110
121
22
Legacy Sense ID
false
330
200
54
23
240
330
113
23
160
330
61
17
I/O Delay
370
330
57
19
(usec)
20
20
57
19
File Name:
100
20
551
19
Courier New
Emulation
20
60
641
361
Details
550
150
71
23
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
0
65535
8081
380
150
56
17
HTTP Port
550
120
71
23
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
65535
3270
380
120
151
17
Console connection port:
20
60
121
17
Time Zone Offset:
380
90
121
17
Shared Device Port
550
90
71
23
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
65535
3990
160
30
91
23
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
4
1.000000000000000
20
30
121
17
Cpu Drag Factor:
160
90
91
23
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-142
142
0
20
90
121
17
TOD Year Offset:
20
200
201
22
9
Enable licences program product o/s
380
30
81
17
LPAR Name
380
60
71
17
Load Parm
490
60
131
23
490
30
131
23
250
230
251
20
8
operating system you intend to run
true
250
200
251
20
8
false
1
NOTE: It is YOUR responsibility to comply
false
false
Qt::NoTextInteraction
250
215
251
20
8
with the terms of the license for the
20
320
531
23
20
290
211
17
8
Additional dynamic modules to load:
380
170
151
22
Enable HTTP Server
190
60
49
25
-12
12
280
60
49
25
59
160
65
21
16
HH:
250
65
21
16
MM:
20
20
57
19
File Name:
100
20
551
19
Courier New
Environment
20
60
641
361
Parameters
160
140
91
23
1900
1960
1900
160
80
281
23
10
80
131
17
Modules search path
20
140
121
17
TOD Clock Epoch:
460
38
61
27
Browse...
10
40
131
17
HTTP Root Directory
160
40
281
23
460
80
61
27
Browse...
20
20
57
19
File Name:
100
20
551
19
Courier New
Devices
100
20
551
19
Courier New
20
20
57
19
File Name:
Free Edit
80
20
591
19
Courier New
20
20
57
19
File Name:
10
50
671
411
0
0
530
530
80
27
Cancel
630
530
80
27
OK
Configuration
pushButton_OK
pushButton_Cancel
s370Button
ESA390Button
ZArchButton
cpuSerial
CpuModel
cpuVerid
numVecSpin
numCpuSpin
mainSizeSpin
xpndSizeSpin
ecpSvm
ecpSvmSpin
alrfCheck
HercConfiguration/DeviceTypes.cpp 0000664 0001750 0001750 00000004430 12300664722 016470 0 ustar yakov yakov /*
* File: DeviceTypes.cpp
*
* Author: Jacob Dekel
* Created on: Oct 15, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* 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 .
*
*/
#include "HerculesStudio.h"
#include "DeviceTypes.h"
#include "Environment.h"
#define NUM_DEVICES 12
std::vector DeviceTypes::sDeviceIcons;
DeviceTypes DeviceTypes::mInstance;
const char *DeviceTypes::sDeviceNames[NUM_DEVICES] =
{
"Unknown",
"Display Terminal",
"SYSG",
"Consoles",
"Printers",
"Card Readers",
"Card Punch",
"Line Printers",
"Tape Drives",
"CTC",
"Dasd",
"OSA"
};
const char *DeviceTypes::sDeviceIconNames[NUM_DEVICES] =
{
"/unknown.jpg", //0
"/terminal.jpg", //1
"/terminal.jpg", //2
"/console.jpg", //3
"/printer.jpg", //4
"/card.jpg", //5
"/unknown.jpg", //6
"/printer.jpg", //7
"/tape.jpg", //8
"/net.jpg", //9
"/dasd.jpg", //10
"/net.jpg" //11
};
DeviceTypes::DeviceTypes()
{
}
DeviceTypes::~DeviceTypes()
{
}
DeviceTypes & DeviceTypes::instance()
{
return mInstance;
}
QIcon & DeviceTypes::getIcon(DeviceTypes::Type type)
{
if (sDeviceIcons.empty())
{
std::string iconsPath = Environment::getIconsPath();
for (int i=0; i NUM_DEVICES) return NULL;
return sDeviceNames[type];
}
HercConfiguration/CtcProperties.h 0000664 0001750 0001750 00000003222 12300664722 016475 0 ustar yakov yakov /*
* File: CtcProperties.h
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
*
* This object handles the configuration of the CTC
* $Id$
*
* 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 .
*
*/
#ifndef CTCPROPERTIES_H
#define CTCPROPERTIES_H
#include "ConfigLine.h"
#include "GenericDeviceProperties.h"
#include
#include "ui_CtcProperties.h"
class CtcProperties : public GenericDeviceProperties
{
Q_OBJECT
public:
CtcProperties(ConfigLine& configLine, QWidget *parent = 0);
virtual ~CtcProperties();
private:
Ui::CtcPropertiesClass ui;
bool macValidator(const std::string& mac);
void arrangeQeth(bool set);
void arrangeLcs(bool set);
void arrangeCtc(bool set);
void arrangeCtct(bool set);
void arrangeByType();
void initialize(ConfigLine & configLine);
private slots:
virtual void ok();
virtual void cancel();
virtual void oatBrowse();
void typeChanged(const QString &);
void tun0Check(int);
};
#endif // CTCPROPERTIES_H
HercConfiguration/ReaderFileListView.cpp 0000664 0001750 0001750 00000003053 12300664722 017735 0 ustar yakov yakov /*
* File: ReaderFileListView.cpp
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* 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 .
*
*/
#include "HerculesStudio.h"
#include "ReaderFileListView.h"
#include "CardReaderProperties.h"
#include
#include
ReaderFileListView::ReaderFileListView(QWidget * parent )
: QListView(parent)
{
}
ReaderFileListView::~ReaderFileListView()
{
}
void ReaderFileListView::setReaderParent(QWidget * parent)
{
mReaderParent = parent;
}
void ReaderFileListView::dropEvent ( QDropEvent * event )
{
QListView::dropEvent(event);
if (event->isAccepted())
{
CardReaderProperties * parent = NULL;
try
{
parent = static_cast(mReaderParent);
}
catch (...){}
if (parent != NULL)
{
parent->shouldBeDeleted();
}
}
}
HercConfiguration/PunchProperties.ui 0000664 0001750 0001750 00000010306 12300664722 017230 0 ustar yakov yakov
PunchPropertiesClass
0
0
474
344
PunchProperties
20
50
431
61
Printer
false
320
20
81
24
-
3525
-
10
20
101
19
Device Number
120
20
61
25
226
20
81
20
Device Type
20
130
431
191
Optional Arguments
140
30
113
25
20
30
101
21
File Name
340
140
78
29
Update
20
140
78
29
Cancel
10
110
84
24
Append
10
90
84
24
Crlf
10
70
84
24
Ascii
HercConfiguration/Configuration.cpp 0000644 0001750 0001750 00000035414 12344062251 017054 0 ustar yakov yakov /*
* File: Configuration.cpp
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* 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 .
*
*/
#include "Configuration.h"
#include "SystemConfigLine.h"
#include "DeviceConfigLine.h"
#include "ConfigurationFreeEditor.h"
#include "Preferences.h"
#include
#include
#include
#include
#define genEntry(keyword) {#keyword, ConfigurationEditor::keyword},
#define synonymEntry(keyword1, keyword2) {#keyword1, #keyword2}, {#keyword2, #keyword1},
struct ConfigTableEntry Configuration::mConfigTable[] = {
genEntry(ARCHMODE)
genEntry(ASN_AND_LX_REUSE)
genEntry(ALRF)
genEntry(AUTO_MOUNT)
genEntry(AUTO_SCSI_MOUNT)
//CODEPAGE
genEntry(CNSLPORT)
genEntry(CONKPALV)
genEntry(CPUMODEL)
genEntry(CPUPRIO)
genEntry(CPUSERIAL)
genEntry(CPUVERID)
//DEFSYM
genEntry(DEVPRIO)
genEntry(DEVTMAX)
genEntry(DIAG8CMD)
genEntry(ECPSVM)
genEntry(ENGINES)
genEntry(HERCPRIO)
genEntry(HTTPPORT)
genEntry(HTTPROOT)
//genEntry(IGNORE)
//INCLUDE
genEntry(IODELAY)
genEntry(LDMOD)
genEntry(LEGACYSENSEID)
genEntry(LOADPARM)
genEntry(LOGOPT)
genEntry(LPARNAME)
genEntry(MAINSIZE)
genEntry(MANUFACTURER)
genEntry(MODEL)
genEntry(MODPATH)
genEntry(MOUNTED_TAPE_REINIT)
genEntry(NUMCPU)
genEntry(NUMVEC)
genEntry(OSTAILOR)
genEntry(PANRATE)
//PANTITLE --
genEntry(PGMPRDOS)
genEntry(PLANT)
genEntry(SHCMDOPT)
genEntry(SHRDPORT)
genEntry(SYSEPOCH)
genEntry(TIMERINT)
genEntry(TODDRAG)
genEntry(TODPRIO)
//TRACEOPT --
genEntry(TZOFFSET)
genEntry(XPNDSIZE)
genEntry(YROFFSET)
{"",NULL}
};
Configuration::Configuration(ConfigFile* configFile, bool newConfig, QWidget *parent)
: QDialog(parent), mParent(parent), mConfigFile(configFile), mNewConfig(newConfig)
{
ui.setupUi(this);
mDevWgt = new DevicesWidget(configFile, ui.Configuration->widget(5));
mDevWgt->move(0,50);
mDevWgt->show();
mFreeEdit = new ConfigurationFreeEditor(ui.Configuration->widget(6));
mSyntaxHighlighter = new ConfigHighlight(mFreeEdit);
mSyntaxHighlighter->setDocument(mFreeEdit->document());
mFreeEdit->move(10,50);
mFreeEdit->resize(411, 671);
initilize();
populate(ConfigurationEditor::toScreen);
}
Configuration::~Configuration()
{
}
void Configuration::initilize()
{
DoubleDigitSpinBox * hh = new DoubleDigitSpinBox(ui.groupBox_4, true);
hh->setObjectName(QString::fromUtf8("tzOffsetHH"));
hh->setGeometry(QRect(ui.tzOffsetHH->geometry()));
hh->setMinimum(ui.tzOffsetHH->minimum());
hh->setMaximum(ui.tzOffsetHH->maximum());
if (ui.tzOffsetHH != NULL) delete ui.tzOffsetHH;
ui.tzOffsetHH = hh;
DoubleDigitSpinBox * mm = new DoubleDigitSpinBox(ui.groupBox_4, false);
mm->setObjectName(QString::fromUtf8("tzOffsetMM"));
mm->setGeometry(QRect(ui.tzOffsetMM->geometry()));
mm->setMaximum(ui.tzOffsetMM->maximum());
if (ui.tzOffsetMM != NULL) delete ui.tzOffsetMM;
ui.tzOffsetMM = mm;
mCurrTab = ui.Configuration->currentIndex();
ui.logopt->setVisible(false); // irrelevant for gui, but needed for syntax checking
connect(ui.pushButton_OK, SIGNAL(clicked()), this , SLOT(okPressed()));
connect(ui.pushButton_Cancel, SIGNAL(clicked()), this , SLOT(cancelPressed()));
connect(ui.autoMountBrowseButton, SIGNAL(clicked()), this, SLOT(autoMountBrowsePressed()));
connect(ui.autoScsiMountCheck, SIGNAL(stateChanged(int)), this, SLOT(autoScsiMountChanged()));
connect(ui.cpuPrioSlider, SIGNAL(valueChanged(int)), this, SLOT(cpuPrioChanged(int)) );
connect(ui.devPrioSlider, SIGNAL(valueChanged(int)), this, SLOT(devPrioChanged(int)) );
connect(ui.hercPrioSlider, SIGNAL(valueChanged(int)), this, SLOT(hercPrioChanged(int)) );
connect(ui.todPrioSlider, SIGNAL(valueChanged(int)), this, SLOT(todPrioChanged(int)) );
connect(ui.ecpSvm, SIGNAL(stateChanged(int)), this, SLOT(ecpSvmChanged(int)) );
connect(ui.httpPortCheckBox, SIGNAL(stateChanged(int)), this, SLOT(httpPortChanged(int)));
connect(ui.httpRootBrowseButton, SIGNAL(clicked()), this, SLOT(httpRootBrowsePressed()));
connect(ui.modPathButton, SIGNAL(clicked()), this, SLOT(modPathBrowsePressed()));
connect(ui.Configuration, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
connect(mFreeEdit, SIGNAL(blockCountChanged(int)), this, SLOT(blockCountChangedSlot()));
}
void Configuration::resizeEvent(QResizeEvent *event)
{
QDialog::resizeEvent(event);
// move buttons
int newY = qMax (530, size().height() - 47);
int newX = qMax ( 430, size().width() - 102);
ui.pushButton_OK->move(newX,newY);
ui.pushButton_Cancel->move(newX-100,newY);
// resize QTabWidget
int newHeight = qMax ( size().height() - 86 , 491 );
int newWidth = qMax ( size().width() - 41, 691 );
ui.Configuration->resize( newWidth, newHeight );
// resize plainTextEdit
newHeight = qMax ( size().height() - 164, 411);
newWidth = qMax ( size().width() - 61, 671);
mFreeEdit->resize( newWidth, newHeight);
}
void Configuration::populate(ConfigurationEditor::Direction dir)
{
if (mConfigFile == NULL || mNewConfig)
{
ui.fileNameLabel->setText("(new file)");
ui.fileNameLabel_2->setText("(new file)");
ui.fileNameLabel_3->setText("(new file)");
ui.fileNameLabel_4->setText("(new file)");
ui.fileNameLabel_5->setText("(new file)");
ui.fileNameLabel_6->setText("(new file)");
ui.fileNameLabel_7->setText("(new file)");
}
else
{
ui.fileNameLabel->setText(mConfigFile->getFileName().c_str());
ui.fileNameLabel_2->setText(mConfigFile->getFileName().c_str());
ui.fileNameLabel_3->setText(mConfigFile->getFileName().c_str());
ui.fileNameLabel_4->setText(mConfigFile->getFileName().c_str());
ui.fileNameLabel_5->setText(mConfigFile->getFileName().c_str());
ui.fileNameLabel_6->setText(mConfigFile->getFileName().c_str());
ui.fileNameLabel_7->setText(mConfigFile->getFileName().c_str());
}
for (int i=0; mConfigTable[i].keyword.compare("") != 0 ; i++)
{
hOutDebug(5,"populate:" << mConfigTable[i].keyword)
const ConfigLine * configLine = mConfigFile->locateLine(mConfigTable[i].keyword, true, true);
mConfigTable[i].populator(&ui, configLine, dir);
}
}
void Configuration::handleHighlight(const ConfigLine& configLine, QTextCursor& cursor, QTextCharFormat& format)
{
if (configLine.inError())
format.setForeground(Qt::red);
else
format.setForeground(Qt::black);
cursor.setCharFormat(format);
mFreeEdit->setTextCursor(cursor);
}
void Configuration::okPressed()
{
if (ui.Configuration->currentIndex() == 6)
ui.Configuration->setCurrentIndex(0);
populate(ConfigurationEditor::fromScreen);
if (mNewConfig)
{
mParent->connect(this,SIGNAL(OKSignal()), mParent, SLOT(saveConfigAs()));
emit OKSignal();
disconnect(this,0,0,0);
}
deleteLater();
}
void Configuration::cancelPressed()
{
disconnect(this,0,0,0);
deleteLater();
}
void Configuration::autoScsiMountChanged()
{
ui.autoScisiSecSpin->setEnabled(ui.autoScsiMountCheck->isChecked());
}
void Configuration::cpuPrioChanged(int newValue)
{
ui.cpuPrioNumber->display(newValue);
}
void Configuration::devPrioChanged(int newValue)
{
ui.devPrioNumber->display(newValue);
}
void Configuration::ecpSvmChanged(int newValue)
{
if (newValue == Qt::Checked)
{
ui.ecpSvmSpin->setEnabled(true);
}
else
{
ui.ecpSvmSpin->setEnabled(false);
}
}
void Configuration::httpPortChanged(int newValue)
{
if (newValue == Qt::Checked)
{
ui.httpPortSpin->setEnabled(true);
}
else
{
ui.httpPortSpin->setValue(0);
ui.httpPortSpin->setEnabled(false);
}
}
void Configuration::hercPrioChanged(int newValue)
{
ui.hercPrioNumber->display(newValue);
}
void Configuration::todPrioChanged(int newValue)
{
ui.clockPrioNumber->display(newValue);
}
void Configuration::autoMountBrowsePressed()
{
std::string s = QFileDialog::getExistingDirectory(this,"Browse Auto Mount Directory","").toStdString();
ui.autoMountDir->setText(s.c_str());
}
void Configuration::httpRootBrowsePressed()
{
std::string s = QFileDialog::getExistingDirectory(this,"Browse HTTP Root Directory",ui.httpRootDir->text()).toStdString();
ui.httpRootDir->setText(s.c_str());
}
void Configuration::modPathBrowsePressed()
{
std::string s = QFileDialog::getExistingDirectory(this,"Browse Modules Path Directory",ui.modPathButton->text()).toStdString();
ui.modPath->setText(s.c_str());
}
void Configuration::tabChanged(int newTab)
{
if (newTab == 6)
{
//populate configtab with data from first 5 tabs
mConfigFile->appendNewLines();
populate(ConfigurationEditor::fromScreen);
//build free editor data
mFreeEdit->document()->clear();
QTextCursor cursor = mFreeEdit->textCursor();
QTextCharFormat format = cursor.charFormat();
format.setFont(QFont(Preferences::getInstance().fontName(Preferences::ConfigurationFontObject).c_str(),
Preferences::getInstance().fontSize(Preferences::ConfigurationFontObject)));
cursor.setCharFormat(format);
mFreeEdit->setTextCursor(cursor);
for (int i=0; i<=mConfigFile->getLastSys(); i++)
{
SystemConfigLine * configLine = (*mConfigFile)[i];
if (!configLine->isNew())
mFreeEdit->textCursor().insertText(configLine->getLine().c_str());
configLine->setUpdated(false);
hOutDebug(5,"sys:" << i << configLine->getLine().c_str());
}
for (int i=mConfigFile->getLastSys()+1; isize(); i++)
{
const DeviceConfigLine * configLine = mConfigFile->getDevice(i);
mFreeEdit->textCursor().insertText(configLine->getLine().c_str());
hOutDebug(5,"dev:" << i << configLine->getLine().c_str());
}
cursor = mFreeEdit->textCursor();
cursor.setPosition(0);
mFreeEdit->setTextCursor(cursor);
}
else if (mCurrTab == 6)
{
//reconstruct configuration table from editor data
mConfigFile->updateEditor(*mFreeEdit);
mDevWgt->update(mConfigFile);
//populate first 5 tabs with data from table
populate(ConfigurationEditor::toScreen);
}
mCurrTab = newTab;
}
Configuration::DoubleDigitSpinBox::DoubleDigitSpinBox(QWidget * parent, bool appendPlus):
QSpinBox(parent)
{
mAppendPlus = appendPlus;
}
int Configuration::DoubleDigitSpinBox::valueFromText(const QString& text) const
{
return QSpinBox::valueFromText(text);
}
QString Configuration::DoubleDigitSpinBox::textFromValue(int value) const
{
std::stringstream ss;
int sig=1;
int pValue=value;
if (value < 0)
{
sig = -1;
pValue = -value;
}
ss << pValue;
QString ret = ss.str().c_str();
if (pValue < 10) ret = "0" + ret;
if (sig == -1) ret = "-" + ret;
if (mAppendPlus && sig != -1) ret = "+" + ret;
hOutDebug(5, "textFromValue:" << value << "='" << ret.toStdString())
return ret;
}
Configuration::HexSpinBox::HexSpinBox(QWidget * parent):
QSpinBox(parent)
{
this->setMaximum(0xffff);
}
int Configuration::HexSpinBox::valueFromText(const QString& text) const
{
hOutDebug(5,"ValueFromText:" << text.toStdString() << ConfigurationEditor::parseNum(text.toStdString(),16) );
return ConfigurationEditor::parseNum(text.toStdString(),16);
}
QString Configuration::HexSpinBox::textFromValue(int value) const
{
std::stringstream ss;
ss << std::hex << value;
char formatted[5];
if (value <= 0xffff)
sprintf(formatted,"%4.4X",(value));
else
strcpy(formatted,"0000");
QString ret(formatted);
hOutDebug(5, "textFromValue:" << value << "='" << ret.toStdString())
return ret;
}
void Configuration::blockCountChangedSlot()
{
int mLastSys=-1;
for (QTextBlock block = mFreeEdit->document()->begin();
block != mFreeEdit->document()->end();
block = block.next())
{
mLastSys++;
std::string str = block.text().toUtf8().data();
int skipSpace = str.find_first_not_of(" ");
if (skipSpace < 0 || str[skipSpace] == '#') continue;
if (str[skipSpace] >= '0' && str[skipSpace] <= '9')
break;
}
hOutDebug(5,"lastSys=" << mLastSys);
}
QValidator::State Configuration::HexSpinBox::validate (QString & input, int &) const
{
if (input.length() > 4 ||
input.toStdString().find_first_not_of("0123456789ABCDEFabcdef") != std::string::npos)
return QValidator::Invalid;
else
return QValidator::Acceptable;
}
ConfigHighlight::ConfigHighlight(QWidget * parent)
: QSyntaxHighlighter(parent)
{
mDummyUi.setupUi(&mDummyConfig);
mDummyConfig.setVisible(false);
mRed = QColor(255,0,0,255);
mGreen = QColor(0,96,0,255);
mBlue = QColor(0,0,255,255);
mBlack = QColor(64,64,64,255);
mGray = QColor(128,32,32,255);
}
void ConfigHighlight::highlightBlock(const QString &text)
{
hOutDebug(3,"Highlight:" << text.toStdString());
if (text.length() == 0) return;
if (previousBlockState() == 2)
{
setCurrentBlockState(2);
}
else
{
std::string str = text.toUtf8().data();
int skipSpace = str.find_first_not_of(" ");
if (skipSpace >= 0 && str[skipSpace] != '#')
{
if (str[skipSpace] >= '0' && str[skipSpace] <= '9')
setCurrentBlockState(2);
else
setCurrentBlockState(1);
}
}
if (currentBlockState() == 2)
{
setFormat(0,text.length(),mBlue);
return;
}
int remarkCol = text.indexOf("#");
ConfigLine configLine(text.toUtf8().data());
int i=0;
std::string tokenToSearch = configLine.getUppercaseToken(0);
while (Configuration::mConfigTable[i].keyword.length() != 0 && Configuration::mConfigTable[i].keyword.compare(tokenToSearch) != 0)
{
i++;
}
if (Configuration::mConfigTable[i].keyword.length() != 0 && Configuration::mConfigTable[i].keyword.compare(tokenToSearch) == 0)
{
Configuration::mConfigTable[i].populator(&mDummyUi, &configLine, ConfigurationEditor::toScreen);
int startCol = configLine.getAbsoluteTokenColumn(0);
int endCol = configLine.getAbsoluteTokenColumn(1);
setFormat(startCol,endCol-startCol+1,mBlue);
if (configLine.size() > 0)
{
int lastToken = configLine.size();
startCol = configLine.getAbsoluteTokenColumn(1);
endCol = configLine.getAbsoluteTokenColumn(lastToken-1) + configLine.getAbsoluteTokenEnd(lastToken-1);
setFormat(startCol,endCol-startCol+1,mGray);
}
if (configLine.inError())
{
setFormat(configLine.errorColumn(),configLine.getLine().size()-configLine.errorColumn(),mRed);
}
if (remarkCol != -1)
{
setFormat(remarkCol,configLine.getLine().size()-remarkCol,mGreen);
}
}
else
{
if (configLine.isRemark())
{
setFormat(0,configLine.getLine().size(),mGreen);
}
else
{
setFormat(0,configLine.getLine().size(),mRed);
if (remarkCol != -1)
{
setFormat(remarkCol,configLine.getLine().size()-remarkCol,mGreen);
}
}
}
}
HercConfiguration/DeviceMenuProcessor.h 0000664 0001750 0001750 00000004144 12300664722 017637 0 ustar yakov yakov /*
* File: DeviceMenuProcessor.h
*
* Author: Jacob Dekel
* Created on: Oct 14, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* This object is an interface for driving devices through menus
* (used by both the devices pane and the devices configuration tab)
*
* 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 .
*
*/
#ifndef DEVICEMENUPROCESSOR_H_
#define DEVICEMENUPROCESSOR_H_
#include "DeviceConfigLine.h"
#include "DeviceTypes.h"
#include
#include
class DeviceMenuProcessor : public QWidget
{
Q_OBJECT
public:
DeviceMenuProcessor(QWidget *parent = 0);
virtual ~DeviceMenuProcessor();
public slots:
void devicesClick(QMouseEvent * event);
void menuAddTerminal();
void menuAddConsole();
void menuAddPrinter();
void menuAddCardReader();
void menuAddCardPunch();
void menuAddTape();
void menuAddCTC();
void menuAddDasd();
void menuAddSYSG();
void menuLoad();
void menuUnload();
void newTapeFileOK(QString& tapeFile);
protected:
virtual bool isRealDev(int lineNumber) = 0;
virtual bool canAddSYSG() = 0;
virtual bool isConfig() = 0;
virtual bool realDevice() = 0;
virtual DeviceTypes::Type getType(int lineNumber) = 0;
virtual void doLoadTape(QString& tapeFileName) = 0;
virtual bool hasConfig() = 0;
virtual bool traced() = 0;
int mClickRow;
int mLastClick;
QMenu mMenu;
DeviceConfigLine * mCandidateLine;
private:
void menuAddItem(int);
};
#endif /* DEVICEMENUPROCESSOR_H_ */
HercConfiguration/CardReaderProperties.cpp 0000644 0001750 0001750 00000017613 12344062251 020317 0 ustar yakov yakov /*
* File: CardReaderProperties.cpp
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* 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 .
*
*/
#include "HerculesStudio.h"
#include "CardReaderProperties.h"
#include "NewReaderFile.h"
#include
CardReaderProperties::CardReaderProperties(ConfigLine& line, QWidget *parent)
: GenericDeviceProperties(line, parent), mNewReaderFile(NULL)
{
ui.setupUi(this);
ReaderFileListView * listView = static_cast(ui.fileNamesListView);
listView->setReaderParent(this);
initialize(line);
connect(ui.fileNamesListView, SIGNAL(pressed (const QModelIndex &)), this, SLOT(itemPressed( const QModelIndex &)));
connect(ui.sockdev, SIGNAL(textChanged(const QString &)), this, SLOT(sockdevChanged()));
connect(ui.addButton, SIGNAL(pressed()), this, SLOT(addPressed()));
connect(ui.deleteButton, SIGNAL(pressed()), this, SLOT(deletePressed()));
connect(ui.OKButton, SIGNAL(pressed()), this, SLOT(ok()));
connect(ui.cancelButton, SIGNAL(pressed()), this, SLOT(cancel()));
connect(ui.sockdevCheckBox, SIGNAL(stateChanged(int)), this, SLOT(sockdevChanged()));
}
CardReaderProperties::~CardReaderProperties()
{
}
void CardReaderProperties::ok()
{
if (!deviceNumberValidator(ui.deviceNumber))
return;
std::stringstream newLineBuff;
newLineBuff << ui.deviceNumber->text().toStdString()
<< " " << ui.deviceCombo->currentText().toStdString();
if (ui.sockdevCheckBox->isChecked())
{
newLineBuff << " " << ui.sockdev->text().toStdString();
}
else
{
if (mModel!=NULL)
{
for (int i=0; irowCount(); i++)
{
newLineBuff << " " << mModel->item(i)->text().toStdString();
}
}
}
if (ui.sockdevCheckBox->isChecked())
{
newLineBuff << " sockdev" ;
}
else
{
if (ui.eofRadioButton->isChecked())
{
newLineBuff << " eof";
}
if (ui.intrqRadioButton->isChecked())
{
newLineBuff << " intrq";
}
if (ui.multifileCheckBox->isChecked())
{
newLineBuff << " multifile";
}
}
if (ui.truncCheckBox->isChecked())
{
newLineBuff << " trunc";
}
if (ui.autopadCheckBox->isChecked())
{
newLineBuff << " autopad";
}
if (ui.ebcdicRadioButton->isChecked())
{
newLineBuff << " ebcdic";
}
if (ui.asciiRadioButton->isChecked())
{
newLineBuff << " ascii";
}
newLineBuff << "\n";
mLine.replaceLine(newLineBuff.str());
emit updateLine(true);
this->deleteLater();
}
void CardReaderProperties::cancel()
{
emit updateLine(false);
this->deleteLater();
}
void CardReaderProperties::itemPressed(const QModelIndex & index)
{
mDragCandidate = index.row();
mDragCount = mModel->rowCount();
hOutDebug(5, "index pressed:" << mDragCandidate << std::endl);
}
void CardReaderProperties::shouldBeDeleted()
{
hOutDebug(5, "should be deleted:" << mDragCandidate << std::endl);
if (mModel->rowCount() > mDragCount)
mModel->removeRow(mDragCandidate);
mDragCandidate=-1;
}
void CardReaderProperties::addPressed()
{
if (mNewReaderFile != NULL)
mNewReaderFile->close();
mNewReaderFile = new NewReaderFile(this);
mNewReaderFile->move(this->geometry().x(),this->geometry().y());
connect(mNewReaderFile, SIGNAL(okPressed(QString &)), this, SLOT(addFile(QString&)));
connect(mNewReaderFile, SIGNAL(destroyed(QObject *)), this, SLOT(newFileFinished(QObject *)));
hOutDebug(5, "add pressed:" << mDragCandidate << std::endl);
}
void CardReaderProperties::deletePressed()
{
hOutDebug(5, "delete pressed:" << std::endl);
if (ui.fileNamesListView->currentIndex().row() >= 0)
{
mModel->removeRow(ui.fileNamesListView->currentIndex().row());
}
ui.sockdevCheckBox->setEnabled (mModel->rowCount() == 0);
}
void CardReaderProperties::addFile(QString & file)
{
hOutDebug(5,"pickupFile:" << file.toStdString() << std::endl);
QStandardItem *parentItem = mModel->invisibleRootItem();
parentItem->appendRow(new QStandardItem(file));
ui.sockdevCheckBox->setEnabled (mModel->rowCount() == 0);
}
void CardReaderProperties::newFileFinished(QObject *)
{
mNewReaderFile = NULL;
}
void CardReaderProperties::sockdevChanged()
{
setSockdev(ui.sockdevCheckBox->isChecked());
ui.sockdevCheckBox->setEnabled (ui.sockdev->text().isEmpty());
}
void CardReaderProperties::setSockdev(bool enabled)
{
ui.addButton->setVisible(!enabled);
ui.deleteButton->setVisible(!enabled);
ui.fileNamesListView->setVisible(!enabled);
ui.label->setVisible(!enabled);
ui.multifileCheckBox->setVisible(!enabled);
ui.eofGroupBox->setVisible(!enabled);
ui.sockdev->setVisible(enabled);
ui.sockspecLabel->setVisible(enabled);
}
void CardReaderProperties::initialize(const ConfigLine & line)
{
if (line.size() > 0)
ui.deviceNumber->setText(line.getToken(0).c_str());
std::string dev = line.getToken(1);
if (dev == "2501")
ui.deviceCombo->setCurrentIndex(1);
else if (dev == "3505")
ui.deviceCombo->setCurrentIndex(2);
else ui.deviceCombo->setCurrentIndex(0);
mModel = new QStandardItemModel(0,3);
mModel->clear();
QStandardItem *parentItem = mModel->invisibleRootItem();
ui.autoDetectRadioButton->setChecked(true); // default
ui.eofNoneRadioButton->setChecked(true); // default
int index = line.size()-1;
if (index >= 2)
{
std::string keywords = "sockdev eof intrq multifile ebcdic ascii trunc autopad";
ui.sockdevCheckBox->setChecked(false);
while (keywords.find(line.getToken(index)) != std::string::npos)
{
if (line.getToken(index) == "sockdev")
{
ui.sockdevCheckBox->setChecked(true);
}
else if (line.getToken(index) == "eof")
{
ui.eofRadioButton->setChecked(true);
}
else if (line.getToken(index) == "intrq")
{
ui.intrqRadioButton->setChecked(true);
}
else if (line.getToken(index) == "multifile")
{
ui.multifileCheckBox->setChecked(true);
}
else if (line.getToken(index) == "ebcdic")
{
ui.ebcdicRadioButton->setChecked(true);
}
else if (line.getToken(index) == "ascii")
{
ui.asciiRadioButton->setChecked(true);
}
else if (line.getToken(index) == "trunc")
{
ui.truncCheckBox->setChecked(true);
}
else if (line.getToken(index) == "autopad")
{
ui.autopadCheckBox->setChecked(true);
}
index--;
}
if (!ui.sockdevCheckBox->isChecked())
{
for (int i=0; i<=index-2; i++)
{
parentItem->appendRow(new QStandardItem(line.getToken(i+2).c_str()));
}
}
else
{
ui.sockdev->setText(line.getToken(2).c_str());
}
}
sockdevChanged();
ui.fileNamesListView->setModel(mModel);
ui.fileNamesListView->setViewMode(QListView::ListMode);
}
HercConfiguration/VisualizedDeviceEntry.h 0000664 0001750 0001750 00000004153 12300664722 020174 0 ustar yakov yakov /*
* File: VisualizedDeviceEntry.h
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* This is the base class for all configuration device entries
* 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 .
*
*/
#ifndef DEVICEENTRY_H_
#define DEVICEENTRY_H_
#include "DeviceTypes.h"
#include
#include
#include
#include
class VisualizedDeviceEntry
{
public:
VisualizedDeviceEntry(int number, DeviceTypes::Type type, const std::string& definition);
VisualizedDeviceEntry();
virtual ~VisualizedDeviceEntry();
inline int getDeviceNumber(){ return mNumber; }
inline int getLineNumber(){ return mLine; }
inline DeviceTypes::Type getType() { return mType; }
inline QPixmap * getPixmap() { return mPixmap; }
inline QIcon * getIcon() { return mIcon; }
inline QStandardItem * getItem() { return mItem; }
inline std::string getDefinition() { return mDefinition; }
inline bool traced() { return mTraced; }
inline void setLineNumber(int lineNumber) { mLine = lineNumber; }
inline void setPixmap(QPixmap * w) { mPixmap=w; }
inline void setIcon(QIcon * w) { mIcon=w; }
inline void setItem(QStandardItem * w) { mItem=w; }
inline void setTraced(bool traced) { mTraced = traced; }
private:
int mNumber;
int mLine;
DeviceTypes::Type mType;
std::string mDefinition;
QPixmap * mPixmap;
QIcon * mIcon;
QStandardItem * mItem;
bool mTraced;
};
#endif /* DEVICEENTRY_H_ */
HercConfiguration/CtcProperties.ui 0000664 0001750 0001750 00000022452 12300664722 016671 0 ustar yakov yakov
CtcPropertiesClass
0
0
474
575
CtcProperties
20
50
431
61
CTC
true
320
20
81
24
-
LCS
-
CTCI
-
CTCT
-
QETH
10
20
101
19
Device Number
120
20
61
25
226
20
81
20
Device Type
20
140
431
401
Parameters
110
20
113
26
000.000.000.000;
20
30
53
16
Guest IP
20
70
53
16
Host IP
110
60
113
26
000.000.000.000;
240
30
31
16
Mask
290
20
113
26
000.000.000.000;
20
150
53
16
MAC
110
140
171
26
hh:hh:hh:hh:hh:hh;
300
140
53
16
(optional)
110
100
301
26
20
110
81
16
Tunnel Device
20
190
91
16
OAT File Name
110
180
211
26
330
180
21
26
...
240
70
61
16
Host Port
320
60
61
26
1024
65535
30880
110
240
71
26
1024
65535
30880
20
250
81
16
Local Port
320
350
80
26
Update
20
350
80
26
Cancel
20
290
71
16
Buffer Size
110
280
71
26
256
65535
1500
250
110
141
24
tun0 device
HercConfiguration/GenericDeviceProperties.h 0000644 0001750 0001750 00000003210 12344062251 020450 0 ustar yakov yakov /*
* File: GenericDeviceProperties.h
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* This is the base class for all devices properties dialogs
*
* 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 .
*
*/
#ifndef GENERICDEVICEPROPERTIES_H_
#define GENERICDEVICEPROPERTIES_H_
#include "DeviceConfigLine.h"
#include "DeviceTypes.h"
#include "IpValidator.h"
#include
#include
class GenericDeviceProperties : public IpValidator
{
Q_OBJECT
public:
GenericDeviceProperties(ConfigLine& line, QWidget *parent);
virtual ~GenericDeviceProperties();
static GenericDeviceProperties * classFactory(DeviceConfigLine& line, QWidget *parent, DeviceTypes::Type type=DeviceTypes::Other);
protected:
ConfigLine & mLine;
QWidget * mParent;
bool deviceNumberValidator(QLineEdit * deviceLine);
int mOriginalDeviceNumber;
private slots:
virtual void ok()=0;
virtual void cancel()=0;
signals:
void updateLine(bool keep);
};
#endif /* GENERICDEVICEPROPERTIES_H_ */
HercConfiguration/Extended_Ui_CardReaderProperties.h 0000664 0001750 0001750 00000002563 12300664722 022244 0 ustar yakov yakov /*
* File: Extended_Ui_CardReaderProperties.h
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* This object extends the card reader gui class to include ReaderFileListView
*
* 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 .
*
*/
#ifndef EXTENDED_UI_CARDREADERPROPERTIES_H_
#define EXTENDED_UI_CARDREADERPROPERTIES_H_
#include "ui_CardReaderProperties.h"
#include "ReaderFileListView.h"
class Extended_Ui_CardReaderProperties: public Ui::CardReaderPropertiesClass
{
public:
Extended_Ui_CardReaderProperties();
virtual ~Extended_Ui_CardReaderProperties();
void setupUi(QWidget *CardReaderPropertiesClass);
ReaderFileListView *fileNamesListView;
};
#endif /* EXTENDED_UI_CARDREADERPROPERTIES_H_ */
HercConfiguration/Extended_Ui_CardReaderProperties.cpp 0000664 0001750 0001750 00000002560 12300664722 022574 0 ustar yakov yakov /*
* File: Extended_Ui_CardReaderProperties.cpp
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* 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 .
*
*/
#include "Extended_Ui_CardReaderProperties.h"
Extended_Ui_CardReaderProperties::Extended_Ui_CardReaderProperties()
{
}
Extended_Ui_CardReaderProperties::~Extended_Ui_CardReaderProperties()
{
}
void Extended_Ui_CardReaderProperties::setupUi(QWidget *widget)
{
CardReaderPropertiesClass::setupUi(widget);
fileNamesListView = new ReaderFileListView(groupBox_2);
fileNamesListView->setObjectName(QString::fromUtf8("fileNamesListView"));
fileNamesListView->setGeometry(QRect(90, 90, 331, 168));
fileNamesListView->setMovement(QListView::Snap);
}
HercConfiguration/Configuration.h 0000664 0001750 0001750 00000006673 12300664722 016533 0 ustar yakov yakov /*
* File: Configuration.h
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* This object manages the Hercules configuration
*
* 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 .
*
*/
#ifndef CONFIGURATION_H
#define CONFIGURATION_H
#include "ConfigFile.h"
#include "HerculesStudio.h"
#include "ConfigurationEditor.h"
#include "DevicesWidget.h"
#include "ui_Configuration.h"
#include
#include
struct ConfigTableEntry
{
std::string keyword;
void (*populator)(Ui::ConfigurationClass *, const ConfigLine *, ConfigurationEditor::Direction dir);
};
class Configuration : public QDialog
{
Q_OBJECT
public:
Configuration(ConfigFile* confignFile, bool newConfig = false, QWidget *parent = 0);
virtual ~Configuration();
class DoubleDigitSpinBox : public QSpinBox
{
public:
DoubleDigitSpinBox(QWidget * parent = 0, bool appendPlus=false);
protected:
virtual int valueFromText(const QString& text) const;
virtual QString textFromValue(int value) const;
private:
bool mAppendPlus;
};
class HexSpinBox : public QSpinBox
{
public:
HexSpinBox(QWidget * parent = 0);
virtual QString textFromValue(int value) const;
protected:
virtual int valueFromText(const QString& text) const;
QValidator::State validate(QString & input, int & pos) const;
};
protected:
virtual void resizeEvent ( QResizeEvent * event );
private:
Ui::ConfigurationClass ui;
DevicesWidget * mDevWgt;
QPlainTextEdit * mFreeEdit;
QSyntaxHighlighter * mSyntaxHighlighter;
QWidget * mParent;
ConfigFile * mConfigFile;
bool mNewConfig;
bool mChanged; // text changed since last validation
bool mTimerSet; // validation timer was set
int mCurrTab;
int mLastSys; // updated by blockCountChanged()
static struct ConfigTableEntry mConfigTable[];
friend class ConfigHighlight;
void initilize();
void populate(ConfigurationEditor::Direction);
void handleHighlight(const ConfigLine& configLine, QTextCursor& cursor, QTextCharFormat& format);
signals:
void OKSignal();
private slots:
void okPressed();
void cancelPressed();
void autoMountBrowsePressed();
void autoScsiMountChanged();
void cpuPrioChanged(int);
void devPrioChanged(int);
void hercPrioChanged(int);
void todPrioChanged(int);
void ecpSvmChanged(int);
void httpPortChanged(int);
void httpRootBrowsePressed();
void modPathBrowsePressed();
void tabChanged(int);
void blockCountChangedSlot();
};
class ConfigHighlight : public QSyntaxHighlighter
{
Q_OBJECT
public:
ConfigHighlight(QWidget * parent);
protected:
void highlightBlock(const QString &text);
private:
QDialog mDummyConfig;
Ui::ConfigurationClass mDummyUi;
QColor mGreen;
QColor mRed;
QColor mBlack;
QColor mBlue;
QColor mGray;
};
#endif // CONFIGURATION_H
HercConfiguration/TapeProperties.ui 0000664 0001750 0001750 00000043753 12300664722 017060 0 ustar yakov yakov
TapePropertiesClass
0
0
506
526
TapeProperties
40
60
431
61
Tape
true
320
20
81
24
0
-
3410
-
3420
-
3422
-
3430
-
3480
-
3490
-
3590
-
9347
-
8809
10
20
101
19
Device Number
120
20
61
25
226
20
81
20
Device Type
40
140
431
311
Properties
20
70
351
29
380
70
41
29
...
20
50
57
19
File Name
20
110
131
25
Causes HET files to be written in AWSTAPE format.
This basically, disables the additional features provided by the HET format.
AWSTAPE
20
140
131
28
Compression (IDRC) : compression method to use
-
No Compression
-
ZLib
-
BZip2
170
150
241
16
1
9
5
Qt::Horizontal
QSlider::TicksBelow
1
180
170
16
19
1
390
170
16
19
9
20
190
111
29
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Liberation Sans'; font-size:9pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The <span style=" font-family:'Courier New,courier';">CHUNKSIZE</span> option allows you to create HET files that contain different chunk sizes. The AWSTAPE (and therefore the HET) format allows each tape block to be logically broken up into smaller chunks. For instance, if your S/3x0 application creates tapes with a block size of 27998, those blocks would be broken down into <span style=" font-family:'Courier New,courier'; font-style:italic;">nnnnn</span> Â sized chunks. The range is from <span style=" font-family:'Courier New,courier';">4096</span> to <span style=" font-family:'Courier New,courier';">65535</span>, the latter being the default. Decreasing the value from its default may reduce compression performance. For compatibility with AWSTAPE files created by the P/390, specify <span style=" font-family:'Courier New,courier';">AWSTAPE</span> with <span style=" font-family:'Courier New,courier';">CHUNKSIZE=4096</span>. </p></body></html>
4096
65535
65535
140
200
91
19
Chunk Size
20
100
191
25
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Liberation Sans'; font-size:9pt; font-weight:400; font-style:normal;">
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This option is intended to prevent issuance of the Erase Gap command to those SCSI tape drives which do not support it (such as the Quantum DLT series). It causes Hercules's device emulation logic to ignore any Erase Gap commands issued to the drive and to return immediate 'success' instead. </p>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This option should only be used (specified) for drives such as the Quantum, which support switching from read mode to write mode in the middle of a data stream without the need of an intervening Erase Gap command. Specifying it for any other model SCSI drive may cause incorrect functioning as a result of the Erase Gap command not being issued to the actual SCSI hardware. </p>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Check the manufacturer information for your particular model of SCSI-attached tape drive (and/or use Fish's "<a href="http://www.softdevlabs.com/Hercules"><span style=" text-decoration: underline; color:#0000ff;">ftape</span></a>" Windows utility) to determine whether or not this option is needed for your particular drive. </p></body></html>
Ignore Erase-Gap commands
180
240
111
16
Maximum file size
20
230
61
26
Specifies the maximum size (in bytes, Kilobytes or Megabytes)
that the emulated file is allowed to grow to. Specifying zero for this parameter means "unlimited"
1023
90
230
75
26
-
Bytes
-
Kilobytes
-
Megabytes
100
280
181
16
End-of-tape margin (kilobytes)
20
270
61
26
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Liberation Sans'; font-size:9pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Specifies the number of bytes remaining before reaching <span style=" font-style:italic;">maxsize</span> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">at which point the tape device will signal the presence of the </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">"End of Tape" marker (reflector), thus allowing the program </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">to switch to the next tape. </p></body></html>
999
110
110
80
22
Specifies whether the tape is mounted read-only (without a write ring
or with the cartridge protect switch set to "write protect")
Readonly
210
110
131
22
Specifies whether a device end is presented if intervention is required during tape motion
Device-end on IRQ
20
120
161
25
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Liberation Sans'; font-size:9pt; font-weight:400; font-style:normal;">
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This option indicates that your SCSI-attached tape drive only supports 32-bit block-ids (as used by 3590 drives) and not the 22-bit format used by 3480/3490 drives. You should only specify this option if you intend to define the drive as a model 3480 or 3490 device, and then only if your actual SCSI drive uses 32-bit block-ids of course. If you define your Hercules tape drive as a model 3590 device however, then this option is of course not needed since model 3590 drives are already presumed to use 32-bit block-ids. </p>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Specifying this option on a 3480/3490 device statement will cause Hercules device emulation logic to automatically translate the actual SCSI tape drive's 32-bit block-id into 22-bit format before returning it back to the guest operating system (since that is the format it expects it to be in for a model 3480/3490 drive), and to translate the guest's 22-bit format block-id into 32-bit format before sending it to the actual SCSI hardware (since that is the format that the actual hardware requires it to be in). </p></body></html>
32-bit Blockids Only
20
20
291
22
Do not allow guest initiated mounts
390
480
80
29
Update
40
480
80
29
Cancel
HercConfiguration/CardReaderProperties.h 0000664 0001750 0001750 00000003616 12300664722 017767 0 ustar yakov yakov /*
* File: CardReaderProperties.h
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* This object handles the configuration of the card reader
*
* 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 .
*
*/
#ifndef CARDREADERPROPERTIES_H
#define CARDREADERPROPERTIES_H
#include "GenericDeviceProperties.h"
#include "Extended_Ui_CardReaderProperties.h"
#include
class NewReaderFile;
class CardReaderProperties : public GenericDeviceProperties
{
Q_OBJECT
public:
CardReaderProperties(ConfigLine& line, QWidget *parent = 0);
virtual ~CardReaderProperties();
// Item previously dragged, was relocated, and the original should be deleted
void shouldBeDeleted();
private:
Extended_Ui_CardReaderProperties ui;
QStandardItemModel * mModel;
NewReaderFile * mNewReaderFile;
int mDragCandidate, mDragCount;
std::vector mFileList;
void setSockdev(bool checked);
void initialize(const ConfigLine & line);
private slots:
void ok();
void cancel();
void itemPressed (const QModelIndex &);
void addPressed();
void deletePressed();
void addFile(QString& str);
void newFileFinished(QObject * obj);
void sockdevChanged();
};
#endif // CARDREADERPROPERTIES_H
HercConfiguration/DevicesWidget.h 0000664 0001750 0001750 00000004055 12300664722 016442 0 ustar yakov yakov /*
* File: DevicesWidget.h
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* This object presents the devices section in the configuration
*
* 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 .
*
*/
#ifndef DEVICESDLG_H_
#define DEVICESDLG_H_
#include "ConfigFile.h"
#include "DeviceConfigView.h"
#include "DeviceMenuProcessor.h"
#include
#include
#include
class DevicesWidget : public DeviceMenuProcessor
{
Q_OBJECT
public:
DevicesWidget(ConfigFile * configFile, QWidget * parent);
virtual ~DevicesWidget();
void update(ConfigFile * configFile);
bool isUnique(std::string devno);
private:
ConfigFile * mConfigFile;
DeviceConfigView * mConfigView;
QMenu mMenu;
std::map mDialogToFile;
QIcon *mCardIcon;
QIcon *mConsoleIcon;
QIcon *mDasdIcon;
QIcon *mNetIcon;
QIcon *mPrinterIcon;
QIcon *mTapeIcon;
QIcon *mTerminalIcon;
QIcon *mUnknownIcon;
void initialize();
virtual bool isRealDev(int) { return true;}
bool canAddSYSG();
bool isConfig() { return true; };
bool realDevice();
DeviceTypes::Type getType(int lineNumber);
virtual void doLoadTape(QString&) { return; }
virtual bool hasConfig() { return true; };
virtual bool traced() { return false; }
private slots:
void mousePressed(QModelIndex index);
void doAddDevice(bool keep);
void updateDevice(bool);
public slots:
void menuDelete();
void menuProperties();
};
#endif /* DEVICESDLG_H_ */
HercConfiguration/DeviceConfigLine.h 0000664 0001750 0001750 00000003155 12300664722 017051 0 ustar yakov yakov /*
* File: DeviceConfigLine.h
*
* Author: Jacob Dekel
* Created on: Aug 7, 2009
*
* Copyright (c) 2009-2013 Jacob Dekel
* $Id$
*
* This object manages one configuration line belonging to devices
* (see also ConfigLine.h)
*
* 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 .
*
*/
#ifndef DEVICECONFIGLINE_H_
#define DEVICECONFIGLINE_H_
#include "ConfigLine.h"
#include "DeviceTypes.h"
#include