init project
This commit is contained in:
parent
a518f9a7d8
commit
4a307cdb5b
|
@ -0,0 +1,674 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
15
README.md
15
README.md
|
@ -1,2 +1,15 @@
|
|||
# kylin-nm-dev
|
||||
# NAME
|
||||
kylin-nm - kylin network monitor used in ubuntu-kylin operation system
|
||||
|
||||
# DESCRIPTION
|
||||
kylin-nm is a Qt based applet and uses some interface provided by NetworkManager.
|
||||
It provides a GUI for users to connect or disconnect wired or wireless network which managed by NetworkManager.
|
||||
Users can also create new wired network and configure a old network.
|
||||
By click button at left bottom in the main window, a network configure window of NetworkManager will show in the screen.
|
||||
Users can get some information about network directly by clicking one item in the network list, these information shown in extension area.
|
||||
|
||||
# BUILD KYLIN-NM
|
||||
down the source sode
|
||||
install dependency packages(see cntrol files in the debian directory)
|
||||
execute debuild command in the root directory of project
|
||||
execute sudo dpkg -i packagename.deb to install
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
# Triggers added by dh_makeshlibs/12.10kylin1
|
||||
activate-noawait ldconfig
|
|
@ -0,0 +1 @@
|
|||
7b336410c2ea6a28fb5e82d1e1453edfca2466da dd9b67ac5094cc99140951a7e5bfe818fa05a2f4
|
|
@ -0,0 +1,13 @@
|
|||
Package: kylin-nm-dev-dbgsym
|
||||
Package-Type: ddeb
|
||||
Source: kylin-nm-dev
|
||||
Version: 3.20.0.0
|
||||
Auto-Built-Package: debug-symbols
|
||||
Architecture: amd64
|
||||
Maintainer: Kylin Team <team+kylin@tracker.debian.org>
|
||||
Installed-Size: 6051
|
||||
Depends: kylin-nm-dev (= 3.20.0.0)
|
||||
Section: debug
|
||||
Priority: optional
|
||||
Description: debug symbols for kylin-nm-dev
|
||||
Build-Ids: 7b336410c2ea6a28fb5e82d1e1453edfca2466da dd9b67ac5094cc99140951a7e5bfe818fa05a2f4
|
|
@ -0,0 +1,2 @@
|
|||
10ec666fec3a91ace445b4cc5b4c71e1 usr/lib/debug/.build-id/7b/336410c2ea6a28fb5e82d1e1453edfca2466da.debug
|
||||
0362918325390826b5afee3480cb61a1 usr/lib/debug/.build-id/dd/9b67ac5094cc99140951a7e5bfe818fa05a2f4.debug
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,6 @@
|
|||
kylin-nm-dev (3.20.0.0) v101; urgency=medium
|
||||
|
||||
* new
|
||||
|
||||
-- zhaoshixu <zhaoshixu@kylinos.cn> Wed, 08 Jun 2022 10:00:53 +0800
|
||||
|
|
@ -0,0 +1 @@
|
|||
9
|
|
@ -0,0 +1,37 @@
|
|||
Source: kylin-nm-dev
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Maintainer: Kylin Team <team+kylin@tracker.debian.org>
|
||||
Uploaders: handsome_feng <jianfengli@ubuntukylin.com>
|
||||
Build-Depends: debhelper (>=9),
|
||||
qtbase5-dev,
|
||||
qt5-qmake,
|
||||
qtchooser,
|
||||
qtscript5-dev,
|
||||
qttools5-dev-tools,
|
||||
qtbase5-dev-tools,
|
||||
libqt5x11extras5-dev,
|
||||
libgsettings-qt-dev,
|
||||
libkf5windowsystem-dev,
|
||||
libx11-dev,
|
||||
libqt5svg5-dev,
|
||||
libkf5networkmanagerqt-dev (>= 5.36.0),
|
||||
libnm-dev,
|
||||
libcap-dev,
|
||||
libnma-dev,
|
||||
libsecret-1-dev,
|
||||
Standards-Version: 4.5.0
|
||||
Rules-Requires-Root: no
|
||||
Homepage: https://github.com/ukui/kylin-nm
|
||||
Vcs-Git: https://github.com/ukui/kylin-nm.git
|
||||
Vcs-Browser: https://github.com/ukui/kylin-nm
|
||||
|
||||
Package: kylin-nm-dev
|
||||
Architecture: any
|
||||
Depends: network-manager (>=1.2.6),
|
||||
${shlibs:Depends},
|
||||
${misc:Depends}
|
||||
Description: Gui Applet tool for display and edit network simply
|
||||
Kylin NM is a Applet tool for managing network settings simply.
|
||||
It has beautiful UI and very comfortable to use.
|
||||
It's better work together with UKUI.
|
|
@ -0,0 +1,25 @@
|
|||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: kylin-nm-dev
|
||||
Upstream-Contact: Kylin Team <ukui@kylinos.cn>
|
||||
Source: https://github.com/ukui/kylin-nm
|
||||
|
||||
Files: *
|
||||
Copyright: 2019, Tianjin KYLIN Information Technology Co., Ltd.
|
||||
License: GPL-3+
|
||||
|
||||
License: GPL-3+
|
||||
This package 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 package 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 Genaral Public License for more details.
|
||||
.
|
||||
You should have received a copy og the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
.
|
||||
On Debian systems, the complete text of the GNU General
|
||||
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/make -f
|
||||
|
||||
export QT_SELECT=5
|
||||
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
|
||||
|
||||
QMAKE_OPTS = DEFINES+=NO_DEBUG_ON_CONSOLE
|
||||
MAKE_OPTS = PREFIX=/usr QMAKE=qmake LRELEASE=lrelease QMAKE_OPTS="$(QMAKE_OPTS)"
|
||||
|
||||
override_dh_auto_configure:
|
||||
QT_SELECT=qt5 dh_auto_configure \
|
||||
-- "QMAKE_CXXFLAGS=$(CFLAGS)" \
|
||||
kylin-nm.pro
|
||||
|
||||
%:
|
||||
dh $@
|
||||
|
||||
override_dh_install:
|
||||
dh_install
|
||||
|
||||
override_dh_missing:
|
||||
dh_missing --fail-missing
|
||||
|
||||
override_dh_auto_clean:
|
||||
[ ! -d .moc ] || $(RM) -r .moc
|
||||
[ ! -d .obj ] || $(RM) -r .obj
|
||||
[ ! -d .ui ] || $(RM) -r .ui
|
||||
[ ! -f Makefile ] || dh_auto_clean
|
||||
|
||||
override_dh_auto_build:
|
||||
dh_auto_build -- $(MAKE_OPTS)
|
||||
|
||||
override_dh_shlibdeps:
|
||||
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
|
||||
|
|
@ -0,0 +1 @@
|
|||
3.0 (native)
|
|
@ -0,0 +1,2 @@
|
|||
version=4
|
||||
https://github.com/ukui/kylin-nm/releases .*/kylin-nm_(\d\S+)\.orig\.tar\.gz
|
|
@ -0,0 +1,77 @@
|
|||
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g filter="url(#filter0_i_6285_186732)">
|
||||
<path d="M9.59994 14.9488C9.59994 10.1061 13.3194 6.16587 18.1333 6.16587C22.9471 6.16587 26.8639 10.1061 26.8639 14.9488V26.3141H31.9999V14.9488C31.9999 7.25707 25.7791 1 18.1333 1C10.4874 1 4.2666 7.25707 4.2666 14.9488V22.1819H9.59994V14.9488Z" fill="#EAEAEA"/>
|
||||
</g>
|
||||
<path d="M0 19.1333H36.2667V40.7333C36.2667 42.9424 34.4758 44.7333 32.2667 44.7333H4C1.79086 44.7333 0 42.9424 0 40.7333V19.1333Z" fill="url(#paint0_linear_6285_186732)"/>
|
||||
<path d="M36.2667 19.1333H0V19.2997C4.63573 20.472 11.0475 21.1984 18.1333 21.1984C25.2192 21.1984 31.6309 20.472 36.2667 19.2997V19.1333Z" fill="#FCEFD2"/>
|
||||
<path d="M36.2667 19.1333H0V19.2506C4.63573 20.0752 11.0475 20.5861 18.1333 20.5861C25.2192 20.5861 31.6309 20.0752 36.2667 19.2506V19.1333Z" fill="#FFD18F"/>
|
||||
<path d="M22.4173 44.7333L22.5037 44.6469L22.6755 44.7333H23.66L25.1949 43.1984L24.3661 41.5418L25.6088 40.2992L27.2653 41.128L32.8931 35.5002C33.9437 36.0773 35.069 36.4677 36.2211 36.6757V19.1333L28.5667 20.5349C28.1741 20.8336 28.7043 21.113 27.7336 21.2666C26.8653 23.4629 28.1368 24.4496 28.8003 27.6666L11.8701 44.6874L22.4173 44.7333Z" fill="#DE9653"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M29.2526 15.8032C33.5417 11.5142 40.4942 11.5142 44.7833 15.8032C49.0723 20.0912 49.0723 27.0448 44.7854 31.3339C41.2515 34.8678 35.9139 35.4822 31.7433 33.1942L28.1155 36.8219L26.459 35.9931L25.2163 37.2358L26.0451 38.8923L24.1817 40.7558L23.3529 40.3419L22.1102 41.5846L22.5241 42.4134L21.2814 43.656L19.6249 42.8272L18.3822 44.0699L19.211 45.7264L17.2067 47.7307L12.1699 46.5542L12.2361 42.76L26.9838 28.0112C25.2014 23.9824 25.9513 19.1046 29.2526 15.8032ZM37.3294 18.9083C36.1283 20.1094 36.1283 22.056 37.3294 23.2571C38.5294 24.4582 40.4771 24.4582 41.6782 23.2571C42.8793 22.056 42.8793 20.1094 41.6782 18.9083C40.4771 17.7072 38.5305 17.7072 37.3294 18.9083Z" fill="url(#paint1_linear_6285_186732)"/>
|
||||
<path d="M17.2055 47.7297L19.2097 45.7254L18.3809 44.0689L19.6236 42.8262L21.2801 43.655L22.5228 42.4123L22.1089 41.5835L23.3505 40.3419L24.1793 40.7558L26.0428 38.8923L25.2151 37.2358L26.4577 35.9931L28.1143 36.8209L30.1847 34.7505L27.6993 33.5078L14.1836 47.0246L17.2055 47.7297Z" fill="url(#paint2_linear_6285_186732)"/>
|
||||
<path d="M12.1689 46.5539L26.458 32.2648L25.8361 31.644L12.1913 45.2888L12.1689 46.5539Z" fill="url(#paint3_linear_6285_186732)"/>
|
||||
<path d="M26.4579 32.2651L12.4355 46.2865L12.5913 46.6523L26.715 32.5233L26.4579 32.2651Z" fill="url(#paint4_linear_6285_186732)"/>
|
||||
<path d="M27.4009 28.4272L27.3988 28.4219L26.9828 28.0059L26.9849 28.0112L12.2361 42.76L12.1689 46.5541L12.5913 46.6523L12.6521 43.176L27.4009 28.4272Z" fill="url(#paint5_linear_6285_186732)"/>
|
||||
<path d="M44.7831 15.8032C40.494 11.5142 33.5415 11.5142 29.2524 15.8032C25.7783 19.2774 25.1202 24.4998 27.2748 28.6384L27.6119 28.3014C25.6247 24.3526 26.2722 19.4171 29.5692 16.12C33.6823 12.007 40.3522 12.007 44.4652 16.12C48.5783 20.2331 48.5783 26.903 44.4652 31.016C41.0903 34.391 35.998 34.9915 32.0055 32.8294L31.678 33.1568C35.8572 35.4864 41.2311 34.8848 44.782 31.3339C49.0722 27.0448 49.0722 20.0912 44.7831 15.8032Z" fill="url(#paint6_linear_6285_186732)"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M47.9319 22.3921C48.0801 25.382 47.0241 28.4198 44.7415 30.7025C41.2087 34.2353 35.87 34.8508 31.6993 32.5628L28.0716 36.1905L26.4151 35.3617L25.1724 36.6044L25.3964 37.0534L26.4567 35.9932L28.1132 36.822L31.7409 33.1942C35.9116 35.4822 41.2492 34.8678 44.7831 31.334C47.2279 28.8892 48.2732 25.5804 47.9319 22.3921ZM19.582 42.1948L21.2385 43.0236L22.2988 41.9633L22.5228 42.4124L21.2801 43.655L19.6236 42.8262L18.5633 43.8865L18.3393 43.4374L19.582 42.1948ZM19.2097 45.7265L18.9857 45.2774L17.1628 47.1004L14.6999 46.5052L14.1836 47.0246L17.2055 47.7308L19.2097 45.7265ZM23.3089 39.7116L24.1377 40.1254L25.8188 38.4444L26.0428 38.8934L24.1793 40.7569L23.3505 40.343L22.2903 41.4033L22.0663 40.9542L23.3089 39.7116Z" fill="url(#paint7_linear_6285_186732)"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M35.9619 21.1013C35.9619 19.1557 37.5395 17.5781 39.4851 17.5781C41.4307 17.5781 43.0083 19.1557 43.0083 21.1013C43.0083 23.0469 41.4307 24.6245 39.4851 24.6245C37.5395 24.6245 35.9619 23.0469 35.9619 21.1013ZM36.4099 21.1013C36.4099 22.7995 37.787 24.1765 39.4851 24.1765C41.1832 24.1765 42.5603 22.7995 42.5603 21.1013C42.5603 19.4032 41.1832 18.0261 39.4851 18.0261C37.787 18.0261 36.4099 19.4032 36.4099 21.1013Z" fill="url(#paint8_linear_6285_186732)"/>
|
||||
<path d="M37.3288 18.9094C38.5299 17.7083 40.4765 17.7083 41.6776 18.9094C42.0445 19.2763 42.2845 19.7158 42.4275 20.1787L46.8466 18.6822C46.3304 17.6443 45.6488 16.6683 44.7837 15.8032C40.4946 11.5142 33.541 11.5142 29.253 15.8032C26.5736 18.4816 25.5762 22.1979 26.2472 25.6571L36.6248 22.1435C36.2237 21.0523 36.453 19.784 37.3288 18.9094Z" fill="url(#paint9_linear_6285_186732)"/>
|
||||
<path d="M40.6454 24.7346C40.3777 24.485 40.6742 23.7309 41.3089 23.0503C41.9425 22.3698 42.6742 22.0199 42.9419 22.2695C43.2097 22.5191 42.9131 23.2733 42.2785 23.9538C41.6438 24.6343 40.9131 24.9831 40.6454 24.7346Z" fill="url(#paint10_radial_6285_186732)"/>
|
||||
<defs>
|
||||
<filter id="filter0_i_6285_186732" x="4.2666" y="0" width="27.7334" height="26.314" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||
<feOffset dy="-1"/>
|
||||
<feGaussianBlur stdDeviation="1.5"/>
|
||||
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
|
||||
<feColorMatrix type="matrix" values="0 0 0 0 0.665151 0 0 0 0 0.619268 0 0 0 0 0.591884 0 0 0 1 0"/>
|
||||
<feBlend mode="normal" in2="shape" result="effect1_innerShadow_6285_186732"/>
|
||||
</filter>
|
||||
<linearGradient id="paint0_linear_6285_186732" x1="0" y1="44.0485" x2="34.3264" y2="44.0485" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#EEAE53"/>
|
||||
<stop offset="0.143919" stop-color="#FEC675"/>
|
||||
<stop offset="0.862824" stop-color="#EBB567"/>
|
||||
<stop offset="1" stop-color="#DA8A2C"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint1_linear_6285_186732" x1="49.4072" y1="48.5995" x2="49.6138" y2="10.5456" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#C3CFCF"/>
|
||||
<stop offset="1" stop-color="#C8C8C8"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint2_linear_6285_186732" x1="30.8129" y1="48.0813" x2="30.8887" y2="32.6819" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#B8B4B4"/>
|
||||
<stop offset="1" stop-color="#B0BDBD"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint3_linear_6285_186732" x1="27.0191" y1="46.9225" x2="27.1123" y2="30.7783" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#B8B4B4"/>
|
||||
<stop offset="1" stop-color="#B0BDBD"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint4_linear_6285_186732" x1="32.7105" y1="55.1596" x2="33.1696" y2="28.1678" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#6A6A6A"/>
|
||||
<stop offset="1" stop-color="#D4D4D4"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint5_linear_6285_186732" x1="23.4989" y1="37.1977" x2="19.05" y2="34.3633" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#6A6A6A"/>
|
||||
<stop offset="1" stop-color="#E0E0E0"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint6_linear_6285_186732" x1="50.5224" y1="21.6683" x2="35.5627" y2="5.58614" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#7F7F7F"/>
|
||||
<stop offset="1" stop-color="#EEEEEE"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint7_linear_6285_186732" x1="-1.53607" y1="60.8839" x2="15.2429" y2="47.353" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#515151"/>
|
||||
<stop offset="1" stop-color="#838383"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint8_linear_6285_186732" x1="44.8931" y1="20.96" x2="39.3454" y2="15.3493" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#EEEEEE"/>
|
||||
<stop offset="1" stop-color="#6A6A6A"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint9_linear_6285_186732" x1="49.3078" y1="27.0197" x2="47.4617" y2="13.3093" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0.048" stop-color="white" stop-opacity="0.01"/>
|
||||
<stop offset="0.994" stop-color="white" stop-opacity="0.5"/>
|
||||
</linearGradient>
|
||||
<radialGradient id="paint10_radial_6285_186732" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(41.8058 23.453) rotate(132.967) scale(1.51573 1.5122)">
|
||||
<stop stop-color="white"/>
|
||||
<stop offset="0.999" stop-color="white" stop-opacity="0.01"/>
|
||||
</radialGradient>
|
||||
</defs>
|
||||
</svg>
|
After Width: | Height: | Size: 8.4 KiB |
|
@ -0,0 +1,96 @@
|
|||
#ifndef AGENTUTILS_H
|
||||
#define AGENTUTILS_H
|
||||
|
||||
#define VPN_TYPE "vpn"
|
||||
#define VPN_NAME "vpn"
|
||||
#define VPN_SERVICE "service-type"
|
||||
#define VPN_DATA "data"
|
||||
#define VPN_SECRET "secrets"
|
||||
#define VPN_FLAG "password-flags"
|
||||
|
||||
#define CONNECTION_KEY "connection"
|
||||
#define UUID_KEY "uuid"
|
||||
#define SSID_KEY "ssid"
|
||||
#define ID_KEY "id"
|
||||
#define TYPE_KEY "type"
|
||||
|
||||
|
||||
#define WIRELESS_SECURITY_NAME "802-11-wireless-security"
|
||||
#define KEY_MGMT "key-mgmt"
|
||||
|
||||
#define PSK_MGMT "wpa-psk"
|
||||
#define SAE_MGMT "sae"
|
||||
#define PSK_FLAG "psk-flags"
|
||||
#define PSK_KEY "psk"
|
||||
|
||||
#define WEP_MGMT "none"
|
||||
#define WEP128_MGMT "passphrase"
|
||||
#define WEP_FLAG_KEY "wep-key-flags"
|
||||
#define WEP_ID_KEY "wep-tx-keyidx"
|
||||
#define WEP_KEY0 "wep-key0"
|
||||
#define WEP_KEY1 "wep-key1"
|
||||
#define WEP_KEY2 "wep-key2"
|
||||
#define WEP_KEY3 "wep-key3"
|
||||
|
||||
#define LEAP_MGMT "ieee8021x"
|
||||
#define LEAP_PASSWORD_FLAG "leap-password-flags"
|
||||
#define LEAP_PASSWORD_KEY "leap-password"
|
||||
#define LEAP_USER_KEY "leap-username"
|
||||
|
||||
#define ENTERPRICE_NAME "802-1x"
|
||||
#define EAP_KEY "eap"
|
||||
#define PWD_EAP "pwd"
|
||||
#define LEAP_EAP "leap"
|
||||
#define FAST_EAP "fast"
|
||||
#define PEAP_EAP "peap"
|
||||
#define TTLS_EAP "ttls"
|
||||
#define TLS_EAP "tls"
|
||||
|
||||
#define IDENTITY_KEY "identity"
|
||||
|
||||
#define PASSWORD_FLAG "password-flags"
|
||||
#define PASSWORD_KEY "password"
|
||||
|
||||
#define PIN_FLAG "pin-flags"
|
||||
#define PIN_KEY "pin"
|
||||
|
||||
#define PHASE2_PRIVATE_KEY_FLAG "phase2-private-key-password-flags"
|
||||
#define PHASE2_PRIVATE_KEY "phase2-private-key-password"
|
||||
|
||||
#define PRIVATE_KEY_FLAG "private-key-password-flags"
|
||||
#define PRIVATE_KEY "private-key-password"
|
||||
#define DOMAIN_KEY "domain-suffix-match"
|
||||
|
||||
#define PHASE2_CLIENT_FLAG "phase2-client-cert-password-flags"
|
||||
#define PHASE2_CLIENT "phase2-client-cert-password"
|
||||
|
||||
#define PHASE2_CACERT_FLAG "phase2-ca-cert-password-flags"
|
||||
#define PHASE2_CACERT "phase2-ca-cert-password"
|
||||
|
||||
#define PHASE1_AUTH_FLAG "phase1-auth-flags"
|
||||
#define PHASE1_AUTH "phase1-auth"
|
||||
|
||||
#define CLIENT_CERT_FLAG "client-cert-password-flags"
|
||||
#define CLIENT_CERT "client-cert-password"
|
||||
|
||||
#define CACERT_FLAG "ca-cert-password-flags"
|
||||
#define CACERT "ca-cert-password"
|
||||
|
||||
|
||||
|
||||
enum SecretPolicyFlag{
|
||||
POLICY_NONE = 0,
|
||||
POLICY_AGENT_OWNED = 0x01,
|
||||
POLICY_NOT_SAVED = 0x02,
|
||||
POLICY_NOT_REQUIRED = 0x04
|
||||
};
|
||||
|
||||
enum SecretWepKeyId{
|
||||
KEY_TYPE0 = 0,
|
||||
KEY_TYPE1 = 1,
|
||||
KEY_TYPE2 = 2,
|
||||
KEY_TYPE3 = 3
|
||||
};
|
||||
|
||||
|
||||
#endif // AGENTUTILS_H
|
|
@ -0,0 +1,14 @@
|
|||
INCLUDEPATH += $$PWD
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/agentutils.h \
|
||||
$$PWD/kylinagent.h \
|
||||
$$PWD/kylinagentobject.h \
|
||||
$$PWD/kylinpassworddialog.h \
|
||||
$$PWD/kylinsecretagent.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/kylinagent.cpp \
|
||||
$$PWD/kylinagentobject.cpp \
|
||||
$$PWD/kylinpassworddialog.cpp \
|
||||
$$PWD/kylinsecretagent.cpp
|
|
@ -0,0 +1,23 @@
|
|||
#include "kylinagent.h"
|
||||
|
||||
KylinAgent::KylinAgent(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
KylinAgent::~KylinAgent()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void KylinAgent::startKylinAgent()
|
||||
{
|
||||
m_secretAgnet = new KylinSecretAgent("kylinagent", pWidget, this);
|
||||
}
|
||||
|
||||
//void KylinAgent::stopKylinAgent()
|
||||
//{
|
||||
// delete m_kylinAgnetObject;
|
||||
// m_kylinAgnetObject = nullptr;
|
||||
// return;
|
||||
//}
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef KYLINAGENT_H
|
||||
#define KYLINAGENT_H
|
||||
|
||||
#include "kylinsecretagent.h".h"
|
||||
|
||||
#if defined(LIBKYLIN_KEYRING_LIBRARY)
|
||||
# define LIBKYLIN_KEYRING_LIBRARY Q_DECL_EXPORT
|
||||
#else
|
||||
# define LIBKYLIN_KEYRING_LIBRARY Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
class LIBKYLIN_KEYRING_LIBRARY KylinAgent : public QObject
|
||||
{
|
||||
public:
|
||||
explicit KylinAgent(QObject *parent = nullptr);
|
||||
~KylinAgent();
|
||||
void startKylinAgent();
|
||||
void setParentWidget(QWidget *widget){
|
||||
pWidget = widget;
|
||||
}
|
||||
|
||||
private:
|
||||
KylinSecretAgent *m_secretAgnet;
|
||||
QWidget* pWidget = nullptr;
|
||||
};
|
||||
|
||||
|
||||
#endif // KYLINAGENT_H
|
|
@ -0,0 +1,21 @@
|
|||
#include "kylinagentobject.h"
|
||||
|
||||
KylinAgentObject::KylinAgentObject(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
KylinAgentObject::~KylinAgentObject()
|
||||
{
|
||||
if (nullptr != m_secretAgnet) {
|
||||
delete m_secretAgnet;
|
||||
m_secretAgnet = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void KylinAgentObject::onInitAgent()
|
||||
{
|
||||
m_secretAgnet = new KylinSecretAgent("kylinagent");
|
||||
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
#ifndef KYLINAGENTOBJECT_H
|
||||
#define KYLINAGENTOBJECT_H
|
||||
|
||||
#include "kylinsecretagent.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class KylinAgentObject : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit KylinAgentObject(QObject *parent = nullptr);
|
||||
~KylinAgentObject();
|
||||
|
||||
public Q_SLOTS:
|
||||
void onInitAgent();
|
||||
|
||||
private:
|
||||
KylinSecretAgent *m_secretAgnet;
|
||||
|
||||
};
|
||||
|
||||
#endif // KYLINAGENTOBJECT_H
|
|
@ -0,0 +1,502 @@
|
|||
#include "kylinpassworddialog.h"
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QMessageBox>
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QPainter>
|
||||
#include <QApplication>
|
||||
|
||||
#define CLOSE_TIME 30*1000
|
||||
|
||||
|
||||
static QPalette lightPalette(QWidget *widget)
|
||||
{
|
||||
auto palette = widget->palette();
|
||||
//ukui-light palette UKUI3.1
|
||||
QColor windowText_at(38, 38, 38),
|
||||
windowText_iat(38, 38, 38),
|
||||
windowText_dis(166, 166, 166),
|
||||
button_at(230, 230, 230),
|
||||
button_iat(230, 230, 230),
|
||||
button_dis(233, 233, 233),
|
||||
light_at(255, 255, 255),
|
||||
light_iat(255, 255, 255),
|
||||
light_dis(242, 242, 242),
|
||||
midlight_at(218, 218, 218),
|
||||
midlight_iat(218, 218, 218),
|
||||
midlight_dis(230, 230, 230),
|
||||
dark_at(77, 77, 77),
|
||||
dark_iat(77, 77, 77),
|
||||
dark_dis(64, 64, 64),
|
||||
mid_at(115, 115, 115),
|
||||
mid_iat(115, 115, 115),
|
||||
mid_dis(102, 102, 102),
|
||||
text_at(38, 38, 38),
|
||||
text_iat(38, 38, 38),
|
||||
text_dis(140, 140, 140),
|
||||
brightText_at(89, 89, 89),
|
||||
brightText_iat(89, 89, 89),
|
||||
brightText_dis(77, 77, 77),
|
||||
buttonText_at(38, 38, 38),
|
||||
buttonText_iat(38, 38, 38),
|
||||
buttonText_dis(179, 179, 179),
|
||||
base_at(255, 255, 255),
|
||||
base_iat(245, 245, 245),
|
||||
base_dis(237, 237, 237),
|
||||
window_at(245, 245, 245),
|
||||
window_iat(237, 237, 237),
|
||||
window_dis(230, 230, 230),
|
||||
shadow_at(0, 0, 0, 16),
|
||||
shadow_iat(0, 0, 0, 16),
|
||||
shadow_dis(0, 0, 0, 21),
|
||||
// shadow_at(214, 214, 214),
|
||||
// shadow_iat(214, 214, 214),
|
||||
// shadow_dis(201, 201, 201),
|
||||
highLight_at(55, 144, 250),
|
||||
highLight_iat(55, 144, 250),
|
||||
highLight_dis(233, 233, 233),
|
||||
highLightText_at(255, 255, 255),
|
||||
highLightText_iat(255, 255, 255),
|
||||
highLightText_dis(179, 179, 179),
|
||||
link_at(55, 144, 250),
|
||||
link_iat(55, 144, 250),
|
||||
link_dis(55, 144, 250),
|
||||
linkVisited_at(114, 46, 209),
|
||||
linkVisited_iat(114, 46, 209),
|
||||
linkVisited_dis(114, 46, 209),
|
||||
alternateBase_at(245, 245, 245),
|
||||
alternateBase_iat(245, 245, 245),
|
||||
alternateBase_dis(245, 245, 245),
|
||||
noRale_at(240, 240, 240),
|
||||
noRole_iat(240, 240, 240),
|
||||
noRole_dis(217, 217, 217),
|
||||
toolTipBase_at(255, 255, 255),
|
||||
toolTipBase_iat(255, 255, 255),
|
||||
toolTipBase_dis(255, 255, 255),
|
||||
toolTipText_at(38, 38, 38),
|
||||
toolTipText_iat(38, 38, 38),
|
||||
toolTipText_dis(38, 38, 38),
|
||||
placeholderText_at(38, 38, 38),
|
||||
placeholderText_iat(38, 38, 38),
|
||||
placeholderText_dis(38, 38, 38);
|
||||
|
||||
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::WindowText, windowText_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::WindowText, windowText_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::WindowText, windowText_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::Button, button_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::Button, button_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::Button, button_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::Light, light_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::Light, light_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::Light, light_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::Midlight, midlight_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::Midlight, midlight_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::Midlight, midlight_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::Dark, dark_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::Dark, dark_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::Dark, dark_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::Mid, mid_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::Mid, mid_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::Mid, mid_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::Text, text_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::Text, text_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::Text, text_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::BrightText, brightText_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::BrightText, brightText_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::BrightText, brightText_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::ButtonText, buttonText_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::ButtonText, buttonText_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::ButtonText, buttonText_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::Base, base_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::Base, base_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::Base, base_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::Window, window_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::Window, window_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::Window, window_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::Shadow, shadow_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::Shadow, shadow_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::Shadow, shadow_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::Highlight, highLight_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::Highlight, highLight_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::Highlight, highLight_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::HighlightedText, highLightText_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::HighlightedText, highLightText_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::HighlightedText, highLightText_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::Link, link_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::Link, link_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::Link, link_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::LinkVisited, linkVisited_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::LinkVisited, linkVisited_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::LinkVisited, linkVisited_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::AlternateBase, alternateBase_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::AlternateBase, alternateBase_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::AlternateBase, alternateBase_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::NoRole, noRale_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::NoRole, noRole_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::NoRole, noRole_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::ToolTipBase, toolTipBase_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::ToolTipBase, toolTipBase_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::ToolTipBase, toolTipBase_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::ToolTipText, toolTipText_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::ToolTipText, toolTipText_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::ToolTipText, toolTipText_dis);
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5,12,0))
|
||||
palette.setColor(QPalette::Active, QPalette::PlaceholderText, placeholderText_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::PlaceholderText, placeholderText_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::PlaceholderText, placeholderText_dis);
|
||||
#endif
|
||||
|
||||
return palette;
|
||||
|
||||
}
|
||||
|
||||
RowWidget::RowWidget(QWidget *widget, QWidget *parent) : valueWidget(widget), QWidget(parent)
|
||||
{
|
||||
mainLayout = new QHBoxLayout(this);
|
||||
mainLayout->setContentsMargins(0,0,0,0);
|
||||
this->setLayout(mainLayout);
|
||||
keyLabel = new QLabel(this);
|
||||
keyLabel->setMaximumWidth(87);
|
||||
valueWidget->setMinimumWidth(280);
|
||||
mainLayout->addWidget(keyLabel);
|
||||
mainLayout->addStretch();
|
||||
mainLayout->addWidget(valueWidget);
|
||||
}
|
||||
|
||||
RowWidget::~RowWidget()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RowWidget::setKey(QString text)
|
||||
{
|
||||
this->keyLabel->setText(text);
|
||||
}
|
||||
|
||||
KyPasswordDialog::KyPasswordDialog(QString dialogType, QString connectionID, QWidget *parent)
|
||||
:connectionID(connectionID),dialogType(dialogType),QDialog(parent)
|
||||
{
|
||||
|
||||
qDebug() << "KyPasswordDialog";
|
||||
this->setAttribute(Qt::WA_QuitOnClose, false);
|
||||
// this->setWindowFlags(Qt::Dialog);
|
||||
// this->setWindowIcon(QIcon::fromTheme("kylin-network"));
|
||||
// this->setWindowTitle(connectionID);
|
||||
|
||||
initUI(dialogType);
|
||||
m_sdkPasswdEdit->installEventFilter(this);
|
||||
|
||||
this->setWindowFlags(Qt::MSWindowsFixedSizeDialogHint);
|
||||
|
||||
connect(qApp, &QApplication::paletteChanged, this, &KyPasswordDialog::onPaletteChanged);
|
||||
onPaletteChanged();
|
||||
}
|
||||
|
||||
void KyPasswordDialog::showDesktopNotify(const QString &message)
|
||||
{
|
||||
QDBusInterface iface("org.freedesktop.Notifications",
|
||||
"/org/freedesktop/Notifications",
|
||||
"org.freedesktop.Notifications",
|
||||
QDBusConnection::sessionBus());
|
||||
QList<QVariant> args;
|
||||
args<<(tr("Kylin NM"))
|
||||
<<((unsigned int) 0)
|
||||
<<QString("gnome-dev-ethernet")
|
||||
<<tr("kylin network desktop message") //显示的是什么类型的信息
|
||||
<<message //显示的具体信息
|
||||
<<QStringList()
|
||||
<<QVariantMap()
|
||||
<<(int)-1;
|
||||
iface.callWithArgumentList(QDBus::AutoDetect,"Notify",args);
|
||||
}
|
||||
|
||||
KyPasswordDialog::~KyPasswordDialog(){
|
||||
|
||||
}
|
||||
|
||||
void KyPasswordDialog::InitConnect()
|
||||
{
|
||||
connect(m_connectBtn, &QPushButton::clicked, this, &KyPasswordDialog::login);
|
||||
connect(m_exitBtn, &QPushButton::clicked, this, &KyPasswordDialog::reject);
|
||||
connect(m_sdkPasswdEdit, &KPasswordEdit::textChanged, this, &KyPasswordDialog::onTextChanged);
|
||||
if (m_usrLineEdit != nullptr) {
|
||||
connect(m_usrLineEdit, &QLineEdit::textChanged, this, &KyPasswordDialog::onTextChanged);
|
||||
}
|
||||
QTimer::singleShot(CLOSE_TIME, this, [=](){
|
||||
reject();
|
||||
});
|
||||
}
|
||||
|
||||
void KyPasswordDialog::initUI(QString dialogType)
|
||||
{
|
||||
#define MAIN_LAYOUT_MARGINS 24,24,24,24
|
||||
#define DEFAULT_LAYOUT_MARGINS 0,0,0,0
|
||||
|
||||
#define DEFAULT_LAYOUT_SPACE 24
|
||||
#define LESS_LAYOUT_SPACE 16
|
||||
|
||||
#define DEFAULT_BTN_FIXSIZE 112,56
|
||||
#define DEFAULT_FIXHEIGHT 48
|
||||
#define DEFAULT_PICTURE_FIXSIZE 48,48
|
||||
|
||||
#define DEFAULT_EDIT_SIZE 278,48
|
||||
#define WPA2_EDIT_SIZE 270,48
|
||||
|
||||
#define DEFAULT_PAGE_SIZE 446,283
|
||||
#define WPA2_PAGE_SIZE 446,339
|
||||
|
||||
//设置字体大小
|
||||
QFont fontTitle;
|
||||
fontTitle.setPointSizeF(13.5);
|
||||
fontTitle.setWeight(QFont::Bold);
|
||||
QFont fontNormal;
|
||||
fontNormal.setPointSizeF(11.5);
|
||||
fontNormal.setWeight(QFont::Normal);
|
||||
|
||||
//主布局
|
||||
QVBoxLayout *mainVBoxLayout = new QVBoxLayout(this);
|
||||
mainVBoxLayout->setContentsMargins(MAIN_LAYOUT_MARGINS);
|
||||
mainVBoxLayout->setSpacing(DEFAULT_LAYOUT_SPACE);
|
||||
this->setLayout(mainVBoxLayout);
|
||||
|
||||
//不包含按钮的横向布局
|
||||
QHBoxLayout *hBoxLayout = new QHBoxLayout(this);
|
||||
hBoxLayout->setContentsMargins(DEFAULT_LAYOUT_MARGINS);
|
||||
hBoxLayout->setSpacing(DEFAULT_LAYOUT_SPACE);
|
||||
|
||||
//图标
|
||||
QLabel *picture = new QLabel(this);
|
||||
picture->setContentsMargins(DEFAULT_LAYOUT_MARGINS);
|
||||
picture->setFixedSize(DEFAULT_PICTURE_FIXSIZE);
|
||||
picture->setPixmap(QPixmap(":/authorize.svg"));
|
||||
|
||||
//标题
|
||||
QLabel *titleLabel = new QLabel(this);
|
||||
titleLabel->setText(tr("Wi-Fi authentication required"));
|
||||
titleLabel->setFont(fontTitle);
|
||||
|
||||
//提示信息
|
||||
QLabel *tipLabel = new QLabel(this);
|
||||
tipLabel->setFixedSize(328, DEFAULT_FIXHEIGHT);
|
||||
tipLabel->setAlignment(Qt::AlignTop);
|
||||
tipLabel->setWordWrap(true);
|
||||
QString text = tr("Access wireless networks");
|
||||
text += " " + connectionID + " ";
|
||||
text += tr("needs password or encryption key");
|
||||
tipLabel->setText(text);
|
||||
tipLabel->setFont(fontNormal);
|
||||
|
||||
//密码输入框
|
||||
QLabel *pwdLabel = new QLabel(this);
|
||||
pwdLabel->setText(tr("password"));
|
||||
pwdLabel->setFont(fontNormal);
|
||||
m_sdkPasswdEdit = new KPasswordEdit(this);
|
||||
if (dialogType != "") {
|
||||
this->setFixedSize(WPA2_PAGE_SIZE);
|
||||
m_sdkPasswdEdit->setFixedSize(WPA2_EDIT_SIZE);
|
||||
} else {
|
||||
this->setFixedSize(DEFAULT_PAGE_SIZE);
|
||||
m_sdkPasswdEdit->setFixedSize(DEFAULT_EDIT_SIZE);
|
||||
}
|
||||
m_sdkPasswdEdit->setClearButtonEnabled(false);
|
||||
m_sdkPasswdEdit->setEchoModeBtnVisible(true);
|
||||
m_sdkPasswdEdit->setState(LoginFailed);
|
||||
m_sdkPasswdEdit->setAttribute(Qt::WA_InputMethodEnabled, true);
|
||||
QRegExp rx("^[A-Za-z0-9`~!@#$%^&*()_-+=<>,.\\\/]+$");
|
||||
QRegExpValidator *latitude = new QRegExpValidator(rx, this);
|
||||
m_sdkPasswdEdit->setValidator(latitude);
|
||||
|
||||
//密码输入框布局
|
||||
QHBoxLayout *pwdLayout = new QHBoxLayout(this);
|
||||
pwdLayout->setContentsMargins(DEFAULT_LAYOUT_MARGINS);
|
||||
if (dialogType != "") {
|
||||
pwdLayout->setSpacing(DEFAULT_LAYOUT_SPACE);
|
||||
} else {
|
||||
pwdLayout->setSpacing(LESS_LAYOUT_SPACE);
|
||||
}
|
||||
pwdLayout->addWidget(pwdLabel);
|
||||
pwdLayout->addWidget(m_sdkPasswdEdit);
|
||||
|
||||
//不包含图标的纵向布局
|
||||
QVBoxLayout *contentLayout = new QVBoxLayout(this);
|
||||
contentLayout->setContentsMargins(DEFAULT_LAYOUT_MARGINS);
|
||||
contentLayout->setSpacing(LESS_LAYOUT_SPACE);
|
||||
contentLayout->setAlignment(Qt::AlignTop);
|
||||
contentLayout->addWidget(titleLabel);
|
||||
contentLayout->addWidget(tipLabel);
|
||||
if (dialogType != "") {
|
||||
//WPA2企业加密方式用户名输入框
|
||||
QLabel *userNameLabel = new QLabel(this);
|
||||
userNameLabel->setText(tr("user name"));
|
||||
userNameLabel->setFont(fontNormal);
|
||||
m_usrLineEdit = new QLineEdit(this);
|
||||
m_usrLineEdit->setFixedSize(WPA2_EDIT_SIZE);
|
||||
|
||||
//用户名输入框布局
|
||||
QHBoxLayout *userNameLayout = new QHBoxLayout(this);
|
||||
userNameLayout->setContentsMargins(DEFAULT_LAYOUT_MARGINS);
|
||||
userNameLayout->setSpacing(8);
|
||||
userNameLayout->addWidget(userNameLabel);
|
||||
userNameLayout->addWidget(m_usrLineEdit);
|
||||
contentLayout->addLayout(userNameLayout);
|
||||
}
|
||||
contentLayout->addLayout(pwdLayout);
|
||||
|
||||
//连接按钮
|
||||
m_connectBtn = new QPushButton(this);
|
||||
m_connectBtn->setText(tr("Connect"));
|
||||
m_connectBtn->setFont(fontNormal);
|
||||
m_connectBtn->setFixedSize(DEFAULT_BTN_FIXSIZE);
|
||||
|
||||
//取消按钮
|
||||
m_exitBtn = new QPushButton(this);
|
||||
m_exitBtn->setText(tr("Cancel"));
|
||||
m_exitBtn->setFont(fontNormal);
|
||||
m_exitBtn->setFixedSize(DEFAULT_BTN_FIXSIZE);
|
||||
|
||||
//按钮布局
|
||||
QHBoxLayout *btnLayout = new QHBoxLayout(this);
|
||||
btnLayout->setContentsMargins(DEFAULT_LAYOUT_MARGINS);
|
||||
btnLayout->setSpacing(LESS_LAYOUT_SPACE);
|
||||
btnLayout->addStretch();
|
||||
btnLayout->addWidget(m_exitBtn);
|
||||
btnLayout->addWidget(m_connectBtn);
|
||||
|
||||
hBoxLayout->addWidget(picture);
|
||||
hBoxLayout->setAlignment(picture, Qt::AlignTop);
|
||||
hBoxLayout->addLayout(contentLayout);
|
||||
|
||||
mainVBoxLayout->addLayout(hBoxLayout);
|
||||
mainVBoxLayout->addLayout(btnLayout);
|
||||
|
||||
if (m_usrLineEdit == nullptr) {
|
||||
showDesktopNotify(tr("password error!"));
|
||||
} else {
|
||||
showDesktopNotify(tr("username or password error!"));
|
||||
}
|
||||
}
|
||||
|
||||
QString KyPasswordDialog::getPassword()
|
||||
{
|
||||
return m_sdkPasswdEdit->text();
|
||||
}
|
||||
|
||||
void KyPasswordDialog::setPassword(QString password)
|
||||
{
|
||||
m_sdkPasswdEdit->setText(password);
|
||||
m_sdkPasswdEdit->setFocus();
|
||||
}
|
||||
|
||||
QString KyPasswordDialog::getUserName()
|
||||
{
|
||||
return m_usrLineEdit->text();
|
||||
}
|
||||
|
||||
void KyPasswordDialog::setUserName(QString name)
|
||||
{
|
||||
m_usrLineEdit->setText(name);
|
||||
}
|
||||
|
||||
void KyPasswordDialog::login()
|
||||
{
|
||||
qDebug() << "KyPasswordDialog login";
|
||||
if ((!m_sdkPasswdEdit->text().isEmpty()) && (m_usrLineEdit == nullptr? true : (!m_usrLineEdit->text().isEmpty()))) {
|
||||
accept();
|
||||
} else {
|
||||
m_sdkPasswdEdit->clear();
|
||||
if (m_usrLineEdit != nullptr) {
|
||||
m_usrLineEdit->clear();
|
||||
m_usrLineEdit->setFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void KyPasswordDialog::onTextChanged(const QString & text)
|
||||
{
|
||||
qDebug() << "KyPasswordDialog onTextChanged";
|
||||
m_sdkPasswdEdit->setState(Ordinary);
|
||||
if (text == "") {
|
||||
//任何输入框为空,则不许按下连接按钮
|
||||
m_connectBtn->setEnabled(false);
|
||||
return ;
|
||||
}
|
||||
|
||||
if (m_usrLineEdit != nullptr) {
|
||||
//企业网修改密码页面
|
||||
if (!m_usrLineEdit->text().isEmpty() && !m_sdkPasswdEdit->text().isEmpty()) {
|
||||
//用户名和密码均不为空,允许按下连接按钮
|
||||
m_connectBtn->setEnabled(true);
|
||||
} else {
|
||||
m_connectBtn->setEnabled(false);
|
||||
}
|
||||
return ;
|
||||
}
|
||||
|
||||
if (m_sdkPasswdEdit->text().isEmpty() || m_sdkPasswdEdit->text().length() < 8) {
|
||||
//普通热点密码修改页面,若密码为空,或长度小于8位,不许按下连接按钮
|
||||
m_connectBtn->setEnabled(false);
|
||||
return ;
|
||||
}
|
||||
|
||||
m_connectBtn->setEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
void KyPasswordDialog::onPaletteChanged()
|
||||
{
|
||||
QPalette pal = lightPalette(this);
|
||||
|
||||
this->setPalette(pal);
|
||||
m_sdkPasswdEdit->setPalette(pal);
|
||||
if (nullptr != m_usrLineEdit)
|
||||
m_usrLineEdit->setPalette(pal);
|
||||
|
||||
// setFramePalette(this, pal);
|
||||
}
|
||||
|
||||
void KyPasswordDialog::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QPalette pal = this->palette();
|
||||
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter:: Antialiasing, true); //设置渲染,启动反锯齿
|
||||
painter.setPen(Qt::NoPen);
|
||||
painter.setBrush(pal.color(QPalette::Base));
|
||||
|
||||
QRect rect = this->rect();
|
||||
painter.drawRoundedRect(rect, 12, 12);
|
||||
|
||||
|
||||
QDialog::paintEvent(event);
|
||||
}
|
||||
bool KyPasswordDialog::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if (watched == m_sdkPasswdEdit) {
|
||||
qDebug() << "!!!!!" << event->type() << watched;
|
||||
}
|
||||
return QWidget::eventFilter(watched, event);
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
#ifndef KYLINPASSWORDDIALOG_H
|
||||
#define KYLINPASSWORDDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QVBoxLayout>
|
||||
#include <QFormLayout>
|
||||
#include <QCheckBox>
|
||||
#include <QRegExpValidator>
|
||||
#include <QTimer>
|
||||
#include <QDBusInterface>
|
||||
|
||||
#include "kpasswordedit.h"
|
||||
|
||||
using namespace kdk;
|
||||
|
||||
class RowWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RowWidget(QWidget *widget, QWidget *parent = nullptr);
|
||||
~RowWidget();
|
||||
void setKey(QString text);
|
||||
|
||||
private:
|
||||
QHBoxLayout *mainLayout;
|
||||
QLabel *keyLabel;
|
||||
QWidget *valueWidget;
|
||||
};
|
||||
|
||||
class KyPasswordDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
KyPasswordDialog(QString dialogType, QString connectionID = "", QWidget *parent = 0);
|
||||
~KyPasswordDialog();
|
||||
|
||||
void showDesktopNotify(const QString &message);
|
||||
|
||||
void InitConnect();
|
||||
private:
|
||||
QString dialogType;
|
||||
QString connectionID;
|
||||
|
||||
QLineEdit *m_usrLineEdit = nullptr;
|
||||
QPushButton *m_connectBtn = nullptr;
|
||||
QPushButton *m_exitBtn = nullptr;
|
||||
|
||||
KPasswordEdit *m_sdkPasswdEdit = nullptr;
|
||||
|
||||
void onPaletteChanged();
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
|
||||
public:
|
||||
void initUI(QString dialogType);
|
||||
|
||||
QString getPassword();
|
||||
void setPassword(QString password);
|
||||
|
||||
QString getUserName();
|
||||
void setUserName(QString name);
|
||||
|
||||
private Q_SLOTS:
|
||||
void login();
|
||||
void onTextChanged(const QString &);
|
||||
|
||||
Q_SIGNALS:
|
||||
void signal_username(QString);
|
||||
};
|
||||
|
||||
#endif // KYLINPASSWORDDIALOG_H
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,112 @@
|
|||
#ifndef KYLINSECRETAGENT_H
|
||||
#define KYLINSECRETAGENT_H
|
||||
|
||||
#include <libsecret/secret.h>
|
||||
|
||||
#include <QObject>
|
||||
//#include <NetworkManagerQt/SecretAgent>
|
||||
#include "networkmanagerqt/secretagent.h"
|
||||
|
||||
#include "agentutils.h"
|
||||
|
||||
class KylinSecretAgent: public NetworkManager::SecretAgent
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit KylinSecretAgent(const QString &id, QWidget *pWidget = nullptr, QObject *parent = nullptr);
|
||||
~KylinSecretAgent();
|
||||
|
||||
private:
|
||||
QWidget *parentWidget = nullptr;
|
||||
void saveOneSecret(QString &connectUuid, QString settingName,
|
||||
QString secretKey, QString &secretValue, QString &displayNmae);
|
||||
void saveConnectSecret(QVariantMap &securityMap, QString secretSettingName,
|
||||
QString &secretKey, QString &connectId, QString &connectUuid);
|
||||
|
||||
void saveWepSecret(QVariantMap &wirelessSecurityMap,
|
||||
QString &connectId, QString &connectUuid);
|
||||
void saveWirelessSecret(QVariantMap &wirelessSecurityMap,
|
||||
QString &connectId, QString &connectUuid);
|
||||
|
||||
void saveEnterpriceSecret(QVariantMap &enterpriceSecurityMap,
|
||||
QString &connectId, QString &connectUuidd);
|
||||
|
||||
void saveSecretForWireless(const NMVariantMapMap &connection,
|
||||
QString &connectId, QString &connectUuid);
|
||||
|
||||
QStringList getVpnPassword(QVariantMap &vpnSettingMap);
|
||||
QString getVpnDataItemByKey(QVariantMap &vpnSettingMap, QString key);
|
||||
void saveSecretForVpn(QVariantMap &vpnSetingMap,
|
||||
QString &connectId, QString &connectUuid);
|
||||
|
||||
void getSecretFromKeyring(GList *p_secretList, const QString &settingName,
|
||||
QString connectType, NMVariantMapMap &secretMap);
|
||||
bool hintIsFind(GList *p_secretList, const QStringList &hints);
|
||||
bool connectionIsAlwaysAsk(const NMVariantMapMap &connection);
|
||||
QString getWepKeyFromId(uint wepId);
|
||||
|
||||
|
||||
void askSecretForLeap(QVariantMap &wirelessSecurityMap,
|
||||
const QString &settingName, NMVariantMapMap &secretMap, QString connectionID);
|
||||
void askSecretForWep(QVariantMap &wirelessSecurityMap,
|
||||
const QString &settingName, NMVariantMapMap &secretMap, QString connectionID);
|
||||
void askSecretForPassword(QVariantMap &securityMap, QString passwordKey,
|
||||
const QString &settingName, NMVariantMapMap &secretMap, QString connectionID);
|
||||
void askSecretForWireless(const NMVariantMapMap &connection,
|
||||
const QString settingName, NMVariantMapMap &secretMap);
|
||||
|
||||
void askSecretForTls(QVariantMap securityMap,
|
||||
const QString &settingName, NMVariantMapMap &secretMap, QString connectionID);
|
||||
void askSecretWithIdentityAndPassword(QVariantMap securityMap, QString userKey,
|
||||
QString passwordKey, const QString &settingName, NMVariantMapMap &secretMap, QString connectionID);
|
||||
void askSecretForEnterpriceWireless(const NMVariantMapMap &connection,
|
||||
const QString settingName, NMVariantMapMap &secretMap);
|
||||
void askSecretForVpn(const NMVariantMapMap &connection,
|
||||
const QString settingName, NMVariantMapMap &secretMap);
|
||||
void askForSecret(const NMVariantMapMap &connection, const QString &settingName,
|
||||
QString connectType, NMVariantMapMap &secretMap);
|
||||
|
||||
public Q_SLOTS:
|
||||
|
||||
/*
|
||||
* kylin-nm的agent功能主要是实现如下四个函数,这四个函数继承自父类NetworkManager::SecretAgent
|
||||
* 当发生错误的时候,调用父类的sendError函数,给networkmanager返回结果
|
||||
* 调试方式
|
||||
* 根据kylin-nm移植的nm-applet的agent功能代码添加日志,进行流程调试梳理,完成了该代码的开发,
|
||||
* 后续出了问题可以通过这种方式理顺流程调试解决问题。
|
||||
* 注意事项:
|
||||
* 1)所有的函数keyring、的操作都是同步的,需要其单独的agent线程,否则容易阻塞
|
||||
* 2)目前代码只是对能够测试到的情况做了代码实现,有可能会有遗漏的地方,后续出现新情况,在完善。
|
||||
*/
|
||||
|
||||
/*
|
||||
* 该函数从秘钥环上面获取密码,并将获取到的密码组成安全的mapmap返回,失败后通过sendError返回错误,
|
||||
* 函数的返回值将变得无效
|
||||
*/
|
||||
NMVariantMapMap GetSecrets(const NMVariantMapMap &connection, const QDBusObjectPath &connection_path,
|
||||
const QString &setting_name, const QStringList &hints, uint flags);
|
||||
|
||||
/*
|
||||
* 该函数用于取消agent的操作,从测试的情况来看,目前没有发现在什么时候会出现这种情况
|
||||
* 暂时未实现,后期注意观察,出现问题后根据具体情况实现,
|
||||
* 返回值为空,如果出现错误,通过sendError返回错误
|
||||
*/
|
||||
void CancelGetSecrets(const QDBusObjectPath &connection_path, const QString &setting_name);
|
||||
|
||||
/*
|
||||
* 该函数将密码保存到keyring上面,要保存的密码可以在connection参数中查找到,
|
||||
* 返回值为空,如果出现错误,通过sendError返回错误
|
||||
*/
|
||||
void SaveSecrets(const NMVariantMapMap &connection, const QDBusObjectPath &connection_path);
|
||||
/*
|
||||
* 该函数将密码从keyring上面删除,返回值为空,如果出现错误,通过sendError返回错误
|
||||
*/
|
||||
void DeleteSecrets(const NMVariantMapMap &connection, const QDBusObjectPath &connection_path);
|
||||
|
||||
private:
|
||||
QMap<QString, QString> enterpriceInfo;
|
||||
QMap<QString, QString> wirelessInfo;
|
||||
};
|
||||
|
||||
#endif // KYLINSECRETAGENT_H
|
Binary file not shown.
|
@ -0,0 +1,73 @@
|
|||
QT += core gui x11extras dbus KWindowSystem svg concurrent network
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = kylin-keyring
|
||||
TEMPLATE = lib
|
||||
DEFINES += LIBKYLIN_KEYRING_LIBRARY
|
||||
|
||||
CONFIG += c++14 qt warn_on link_pkgconfig console
|
||||
CONFIG += no_keywords
|
||||
|
||||
PKGCONFIG +=gio-2.0 glib-2.0 gio-unix-2.0 libnm libnma libsecret-1 gtk+-3.0 gsettings-qt libcap kysdk-qtwidgets
|
||||
|
||||
INCLUDEPATH += /usr/include/KF5/NetworkManagerQt
|
||||
|
||||
LIBS += -L/usr/lib/ -lKF5NetworkManagerQt
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any Qt feature that has been marked deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
# You can also make your code fail to compile if it uses deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
# QMAKE_CXXFLAGS += -Wno-unused-parameter
|
||||
QMAKE_CPPFLAGS *= $(shell dpkg-buildflags --get CPPFLAGS)
|
||||
QMAKE_CFLAGS *= $(shell dpkg-buildflags --get CFLAGS)
|
||||
QMAKE_CXXFLAGS *= $(shell dpkg-buildflags --get CXXFLAGS)
|
||||
QMAKE_LFLAGS *= $(shell dpkg-buildflags --get LDFLAGS)
|
||||
|
||||
#include(kylin-agent/kylin-agent.pri)
|
||||
INCLUDEPATH += $$PWD
|
||||
INCLUDEPATH += ./kylin-agent
|
||||
|
||||
HEADERS += \
|
||||
./kylin-agent/agentutils.h \
|
||||
./kylin-agent/kylinagent.h \
|
||||
# ./kylin-agent/kylinagentobject.h \
|
||||
./kylin-agent/kylinpassworddialog.h \
|
||||
./kylin-agent/kylinsecretagent.h
|
||||
|
||||
SOURCES += \
|
||||
./kylin-agent/kylinagent.cpp \
|
||||
# ./kylin-agent/kylinagentobject.cpp \
|
||||
./kylin-agent/kylinpassworddialog.cpp \
|
||||
./kylin-agent/kylinsecretagent.cpp \
|
||||
|
||||
TRANSLATIONS += \
|
||||
./translations/kylin-keyring_zh_CN.ts \
|
||||
./translations/kylin-keyring_tr.ts \
|
||||
./translations/kylin-keyring_bo.ts
|
||||
|
||||
unix {
|
||||
target.path = /usr/lib/
|
||||
|
||||
manager.path = /usr/include/kylin-nm/kylin-agent
|
||||
manager.files = kylin-agent/agentutils.h \
|
||||
kylin-agent/kylinagent.h \
|
||||
kylin-agent/kylinagentobject.h \
|
||||
kylin-agent/kylinpassworddialog.h \
|
||||
kylin-agent/kylinsecretagent.h
|
||||
|
||||
INSTALLS += manager
|
||||
}
|
||||
!isEmpty(target.path): INSTALLS += target
|
||||
|
||||
|
||||
RESOURCES += \
|
||||
svg.qrc
|
|
@ -0,0 +1,29 @@
|
|||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QWidget>
|
||||
#include "kylinagent.h"
|
||||
#include <QTranslator>
|
||||
|
||||
bool isAppRuning();
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
QApplication a(argc, argv);
|
||||
|
||||
KylinAgent* agent = new KylinAgent();
|
||||
agent->startKylinAgent();
|
||||
|
||||
QTranslator trans_global;
|
||||
qDebug() << "QLocale " << QLocale();
|
||||
if (trans_global.load(QLocale(), "kylin-keyring", "_", "/usr/share/kylin-keyring/"))
|
||||
{
|
||||
a.installTranslator(&trans_global);
|
||||
qDebug()<<"Translations load success";
|
||||
} else {
|
||||
qWarning() << "Translations load fail";
|
||||
}
|
||||
|
||||
return a.exec();
|
||||
}
|
|
@ -0,0 +1,617 @@
|
|||
/****************************************************************************
|
||||
** Resource object code
|
||||
**
|
||||
** Created by: The Resource Compiler for Qt version 5.12.8
|
||||
**
|
||||
** WARNING! All changes made in this file will be lost!
|
||||
*****************************************************************************/
|
||||
|
||||
static const unsigned char qt_resource_data[] = {
|
||||
// /home/crush/project/3.2/kylin-nm-dev/kylin-keyring/authorize.svg
|
||||
0x0,0x0,0x21,0x86,
|
||||
0x3c,
|
||||
0x73,0x76,0x67,0x20,0x77,0x69,0x64,0x74,0x68,0x3d,0x22,0x34,0x38,0x22,0x20,0x68,
|
||||
0x65,0x69,0x67,0x68,0x74,0x3d,0x22,0x34,0x38,0x22,0x20,0x76,0x69,0x65,0x77,0x42,
|
||||
0x6f,0x78,0x3d,0x22,0x30,0x20,0x30,0x20,0x34,0x38,0x20,0x34,0x38,0x22,0x20,0x66,
|
||||
0x69,0x6c,0x6c,0x3d,0x22,0x6e,0x6f,0x6e,0x65,0x22,0x20,0x78,0x6d,0x6c,0x6e,0x73,
|
||||
0x3d,0x22,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x77,0x77,0x77,0x2e,0x77,0x33,0x2e,
|
||||
0x6f,0x72,0x67,0x2f,0x32,0x30,0x30,0x30,0x2f,0x73,0x76,0x67,0x22,0x3e,0xa,0x3c,
|
||||
0x67,0x20,0x66,0x69,0x6c,0x74,0x65,0x72,0x3d,0x22,0x75,0x72,0x6c,0x28,0x23,0x66,
|
||||
0x69,0x6c,0x74,0x65,0x72,0x30,0x5f,0x69,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,
|
||||
0x36,0x37,0x33,0x32,0x29,0x22,0x3e,0xa,0x3c,0x70,0x61,0x74,0x68,0x20,0x64,0x3d,
|
||||
0x22,0x4d,0x39,0x2e,0x35,0x39,0x39,0x39,0x34,0x20,0x31,0x34,0x2e,0x39,0x34,0x38,
|
||||
0x38,0x43,0x39,0x2e,0x35,0x39,0x39,0x39,0x34,0x20,0x31,0x30,0x2e,0x31,0x30,0x36,
|
||||
0x31,0x20,0x31,0x33,0x2e,0x33,0x31,0x39,0x34,0x20,0x36,0x2e,0x31,0x36,0x35,0x38,
|
||||
0x37,0x20,0x31,0x38,0x2e,0x31,0x33,0x33,0x33,0x20,0x36,0x2e,0x31,0x36,0x35,0x38,
|
||||
0x37,0x43,0x32,0x32,0x2e,0x39,0x34,0x37,0x31,0x20,0x36,0x2e,0x31,0x36,0x35,0x38,
|
||||
0x37,0x20,0x32,0x36,0x2e,0x38,0x36,0x33,0x39,0x20,0x31,0x30,0x2e,0x31,0x30,0x36,
|
||||
0x31,0x20,0x32,0x36,0x2e,0x38,0x36,0x33,0x39,0x20,0x31,0x34,0x2e,0x39,0x34,0x38,
|
||||
0x38,0x56,0x32,0x36,0x2e,0x33,0x31,0x34,0x31,0x48,0x33,0x31,0x2e,0x39,0x39,0x39,
|
||||
0x39,0x56,0x31,0x34,0x2e,0x39,0x34,0x38,0x38,0x43,0x33,0x31,0x2e,0x39,0x39,0x39,
|
||||
0x39,0x20,0x37,0x2e,0x32,0x35,0x37,0x30,0x37,0x20,0x32,0x35,0x2e,0x37,0x37,0x39,
|
||||
0x31,0x20,0x31,0x20,0x31,0x38,0x2e,0x31,0x33,0x33,0x33,0x20,0x31,0x43,0x31,0x30,
|
||||
0x2e,0x34,0x38,0x37,0x34,0x20,0x31,0x20,0x34,0x2e,0x32,0x36,0x36,0x36,0x20,0x37,
|
||||
0x2e,0x32,0x35,0x37,0x30,0x37,0x20,0x34,0x2e,0x32,0x36,0x36,0x36,0x20,0x31,0x34,
|
||||
0x2e,0x39,0x34,0x38,0x38,0x56,0x32,0x32,0x2e,0x31,0x38,0x31,0x39,0x48,0x39,0x2e,
|
||||
0x35,0x39,0x39,0x39,0x34,0x56,0x31,0x34,0x2e,0x39,0x34,0x38,0x38,0x5a,0x22,0x20,
|
||||
0x66,0x69,0x6c,0x6c,0x3d,0x22,0x23,0x45,0x41,0x45,0x41,0x45,0x41,0x22,0x2f,0x3e,
|
||||
0xa,0x3c,0x2f,0x67,0x3e,0xa,0x3c,0x70,0x61,0x74,0x68,0x20,0x64,0x3d,0x22,0x4d,
|
||||
0x30,0x20,0x31,0x39,0x2e,0x31,0x33,0x33,0x33,0x48,0x33,0x36,0x2e,0x32,0x36,0x36,
|
||||
0x37,0x56,0x34,0x30,0x2e,0x37,0x33,0x33,0x33,0x43,0x33,0x36,0x2e,0x32,0x36,0x36,
|
||||
0x37,0x20,0x34,0x32,0x2e,0x39,0x34,0x32,0x34,0x20,0x33,0x34,0x2e,0x34,0x37,0x35,
|
||||
0x38,0x20,0x34,0x34,0x2e,0x37,0x33,0x33,0x33,0x20,0x33,0x32,0x2e,0x32,0x36,0x36,
|
||||
0x37,0x20,0x34,0x34,0x2e,0x37,0x33,0x33,0x33,0x48,0x34,0x43,0x31,0x2e,0x37,0x39,
|
||||
0x30,0x38,0x36,0x20,0x34,0x34,0x2e,0x37,0x33,0x33,0x33,0x20,0x30,0x20,0x34,0x32,
|
||||
0x2e,0x39,0x34,0x32,0x34,0x20,0x30,0x20,0x34,0x30,0x2e,0x37,0x33,0x33,0x33,0x56,
|
||||
0x31,0x39,0x2e,0x31,0x33,0x33,0x33,0x5a,0x22,0x20,0x66,0x69,0x6c,0x6c,0x3d,0x22,
|
||||
0x75,0x72,0x6c,0x28,0x23,0x70,0x61,0x69,0x6e,0x74,0x30,0x5f,0x6c,0x69,0x6e,0x65,
|
||||
0x61,0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,0x36,0x37,0x33,0x32,0x29,0x22,
|
||||
0x2f,0x3e,0xa,0x3c,0x70,0x61,0x74,0x68,0x20,0x64,0x3d,0x22,0x4d,0x33,0x36,0x2e,
|
||||
0x32,0x36,0x36,0x37,0x20,0x31,0x39,0x2e,0x31,0x33,0x33,0x33,0x48,0x30,0x56,0x31,
|
||||
0x39,0x2e,0x32,0x39,0x39,0x37,0x43,0x34,0x2e,0x36,0x33,0x35,0x37,0x33,0x20,0x32,
|
||||
0x30,0x2e,0x34,0x37,0x32,0x20,0x31,0x31,0x2e,0x30,0x34,0x37,0x35,0x20,0x32,0x31,
|
||||
0x2e,0x31,0x39,0x38,0x34,0x20,0x31,0x38,0x2e,0x31,0x33,0x33,0x33,0x20,0x32,0x31,
|
||||
0x2e,0x31,0x39,0x38,0x34,0x43,0x32,0x35,0x2e,0x32,0x31,0x39,0x32,0x20,0x32,0x31,
|
||||
0x2e,0x31,0x39,0x38,0x34,0x20,0x33,0x31,0x2e,0x36,0x33,0x30,0x39,0x20,0x32,0x30,
|
||||
0x2e,0x34,0x37,0x32,0x20,0x33,0x36,0x2e,0x32,0x36,0x36,0x37,0x20,0x31,0x39,0x2e,
|
||||
0x32,0x39,0x39,0x37,0x56,0x31,0x39,0x2e,0x31,0x33,0x33,0x33,0x5a,0x22,0x20,0x66,
|
||||
0x69,0x6c,0x6c,0x3d,0x22,0x23,0x46,0x43,0x45,0x46,0x44,0x32,0x22,0x2f,0x3e,0xa,
|
||||
0x3c,0x70,0x61,0x74,0x68,0x20,0x64,0x3d,0x22,0x4d,0x33,0x36,0x2e,0x32,0x36,0x36,
|
||||
0x37,0x20,0x31,0x39,0x2e,0x31,0x33,0x33,0x33,0x48,0x30,0x56,0x31,0x39,0x2e,0x32,
|
||||
0x35,0x30,0x36,0x43,0x34,0x2e,0x36,0x33,0x35,0x37,0x33,0x20,0x32,0x30,0x2e,0x30,
|
||||
0x37,0x35,0x32,0x20,0x31,0x31,0x2e,0x30,0x34,0x37,0x35,0x20,0x32,0x30,0x2e,0x35,
|
||||
0x38,0x36,0x31,0x20,0x31,0x38,0x2e,0x31,0x33,0x33,0x33,0x20,0x32,0x30,0x2e,0x35,
|
||||
0x38,0x36,0x31,0x43,0x32,0x35,0x2e,0x32,0x31,0x39,0x32,0x20,0x32,0x30,0x2e,0x35,
|
||||
0x38,0x36,0x31,0x20,0x33,0x31,0x2e,0x36,0x33,0x30,0x39,0x20,0x32,0x30,0x2e,0x30,
|
||||
0x37,0x35,0x32,0x20,0x33,0x36,0x2e,0x32,0x36,0x36,0x37,0x20,0x31,0x39,0x2e,0x32,
|
||||
0x35,0x30,0x36,0x56,0x31,0x39,0x2e,0x31,0x33,0x33,0x33,0x5a,0x22,0x20,0x66,0x69,
|
||||
0x6c,0x6c,0x3d,0x22,0x23,0x46,0x46,0x44,0x31,0x38,0x46,0x22,0x2f,0x3e,0xa,0x3c,
|
||||
0x70,0x61,0x74,0x68,0x20,0x64,0x3d,0x22,0x4d,0x32,0x32,0x2e,0x34,0x31,0x37,0x33,
|
||||
0x20,0x34,0x34,0x2e,0x37,0x33,0x33,0x33,0x4c,0x32,0x32,0x2e,0x35,0x30,0x33,0x37,
|
||||
0x20,0x34,0x34,0x2e,0x36,0x34,0x36,0x39,0x4c,0x32,0x32,0x2e,0x36,0x37,0x35,0x35,
|
||||
0x20,0x34,0x34,0x2e,0x37,0x33,0x33,0x33,0x48,0x32,0x33,0x2e,0x36,0x36,0x4c,0x32,
|
||||
0x35,0x2e,0x31,0x39,0x34,0x39,0x20,0x34,0x33,0x2e,0x31,0x39,0x38,0x34,0x4c,0x32,
|
||||
0x34,0x2e,0x33,0x36,0x36,0x31,0x20,0x34,0x31,0x2e,0x35,0x34,0x31,0x38,0x4c,0x32,
|
||||
0x35,0x2e,0x36,0x30,0x38,0x38,0x20,0x34,0x30,0x2e,0x32,0x39,0x39,0x32,0x4c,0x32,
|
||||
0x37,0x2e,0x32,0x36,0x35,0x33,0x20,0x34,0x31,0x2e,0x31,0x32,0x38,0x4c,0x33,0x32,
|
||||
0x2e,0x38,0x39,0x33,0x31,0x20,0x33,0x35,0x2e,0x35,0x30,0x30,0x32,0x43,0x33,0x33,
|
||||
0x2e,0x39,0x34,0x33,0x37,0x20,0x33,0x36,0x2e,0x30,0x37,0x37,0x33,0x20,0x33,0x35,
|
||||
0x2e,0x30,0x36,0x39,0x20,0x33,0x36,0x2e,0x34,0x36,0x37,0x37,0x20,0x33,0x36,0x2e,
|
||||
0x32,0x32,0x31,0x31,0x20,0x33,0x36,0x2e,0x36,0x37,0x35,0x37,0x56,0x31,0x39,0x2e,
|
||||
0x31,0x33,0x33,0x33,0x4c,0x32,0x38,0x2e,0x35,0x36,0x36,0x37,0x20,0x32,0x30,0x2e,
|
||||
0x35,0x33,0x34,0x39,0x43,0x32,0x38,0x2e,0x31,0x37,0x34,0x31,0x20,0x32,0x30,0x2e,
|
||||
0x38,0x33,0x33,0x36,0x20,0x32,0x38,0x2e,0x37,0x30,0x34,0x33,0x20,0x32,0x31,0x2e,
|
||||
0x31,0x31,0x33,0x20,0x32,0x37,0x2e,0x37,0x33,0x33,0x36,0x20,0x32,0x31,0x2e,0x32,
|
||||
0x36,0x36,0x36,0x43,0x32,0x36,0x2e,0x38,0x36,0x35,0x33,0x20,0x32,0x33,0x2e,0x34,
|
||||
0x36,0x32,0x39,0x20,0x32,0x38,0x2e,0x31,0x33,0x36,0x38,0x20,0x32,0x34,0x2e,0x34,
|
||||
0x34,0x39,0x36,0x20,0x32,0x38,0x2e,0x38,0x30,0x30,0x33,0x20,0x32,0x37,0x2e,0x36,
|
||||
0x36,0x36,0x36,0x4c,0x31,0x31,0x2e,0x38,0x37,0x30,0x31,0x20,0x34,0x34,0x2e,0x36,
|
||||
0x38,0x37,0x34,0x4c,0x32,0x32,0x2e,0x34,0x31,0x37,0x33,0x20,0x34,0x34,0x2e,0x37,
|
||||
0x33,0x33,0x33,0x5a,0x22,0x20,0x66,0x69,0x6c,0x6c,0x3d,0x22,0x23,0x44,0x45,0x39,
|
||||
0x36,0x35,0x33,0x22,0x2f,0x3e,0xa,0x3c,0x70,0x61,0x74,0x68,0x20,0x66,0x69,0x6c,
|
||||
0x6c,0x2d,0x72,0x75,0x6c,0x65,0x3d,0x22,0x65,0x76,0x65,0x6e,0x6f,0x64,0x64,0x22,
|
||||
0x20,0x63,0x6c,0x69,0x70,0x2d,0x72,0x75,0x6c,0x65,0x3d,0x22,0x65,0x76,0x65,0x6e,
|
||||
0x6f,0x64,0x64,0x22,0x20,0x64,0x3d,0x22,0x4d,0x32,0x39,0x2e,0x32,0x35,0x32,0x36,
|
||||
0x20,0x31,0x35,0x2e,0x38,0x30,0x33,0x32,0x43,0x33,0x33,0x2e,0x35,0x34,0x31,0x37,
|
||||
0x20,0x31,0x31,0x2e,0x35,0x31,0x34,0x32,0x20,0x34,0x30,0x2e,0x34,0x39,0x34,0x32,
|
||||
0x20,0x31,0x31,0x2e,0x35,0x31,0x34,0x32,0x20,0x34,0x34,0x2e,0x37,0x38,0x33,0x33,
|
||||
0x20,0x31,0x35,0x2e,0x38,0x30,0x33,0x32,0x43,0x34,0x39,0x2e,0x30,0x37,0x32,0x33,
|
||||
0x20,0x32,0x30,0x2e,0x30,0x39,0x31,0x32,0x20,0x34,0x39,0x2e,0x30,0x37,0x32,0x33,
|
||||
0x20,0x32,0x37,0x2e,0x30,0x34,0x34,0x38,0x20,0x34,0x34,0x2e,0x37,0x38,0x35,0x34,
|
||||
0x20,0x33,0x31,0x2e,0x33,0x33,0x33,0x39,0x43,0x34,0x31,0x2e,0x32,0x35,0x31,0x35,
|
||||
0x20,0x33,0x34,0x2e,0x38,0x36,0x37,0x38,0x20,0x33,0x35,0x2e,0x39,0x31,0x33,0x39,
|
||||
0x20,0x33,0x35,0x2e,0x34,0x38,0x32,0x32,0x20,0x33,0x31,0x2e,0x37,0x34,0x33,0x33,
|
||||
0x20,0x33,0x33,0x2e,0x31,0x39,0x34,0x32,0x4c,0x32,0x38,0x2e,0x31,0x31,0x35,0x35,
|
||||
0x20,0x33,0x36,0x2e,0x38,0x32,0x31,0x39,0x4c,0x32,0x36,0x2e,0x34,0x35,0x39,0x20,
|
||||
0x33,0x35,0x2e,0x39,0x39,0x33,0x31,0x4c,0x32,0x35,0x2e,0x32,0x31,0x36,0x33,0x20,
|
||||
0x33,0x37,0x2e,0x32,0x33,0x35,0x38,0x4c,0x32,0x36,0x2e,0x30,0x34,0x35,0x31,0x20,
|
||||
0x33,0x38,0x2e,0x38,0x39,0x32,0x33,0x4c,0x32,0x34,0x2e,0x31,0x38,0x31,0x37,0x20,
|
||||
0x34,0x30,0x2e,0x37,0x35,0x35,0x38,0x4c,0x32,0x33,0x2e,0x33,0x35,0x32,0x39,0x20,
|
||||
0x34,0x30,0x2e,0x33,0x34,0x31,0x39,0x4c,0x32,0x32,0x2e,0x31,0x31,0x30,0x32,0x20,
|
||||
0x34,0x31,0x2e,0x35,0x38,0x34,0x36,0x4c,0x32,0x32,0x2e,0x35,0x32,0x34,0x31,0x20,
|
||||
0x34,0x32,0x2e,0x34,0x31,0x33,0x34,0x4c,0x32,0x31,0x2e,0x32,0x38,0x31,0x34,0x20,
|
||||
0x34,0x33,0x2e,0x36,0x35,0x36,0x4c,0x31,0x39,0x2e,0x36,0x32,0x34,0x39,0x20,0x34,
|
||||
0x32,0x2e,0x38,0x32,0x37,0x32,0x4c,0x31,0x38,0x2e,0x33,0x38,0x32,0x32,0x20,0x34,
|
||||
0x34,0x2e,0x30,0x36,0x39,0x39,0x4c,0x31,0x39,0x2e,0x32,0x31,0x31,0x20,0x34,0x35,
|
||||
0x2e,0x37,0x32,0x36,0x34,0x4c,0x31,0x37,0x2e,0x32,0x30,0x36,0x37,0x20,0x34,0x37,
|
||||
0x2e,0x37,0x33,0x30,0x37,0x4c,0x31,0x32,0x2e,0x31,0x36,0x39,0x39,0x20,0x34,0x36,
|
||||
0x2e,0x35,0x35,0x34,0x32,0x4c,0x31,0x32,0x2e,0x32,0x33,0x36,0x31,0x20,0x34,0x32,
|
||||
0x2e,0x37,0x36,0x4c,0x32,0x36,0x2e,0x39,0x38,0x33,0x38,0x20,0x32,0x38,0x2e,0x30,
|
||||
0x31,0x31,0x32,0x43,0x32,0x35,0x2e,0x32,0x30,0x31,0x34,0x20,0x32,0x33,0x2e,0x39,
|
||||
0x38,0x32,0x34,0x20,0x32,0x35,0x2e,0x39,0x35,0x31,0x33,0x20,0x31,0x39,0x2e,0x31,
|
||||
0x30,0x34,0x36,0x20,0x32,0x39,0x2e,0x32,0x35,0x32,0x36,0x20,0x31,0x35,0x2e,0x38,
|
||||
0x30,0x33,0x32,0x5a,0x4d,0x33,0x37,0x2e,0x33,0x32,0x39,0x34,0x20,0x31,0x38,0x2e,
|
||||
0x39,0x30,0x38,0x33,0x43,0x33,0x36,0x2e,0x31,0x32,0x38,0x33,0x20,0x32,0x30,0x2e,
|
||||
0x31,0x30,0x39,0x34,0x20,0x33,0x36,0x2e,0x31,0x32,0x38,0x33,0x20,0x32,0x32,0x2e,
|
||||
0x30,0x35,0x36,0x20,0x33,0x37,0x2e,0x33,0x32,0x39,0x34,0x20,0x32,0x33,0x2e,0x32,
|
||||
0x35,0x37,0x31,0x43,0x33,0x38,0x2e,0x35,0x32,0x39,0x34,0x20,0x32,0x34,0x2e,0x34,
|
||||
0x35,0x38,0x32,0x20,0x34,0x30,0x2e,0x34,0x37,0x37,0x31,0x20,0x32,0x34,0x2e,0x34,
|
||||
0x35,0x38,0x32,0x20,0x34,0x31,0x2e,0x36,0x37,0x38,0x32,0x20,0x32,0x33,0x2e,0x32,
|
||||
0x35,0x37,0x31,0x43,0x34,0x32,0x2e,0x38,0x37,0x39,0x33,0x20,0x32,0x32,0x2e,0x30,
|
||||
0x35,0x36,0x20,0x34,0x32,0x2e,0x38,0x37,0x39,0x33,0x20,0x32,0x30,0x2e,0x31,0x30,
|
||||
0x39,0x34,0x20,0x34,0x31,0x2e,0x36,0x37,0x38,0x32,0x20,0x31,0x38,0x2e,0x39,0x30,
|
||||
0x38,0x33,0x43,0x34,0x30,0x2e,0x34,0x37,0x37,0x31,0x20,0x31,0x37,0x2e,0x37,0x30,
|
||||
0x37,0x32,0x20,0x33,0x38,0x2e,0x35,0x33,0x30,0x35,0x20,0x31,0x37,0x2e,0x37,0x30,
|
||||
0x37,0x32,0x20,0x33,0x37,0x2e,0x33,0x32,0x39,0x34,0x20,0x31,0x38,0x2e,0x39,0x30,
|
||||
0x38,0x33,0x5a,0x22,0x20,0x66,0x69,0x6c,0x6c,0x3d,0x22,0x75,0x72,0x6c,0x28,0x23,
|
||||
0x70,0x61,0x69,0x6e,0x74,0x31,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x36,0x32,
|
||||
0x38,0x35,0x5f,0x31,0x38,0x36,0x37,0x33,0x32,0x29,0x22,0x2f,0x3e,0xa,0x3c,0x70,
|
||||
0x61,0x74,0x68,0x20,0x64,0x3d,0x22,0x4d,0x31,0x37,0x2e,0x32,0x30,0x35,0x35,0x20,
|
||||
0x34,0x37,0x2e,0x37,0x32,0x39,0x37,0x4c,0x31,0x39,0x2e,0x32,0x30,0x39,0x37,0x20,
|
||||
0x34,0x35,0x2e,0x37,0x32,0x35,0x34,0x4c,0x31,0x38,0x2e,0x33,0x38,0x30,0x39,0x20,
|
||||
0x34,0x34,0x2e,0x30,0x36,0x38,0x39,0x4c,0x31,0x39,0x2e,0x36,0x32,0x33,0x36,0x20,
|
||||
0x34,0x32,0x2e,0x38,0x32,0x36,0x32,0x4c,0x32,0x31,0x2e,0x32,0x38,0x30,0x31,0x20,
|
||||
0x34,0x33,0x2e,0x36,0x35,0x35,0x4c,0x32,0x32,0x2e,0x35,0x32,0x32,0x38,0x20,0x34,
|
||||
0x32,0x2e,0x34,0x31,0x32,0x33,0x4c,0x32,0x32,0x2e,0x31,0x30,0x38,0x39,0x20,0x34,
|
||||
0x31,0x2e,0x35,0x38,0x33,0x35,0x4c,0x32,0x33,0x2e,0x33,0x35,0x30,0x35,0x20,0x34,
|
||||
0x30,0x2e,0x33,0x34,0x31,0x39,0x4c,0x32,0x34,0x2e,0x31,0x37,0x39,0x33,0x20,0x34,
|
||||
0x30,0x2e,0x37,0x35,0x35,0x38,0x4c,0x32,0x36,0x2e,0x30,0x34,0x32,0x38,0x20,0x33,
|
||||
0x38,0x2e,0x38,0x39,0x32,0x33,0x4c,0x32,0x35,0x2e,0x32,0x31,0x35,0x31,0x20,0x33,
|
||||
0x37,0x2e,0x32,0x33,0x35,0x38,0x4c,0x32,0x36,0x2e,0x34,0x35,0x37,0x37,0x20,0x33,
|
||||
0x35,0x2e,0x39,0x39,0x33,0x31,0x4c,0x32,0x38,0x2e,0x31,0x31,0x34,0x33,0x20,0x33,
|
||||
0x36,0x2e,0x38,0x32,0x30,0x39,0x4c,0x33,0x30,0x2e,0x31,0x38,0x34,0x37,0x20,0x33,
|
||||
0x34,0x2e,0x37,0x35,0x30,0x35,0x4c,0x32,0x37,0x2e,0x36,0x39,0x39,0x33,0x20,0x33,
|
||||
0x33,0x2e,0x35,0x30,0x37,0x38,0x4c,0x31,0x34,0x2e,0x31,0x38,0x33,0x36,0x20,0x34,
|
||||
0x37,0x2e,0x30,0x32,0x34,0x36,0x4c,0x31,0x37,0x2e,0x32,0x30,0x35,0x35,0x20,0x34,
|
||||
0x37,0x2e,0x37,0x32,0x39,0x37,0x5a,0x22,0x20,0x66,0x69,0x6c,0x6c,0x3d,0x22,0x75,
|
||||
0x72,0x6c,0x28,0x23,0x70,0x61,0x69,0x6e,0x74,0x32,0x5f,0x6c,0x69,0x6e,0x65,0x61,
|
||||
0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,0x36,0x37,0x33,0x32,0x29,0x22,0x2f,
|
||||
0x3e,0xa,0x3c,0x70,0x61,0x74,0x68,0x20,0x64,0x3d,0x22,0x4d,0x31,0x32,0x2e,0x31,
|
||||
0x36,0x38,0x39,0x20,0x34,0x36,0x2e,0x35,0x35,0x33,0x39,0x4c,0x32,0x36,0x2e,0x34,
|
||||
0x35,0x38,0x20,0x33,0x32,0x2e,0x32,0x36,0x34,0x38,0x4c,0x32,0x35,0x2e,0x38,0x33,
|
||||
0x36,0x31,0x20,0x33,0x31,0x2e,0x36,0x34,0x34,0x4c,0x31,0x32,0x2e,0x31,0x39,0x31,
|
||||
0x33,0x20,0x34,0x35,0x2e,0x32,0x38,0x38,0x38,0x4c,0x31,0x32,0x2e,0x31,0x36,0x38,
|
||||
0x39,0x20,0x34,0x36,0x2e,0x35,0x35,0x33,0x39,0x5a,0x22,0x20,0x66,0x69,0x6c,0x6c,
|
||||
0x3d,0x22,0x75,0x72,0x6c,0x28,0x23,0x70,0x61,0x69,0x6e,0x74,0x33,0x5f,0x6c,0x69,
|
||||
0x6e,0x65,0x61,0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,0x36,0x37,0x33,0x32,
|
||||
0x29,0x22,0x2f,0x3e,0xa,0x3c,0x70,0x61,0x74,0x68,0x20,0x64,0x3d,0x22,0x4d,0x32,
|
||||
0x36,0x2e,0x34,0x35,0x37,0x39,0x20,0x33,0x32,0x2e,0x32,0x36,0x35,0x31,0x4c,0x31,
|
||||
0x32,0x2e,0x34,0x33,0x35,0x35,0x20,0x34,0x36,0x2e,0x32,0x38,0x36,0x35,0x4c,0x31,
|
||||
0x32,0x2e,0x35,0x39,0x31,0x33,0x20,0x34,0x36,0x2e,0x36,0x35,0x32,0x33,0x4c,0x32,
|
||||
0x36,0x2e,0x37,0x31,0x35,0x20,0x33,0x32,0x2e,0x35,0x32,0x33,0x33,0x4c,0x32,0x36,
|
||||
0x2e,0x34,0x35,0x37,0x39,0x20,0x33,0x32,0x2e,0x32,0x36,0x35,0x31,0x5a,0x22,0x20,
|
||||
0x66,0x69,0x6c,0x6c,0x3d,0x22,0x75,0x72,0x6c,0x28,0x23,0x70,0x61,0x69,0x6e,0x74,
|
||||
0x34,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,
|
||||
0x36,0x37,0x33,0x32,0x29,0x22,0x2f,0x3e,0xa,0x3c,0x70,0x61,0x74,0x68,0x20,0x64,
|
||||
0x3d,0x22,0x4d,0x32,0x37,0x2e,0x34,0x30,0x30,0x39,0x20,0x32,0x38,0x2e,0x34,0x32,
|
||||
0x37,0x32,0x4c,0x32,0x37,0x2e,0x33,0x39,0x38,0x38,0x20,0x32,0x38,0x2e,0x34,0x32,
|
||||
0x31,0x39,0x4c,0x32,0x36,0x2e,0x39,0x38,0x32,0x38,0x20,0x32,0x38,0x2e,0x30,0x30,
|
||||
0x35,0x39,0x4c,0x32,0x36,0x2e,0x39,0x38,0x34,0x39,0x20,0x32,0x38,0x2e,0x30,0x31,
|
||||
0x31,0x32,0x4c,0x31,0x32,0x2e,0x32,0x33,0x36,0x31,0x20,0x34,0x32,0x2e,0x37,0x36,
|
||||
0x4c,0x31,0x32,0x2e,0x31,0x36,0x38,0x39,0x20,0x34,0x36,0x2e,0x35,0x35,0x34,0x31,
|
||||
0x4c,0x31,0x32,0x2e,0x35,0x39,0x31,0x33,0x20,0x34,0x36,0x2e,0x36,0x35,0x32,0x33,
|
||||
0x4c,0x31,0x32,0x2e,0x36,0x35,0x32,0x31,0x20,0x34,0x33,0x2e,0x31,0x37,0x36,0x4c,
|
||||
0x32,0x37,0x2e,0x34,0x30,0x30,0x39,0x20,0x32,0x38,0x2e,0x34,0x32,0x37,0x32,0x5a,
|
||||
0x22,0x20,0x66,0x69,0x6c,0x6c,0x3d,0x22,0x75,0x72,0x6c,0x28,0x23,0x70,0x61,0x69,
|
||||
0x6e,0x74,0x35,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,
|
||||
0x31,0x38,0x36,0x37,0x33,0x32,0x29,0x22,0x2f,0x3e,0xa,0x3c,0x70,0x61,0x74,0x68,
|
||||
0x20,0x64,0x3d,0x22,0x4d,0x34,0x34,0x2e,0x37,0x38,0x33,0x31,0x20,0x31,0x35,0x2e,
|
||||
0x38,0x30,0x33,0x32,0x43,0x34,0x30,0x2e,0x34,0x39,0x34,0x20,0x31,0x31,0x2e,0x35,
|
||||
0x31,0x34,0x32,0x20,0x33,0x33,0x2e,0x35,0x34,0x31,0x35,0x20,0x31,0x31,0x2e,0x35,
|
||||
0x31,0x34,0x32,0x20,0x32,0x39,0x2e,0x32,0x35,0x32,0x34,0x20,0x31,0x35,0x2e,0x38,
|
||||
0x30,0x33,0x32,0x43,0x32,0x35,0x2e,0x37,0x37,0x38,0x33,0x20,0x31,0x39,0x2e,0x32,
|
||||
0x37,0x37,0x34,0x20,0x32,0x35,0x2e,0x31,0x32,0x30,0x32,0x20,0x32,0x34,0x2e,0x34,
|
||||
0x39,0x39,0x38,0x20,0x32,0x37,0x2e,0x32,0x37,0x34,0x38,0x20,0x32,0x38,0x2e,0x36,
|
||||
0x33,0x38,0x34,0x4c,0x32,0x37,0x2e,0x36,0x31,0x31,0x39,0x20,0x32,0x38,0x2e,0x33,
|
||||
0x30,0x31,0x34,0x43,0x32,0x35,0x2e,0x36,0x32,0x34,0x37,0x20,0x32,0x34,0x2e,0x33,
|
||||
0x35,0x32,0x36,0x20,0x32,0x36,0x2e,0x32,0x37,0x32,0x32,0x20,0x31,0x39,0x2e,0x34,
|
||||
0x31,0x37,0x31,0x20,0x32,0x39,0x2e,0x35,0x36,0x39,0x32,0x20,0x31,0x36,0x2e,0x31,
|
||||
0x32,0x43,0x33,0x33,0x2e,0x36,0x38,0x32,0x33,0x20,0x31,0x32,0x2e,0x30,0x30,0x37,
|
||||
0x20,0x34,0x30,0x2e,0x33,0x35,0x32,0x32,0x20,0x31,0x32,0x2e,0x30,0x30,0x37,0x20,
|
||||
0x34,0x34,0x2e,0x34,0x36,0x35,0x32,0x20,0x31,0x36,0x2e,0x31,0x32,0x43,0x34,0x38,
|
||||
0x2e,0x35,0x37,0x38,0x33,0x20,0x32,0x30,0x2e,0x32,0x33,0x33,0x31,0x20,0x34,0x38,
|
||||
0x2e,0x35,0x37,0x38,0x33,0x20,0x32,0x36,0x2e,0x39,0x30,0x33,0x20,0x34,0x34,0x2e,
|
||||
0x34,0x36,0x35,0x32,0x20,0x33,0x31,0x2e,0x30,0x31,0x36,0x43,0x34,0x31,0x2e,0x30,
|
||||
0x39,0x30,0x33,0x20,0x33,0x34,0x2e,0x33,0x39,0x31,0x20,0x33,0x35,0x2e,0x39,0x39,
|
||||
0x38,0x20,0x33,0x34,0x2e,0x39,0x39,0x31,0x35,0x20,0x33,0x32,0x2e,0x30,0x30,0x35,
|
||||
0x35,0x20,0x33,0x32,0x2e,0x38,0x32,0x39,0x34,0x4c,0x33,0x31,0x2e,0x36,0x37,0x38,
|
||||
0x20,0x33,0x33,0x2e,0x31,0x35,0x36,0x38,0x43,0x33,0x35,0x2e,0x38,0x35,0x37,0x32,
|
||||
0x20,0x33,0x35,0x2e,0x34,0x38,0x36,0x34,0x20,0x34,0x31,0x2e,0x32,0x33,0x31,0x31,
|
||||
0x20,0x33,0x34,0x2e,0x38,0x38,0x34,0x38,0x20,0x34,0x34,0x2e,0x37,0x38,0x32,0x20,
|
||||
0x33,0x31,0x2e,0x33,0x33,0x33,0x39,0x43,0x34,0x39,0x2e,0x30,0x37,0x32,0x32,0x20,
|
||||
0x32,0x37,0x2e,0x30,0x34,0x34,0x38,0x20,0x34,0x39,0x2e,0x30,0x37,0x32,0x32,0x20,
|
||||
0x32,0x30,0x2e,0x30,0x39,0x31,0x32,0x20,0x34,0x34,0x2e,0x37,0x38,0x33,0x31,0x20,
|
||||
0x31,0x35,0x2e,0x38,0x30,0x33,0x32,0x5a,0x22,0x20,0x66,0x69,0x6c,0x6c,0x3d,0x22,
|
||||
0x75,0x72,0x6c,0x28,0x23,0x70,0x61,0x69,0x6e,0x74,0x36,0x5f,0x6c,0x69,0x6e,0x65,
|
||||
0x61,0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,0x36,0x37,0x33,0x32,0x29,0x22,
|
||||
0x2f,0x3e,0xa,0x3c,0x70,0x61,0x74,0x68,0x20,0x66,0x69,0x6c,0x6c,0x2d,0x72,0x75,
|
||||
0x6c,0x65,0x3d,0x22,0x65,0x76,0x65,0x6e,0x6f,0x64,0x64,0x22,0x20,0x63,0x6c,0x69,
|
||||
0x70,0x2d,0x72,0x75,0x6c,0x65,0x3d,0x22,0x65,0x76,0x65,0x6e,0x6f,0x64,0x64,0x22,
|
||||
0x20,0x64,0x3d,0x22,0x4d,0x34,0x37,0x2e,0x39,0x33,0x31,0x39,0x20,0x32,0x32,0x2e,
|
||||
0x33,0x39,0x32,0x31,0x43,0x34,0x38,0x2e,0x30,0x38,0x30,0x31,0x20,0x32,0x35,0x2e,
|
||||
0x33,0x38,0x32,0x20,0x34,0x37,0x2e,0x30,0x32,0x34,0x31,0x20,0x32,0x38,0x2e,0x34,
|
||||
0x31,0x39,0x38,0x20,0x34,0x34,0x2e,0x37,0x34,0x31,0x35,0x20,0x33,0x30,0x2e,0x37,
|
||||
0x30,0x32,0x35,0x43,0x34,0x31,0x2e,0x32,0x30,0x38,0x37,0x20,0x33,0x34,0x2e,0x32,
|
||||
0x33,0x35,0x33,0x20,0x33,0x35,0x2e,0x38,0x37,0x20,0x33,0x34,0x2e,0x38,0x35,0x30,
|
||||
0x38,0x20,0x33,0x31,0x2e,0x36,0x39,0x39,0x33,0x20,0x33,0x32,0x2e,0x35,0x36,0x32,
|
||||
0x38,0x4c,0x32,0x38,0x2e,0x30,0x37,0x31,0x36,0x20,0x33,0x36,0x2e,0x31,0x39,0x30,
|
||||
0x35,0x4c,0x32,0x36,0x2e,0x34,0x31,0x35,0x31,0x20,0x33,0x35,0x2e,0x33,0x36,0x31,
|
||||
0x37,0x4c,0x32,0x35,0x2e,0x31,0x37,0x32,0x34,0x20,0x33,0x36,0x2e,0x36,0x30,0x34,
|
||||
0x34,0x4c,0x32,0x35,0x2e,0x33,0x39,0x36,0x34,0x20,0x33,0x37,0x2e,0x30,0x35,0x33,
|
||||
0x34,0x4c,0x32,0x36,0x2e,0x34,0x35,0x36,0x37,0x20,0x33,0x35,0x2e,0x39,0x39,0x33,
|
||||
0x32,0x4c,0x32,0x38,0x2e,0x31,0x31,0x33,0x32,0x20,0x33,0x36,0x2e,0x38,0x32,0x32,
|
||||
0x4c,0x33,0x31,0x2e,0x37,0x34,0x30,0x39,0x20,0x33,0x33,0x2e,0x31,0x39,0x34,0x32,
|
||||
0x43,0x33,0x35,0x2e,0x39,0x31,0x31,0x36,0x20,0x33,0x35,0x2e,0x34,0x38,0x32,0x32,
|
||||
0x20,0x34,0x31,0x2e,0x32,0x34,0x39,0x32,0x20,0x33,0x34,0x2e,0x38,0x36,0x37,0x38,
|
||||
0x20,0x34,0x34,0x2e,0x37,0x38,0x33,0x31,0x20,0x33,0x31,0x2e,0x33,0x33,0x34,0x43,
|
||||
0x34,0x37,0x2e,0x32,0x32,0x37,0x39,0x20,0x32,0x38,0x2e,0x38,0x38,0x39,0x32,0x20,
|
||||
0x34,0x38,0x2e,0x32,0x37,0x33,0x32,0x20,0x32,0x35,0x2e,0x35,0x38,0x30,0x34,0x20,
|
||||
0x34,0x37,0x2e,0x39,0x33,0x31,0x39,0x20,0x32,0x32,0x2e,0x33,0x39,0x32,0x31,0x5a,
|
||||
0x4d,0x31,0x39,0x2e,0x35,0x38,0x32,0x20,0x34,0x32,0x2e,0x31,0x39,0x34,0x38,0x4c,
|
||||
0x32,0x31,0x2e,0x32,0x33,0x38,0x35,0x20,0x34,0x33,0x2e,0x30,0x32,0x33,0x36,0x4c,
|
||||
0x32,0x32,0x2e,0x32,0x39,0x38,0x38,0x20,0x34,0x31,0x2e,0x39,0x36,0x33,0x33,0x4c,
|
||||
0x32,0x32,0x2e,0x35,0x32,0x32,0x38,0x20,0x34,0x32,0x2e,0x34,0x31,0x32,0x34,0x4c,
|
||||
0x32,0x31,0x2e,0x32,0x38,0x30,0x31,0x20,0x34,0x33,0x2e,0x36,0x35,0x35,0x4c,0x31,
|
||||
0x39,0x2e,0x36,0x32,0x33,0x36,0x20,0x34,0x32,0x2e,0x38,0x32,0x36,0x32,0x4c,0x31,
|
||||
0x38,0x2e,0x35,0x36,0x33,0x33,0x20,0x34,0x33,0x2e,0x38,0x38,0x36,0x35,0x4c,0x31,
|
||||
0x38,0x2e,0x33,0x33,0x39,0x33,0x20,0x34,0x33,0x2e,0x34,0x33,0x37,0x34,0x4c,0x31,
|
||||
0x39,0x2e,0x35,0x38,0x32,0x20,0x34,0x32,0x2e,0x31,0x39,0x34,0x38,0x5a,0x4d,0x31,
|
||||
0x39,0x2e,0x32,0x30,0x39,0x37,0x20,0x34,0x35,0x2e,0x37,0x32,0x36,0x35,0x4c,0x31,
|
||||
0x38,0x2e,0x39,0x38,0x35,0x37,0x20,0x34,0x35,0x2e,0x32,0x37,0x37,0x34,0x4c,0x31,
|
||||
0x37,0x2e,0x31,0x36,0x32,0x38,0x20,0x34,0x37,0x2e,0x31,0x30,0x30,0x34,0x4c,0x31,
|
||||
0x34,0x2e,0x36,0x39,0x39,0x39,0x20,0x34,0x36,0x2e,0x35,0x30,0x35,0x32,0x4c,0x31,
|
||||
0x34,0x2e,0x31,0x38,0x33,0x36,0x20,0x34,0x37,0x2e,0x30,0x32,0x34,0x36,0x4c,0x31,
|
||||
0x37,0x2e,0x32,0x30,0x35,0x35,0x20,0x34,0x37,0x2e,0x37,0x33,0x30,0x38,0x4c,0x31,
|
||||
0x39,0x2e,0x32,0x30,0x39,0x37,0x20,0x34,0x35,0x2e,0x37,0x32,0x36,0x35,0x5a,0x4d,
|
||||
0x32,0x33,0x2e,0x33,0x30,0x38,0x39,0x20,0x33,0x39,0x2e,0x37,0x31,0x31,0x36,0x4c,
|
||||
0x32,0x34,0x2e,0x31,0x33,0x37,0x37,0x20,0x34,0x30,0x2e,0x31,0x32,0x35,0x34,0x4c,
|
||||
0x32,0x35,0x2e,0x38,0x31,0x38,0x38,0x20,0x33,0x38,0x2e,0x34,0x34,0x34,0x34,0x4c,
|
||||
0x32,0x36,0x2e,0x30,0x34,0x32,0x38,0x20,0x33,0x38,0x2e,0x38,0x39,0x33,0x34,0x4c,
|
||||
0x32,0x34,0x2e,0x31,0x37,0x39,0x33,0x20,0x34,0x30,0x2e,0x37,0x35,0x36,0x39,0x4c,
|
||||
0x32,0x33,0x2e,0x33,0x35,0x30,0x35,0x20,0x34,0x30,0x2e,0x33,0x34,0x33,0x4c,0x32,
|
||||
0x32,0x2e,0x32,0x39,0x30,0x33,0x20,0x34,0x31,0x2e,0x34,0x30,0x33,0x33,0x4c,0x32,
|
||||
0x32,0x2e,0x30,0x36,0x36,0x33,0x20,0x34,0x30,0x2e,0x39,0x35,0x34,0x32,0x4c,0x32,
|
||||
0x33,0x2e,0x33,0x30,0x38,0x39,0x20,0x33,0x39,0x2e,0x37,0x31,0x31,0x36,0x5a,0x22,
|
||||
0x20,0x66,0x69,0x6c,0x6c,0x3d,0x22,0x75,0x72,0x6c,0x28,0x23,0x70,0x61,0x69,0x6e,
|
||||
0x74,0x37,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,
|
||||
0x38,0x36,0x37,0x33,0x32,0x29,0x22,0x2f,0x3e,0xa,0x3c,0x70,0x61,0x74,0x68,0x20,
|
||||
0x66,0x69,0x6c,0x6c,0x2d,0x72,0x75,0x6c,0x65,0x3d,0x22,0x65,0x76,0x65,0x6e,0x6f,
|
||||
0x64,0x64,0x22,0x20,0x63,0x6c,0x69,0x70,0x2d,0x72,0x75,0x6c,0x65,0x3d,0x22,0x65,
|
||||
0x76,0x65,0x6e,0x6f,0x64,0x64,0x22,0x20,0x64,0x3d,0x22,0x4d,0x33,0x35,0x2e,0x39,
|
||||
0x36,0x31,0x39,0x20,0x32,0x31,0x2e,0x31,0x30,0x31,0x33,0x43,0x33,0x35,0x2e,0x39,
|
||||
0x36,0x31,0x39,0x20,0x31,0x39,0x2e,0x31,0x35,0x35,0x37,0x20,0x33,0x37,0x2e,0x35,
|
||||
0x33,0x39,0x35,0x20,0x31,0x37,0x2e,0x35,0x37,0x38,0x31,0x20,0x33,0x39,0x2e,0x34,
|
||||
0x38,0x35,0x31,0x20,0x31,0x37,0x2e,0x35,0x37,0x38,0x31,0x43,0x34,0x31,0x2e,0x34,
|
||||
0x33,0x30,0x37,0x20,0x31,0x37,0x2e,0x35,0x37,0x38,0x31,0x20,0x34,0x33,0x2e,0x30,
|
||||
0x30,0x38,0x33,0x20,0x31,0x39,0x2e,0x31,0x35,0x35,0x37,0x20,0x34,0x33,0x2e,0x30,
|
||||
0x30,0x38,0x33,0x20,0x32,0x31,0x2e,0x31,0x30,0x31,0x33,0x43,0x34,0x33,0x2e,0x30,
|
||||
0x30,0x38,0x33,0x20,0x32,0x33,0x2e,0x30,0x34,0x36,0x39,0x20,0x34,0x31,0x2e,0x34,
|
||||
0x33,0x30,0x37,0x20,0x32,0x34,0x2e,0x36,0x32,0x34,0x35,0x20,0x33,0x39,0x2e,0x34,
|
||||
0x38,0x35,0x31,0x20,0x32,0x34,0x2e,0x36,0x32,0x34,0x35,0x43,0x33,0x37,0x2e,0x35,
|
||||
0x33,0x39,0x35,0x20,0x32,0x34,0x2e,0x36,0x32,0x34,0x35,0x20,0x33,0x35,0x2e,0x39,
|
||||
0x36,0x31,0x39,0x20,0x32,0x33,0x2e,0x30,0x34,0x36,0x39,0x20,0x33,0x35,0x2e,0x39,
|
||||
0x36,0x31,0x39,0x20,0x32,0x31,0x2e,0x31,0x30,0x31,0x33,0x5a,0x4d,0x33,0x36,0x2e,
|
||||
0x34,0x30,0x39,0x39,0x20,0x32,0x31,0x2e,0x31,0x30,0x31,0x33,0x43,0x33,0x36,0x2e,
|
||||
0x34,0x30,0x39,0x39,0x20,0x32,0x32,0x2e,0x37,0x39,0x39,0x35,0x20,0x33,0x37,0x2e,
|
||||
0x37,0x38,0x37,0x20,0x32,0x34,0x2e,0x31,0x37,0x36,0x35,0x20,0x33,0x39,0x2e,0x34,
|
||||
0x38,0x35,0x31,0x20,0x32,0x34,0x2e,0x31,0x37,0x36,0x35,0x43,0x34,0x31,0x2e,0x31,
|
||||
0x38,0x33,0x32,0x20,0x32,0x34,0x2e,0x31,0x37,0x36,0x35,0x20,0x34,0x32,0x2e,0x35,
|
||||
0x36,0x30,0x33,0x20,0x32,0x32,0x2e,0x37,0x39,0x39,0x35,0x20,0x34,0x32,0x2e,0x35,
|
||||
0x36,0x30,0x33,0x20,0x32,0x31,0x2e,0x31,0x30,0x31,0x33,0x43,0x34,0x32,0x2e,0x35,
|
||||
0x36,0x30,0x33,0x20,0x31,0x39,0x2e,0x34,0x30,0x33,0x32,0x20,0x34,0x31,0x2e,0x31,
|
||||
0x38,0x33,0x32,0x20,0x31,0x38,0x2e,0x30,0x32,0x36,0x31,0x20,0x33,0x39,0x2e,0x34,
|
||||
0x38,0x35,0x31,0x20,0x31,0x38,0x2e,0x30,0x32,0x36,0x31,0x43,0x33,0x37,0x2e,0x37,
|
||||
0x38,0x37,0x20,0x31,0x38,0x2e,0x30,0x32,0x36,0x31,0x20,0x33,0x36,0x2e,0x34,0x30,
|
||||
0x39,0x39,0x20,0x31,0x39,0x2e,0x34,0x30,0x33,0x32,0x20,0x33,0x36,0x2e,0x34,0x30,
|
||||
0x39,0x39,0x20,0x32,0x31,0x2e,0x31,0x30,0x31,0x33,0x5a,0x22,0x20,0x66,0x69,0x6c,
|
||||
0x6c,0x3d,0x22,0x75,0x72,0x6c,0x28,0x23,0x70,0x61,0x69,0x6e,0x74,0x38,0x5f,0x6c,
|
||||
0x69,0x6e,0x65,0x61,0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,0x36,0x37,0x33,
|
||||
0x32,0x29,0x22,0x2f,0x3e,0xa,0x3c,0x70,0x61,0x74,0x68,0x20,0x64,0x3d,0x22,0x4d,
|
||||
0x33,0x37,0x2e,0x33,0x32,0x38,0x38,0x20,0x31,0x38,0x2e,0x39,0x30,0x39,0x34,0x43,
|
||||
0x33,0x38,0x2e,0x35,0x32,0x39,0x39,0x20,0x31,0x37,0x2e,0x37,0x30,0x38,0x33,0x20,
|
||||
0x34,0x30,0x2e,0x34,0x37,0x36,0x35,0x20,0x31,0x37,0x2e,0x37,0x30,0x38,0x33,0x20,
|
||||
0x34,0x31,0x2e,0x36,0x37,0x37,0x36,0x20,0x31,0x38,0x2e,0x39,0x30,0x39,0x34,0x43,
|
||||
0x34,0x32,0x2e,0x30,0x34,0x34,0x35,0x20,0x31,0x39,0x2e,0x32,0x37,0x36,0x33,0x20,
|
||||
0x34,0x32,0x2e,0x32,0x38,0x34,0x35,0x20,0x31,0x39,0x2e,0x37,0x31,0x35,0x38,0x20,
|
||||
0x34,0x32,0x2e,0x34,0x32,0x37,0x35,0x20,0x32,0x30,0x2e,0x31,0x37,0x38,0x37,0x4c,
|
||||
0x34,0x36,0x2e,0x38,0x34,0x36,0x36,0x20,0x31,0x38,0x2e,0x36,0x38,0x32,0x32,0x43,
|
||||
0x34,0x36,0x2e,0x33,0x33,0x30,0x34,0x20,0x31,0x37,0x2e,0x36,0x34,0x34,0x33,0x20,
|
||||
0x34,0x35,0x2e,0x36,0x34,0x38,0x38,0x20,0x31,0x36,0x2e,0x36,0x36,0x38,0x33,0x20,
|
||||
0x34,0x34,0x2e,0x37,0x38,0x33,0x37,0x20,0x31,0x35,0x2e,0x38,0x30,0x33,0x32,0x43,
|
||||
0x34,0x30,0x2e,0x34,0x39,0x34,0x36,0x20,0x31,0x31,0x2e,0x35,0x31,0x34,0x32,0x20,
|
||||
0x33,0x33,0x2e,0x35,0x34,0x31,0x20,0x31,0x31,0x2e,0x35,0x31,0x34,0x32,0x20,0x32,
|
||||
0x39,0x2e,0x32,0x35,0x33,0x20,0x31,0x35,0x2e,0x38,0x30,0x33,0x32,0x43,0x32,0x36,
|
||||
0x2e,0x35,0x37,0x33,0x36,0x20,0x31,0x38,0x2e,0x34,0x38,0x31,0x36,0x20,0x32,0x35,
|
||||
0x2e,0x35,0x37,0x36,0x32,0x20,0x32,0x32,0x2e,0x31,0x39,0x37,0x39,0x20,0x32,0x36,
|
||||
0x2e,0x32,0x34,0x37,0x32,0x20,0x32,0x35,0x2e,0x36,0x35,0x37,0x31,0x4c,0x33,0x36,
|
||||
0x2e,0x36,0x32,0x34,0x38,0x20,0x32,0x32,0x2e,0x31,0x34,0x33,0x35,0x43,0x33,0x36,
|
||||
0x2e,0x32,0x32,0x33,0x37,0x20,0x32,0x31,0x2e,0x30,0x35,0x32,0x33,0x20,0x33,0x36,
|
||||
0x2e,0x34,0x35,0x33,0x20,0x31,0x39,0x2e,0x37,0x38,0x34,0x20,0x33,0x37,0x2e,0x33,
|
||||
0x32,0x38,0x38,0x20,0x31,0x38,0x2e,0x39,0x30,0x39,0x34,0x5a,0x22,0x20,0x66,0x69,
|
||||
0x6c,0x6c,0x3d,0x22,0x75,0x72,0x6c,0x28,0x23,0x70,0x61,0x69,0x6e,0x74,0x39,0x5f,
|
||||
0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,0x36,0x37,
|
||||
0x33,0x32,0x29,0x22,0x2f,0x3e,0xa,0x3c,0x70,0x61,0x74,0x68,0x20,0x64,0x3d,0x22,
|
||||
0x4d,0x34,0x30,0x2e,0x36,0x34,0x35,0x34,0x20,0x32,0x34,0x2e,0x37,0x33,0x34,0x36,
|
||||
0x43,0x34,0x30,0x2e,0x33,0x37,0x37,0x37,0x20,0x32,0x34,0x2e,0x34,0x38,0x35,0x20,
|
||||
0x34,0x30,0x2e,0x36,0x37,0x34,0x32,0x20,0x32,0x33,0x2e,0x37,0x33,0x30,0x39,0x20,
|
||||
0x34,0x31,0x2e,0x33,0x30,0x38,0x39,0x20,0x32,0x33,0x2e,0x30,0x35,0x30,0x33,0x43,
|
||||
0x34,0x31,0x2e,0x39,0x34,0x32,0x35,0x20,0x32,0x32,0x2e,0x33,0x36,0x39,0x38,0x20,
|
||||
0x34,0x32,0x2e,0x36,0x37,0x34,0x32,0x20,0x32,0x32,0x2e,0x30,0x31,0x39,0x39,0x20,
|
||||
0x34,0x32,0x2e,0x39,0x34,0x31,0x39,0x20,0x32,0x32,0x2e,0x32,0x36,0x39,0x35,0x43,
|
||||
0x34,0x33,0x2e,0x32,0x30,0x39,0x37,0x20,0x32,0x32,0x2e,0x35,0x31,0x39,0x31,0x20,
|
||||
0x34,0x32,0x2e,0x39,0x31,0x33,0x31,0x20,0x32,0x33,0x2e,0x32,0x37,0x33,0x33,0x20,
|
||||
0x34,0x32,0x2e,0x32,0x37,0x38,0x35,0x20,0x32,0x33,0x2e,0x39,0x35,0x33,0x38,0x43,
|
||||
0x34,0x31,0x2e,0x36,0x34,0x33,0x38,0x20,0x32,0x34,0x2e,0x36,0x33,0x34,0x33,0x20,
|
||||
0x34,0x30,0x2e,0x39,0x31,0x33,0x31,0x20,0x32,0x34,0x2e,0x39,0x38,0x33,0x31,0x20,
|
||||
0x34,0x30,0x2e,0x36,0x34,0x35,0x34,0x20,0x32,0x34,0x2e,0x37,0x33,0x34,0x36,0x5a,
|
||||
0x22,0x20,0x66,0x69,0x6c,0x6c,0x3d,0x22,0x75,0x72,0x6c,0x28,0x23,0x70,0x61,0x69,
|
||||
0x6e,0x74,0x31,0x30,0x5f,0x72,0x61,0x64,0x69,0x61,0x6c,0x5f,0x36,0x32,0x38,0x35,
|
||||
0x5f,0x31,0x38,0x36,0x37,0x33,0x32,0x29,0x22,0x2f,0x3e,0xa,0x3c,0x64,0x65,0x66,
|
||||
0x73,0x3e,0xa,0x3c,0x66,0x69,0x6c,0x74,0x65,0x72,0x20,0x69,0x64,0x3d,0x22,0x66,
|
||||
0x69,0x6c,0x74,0x65,0x72,0x30,0x5f,0x69,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,
|
||||
0x36,0x37,0x33,0x32,0x22,0x20,0x78,0x3d,0x22,0x34,0x2e,0x32,0x36,0x36,0x36,0x22,
|
||||
0x20,0x79,0x3d,0x22,0x30,0x22,0x20,0x77,0x69,0x64,0x74,0x68,0x3d,0x22,0x32,0x37,
|
||||
0x2e,0x37,0x33,0x33,0x34,0x22,0x20,0x68,0x65,0x69,0x67,0x68,0x74,0x3d,0x22,0x32,
|
||||
0x36,0x2e,0x33,0x31,0x34,0x22,0x20,0x66,0x69,0x6c,0x74,0x65,0x72,0x55,0x6e,0x69,
|
||||
0x74,0x73,0x3d,0x22,0x75,0x73,0x65,0x72,0x53,0x70,0x61,0x63,0x65,0x4f,0x6e,0x55,
|
||||
0x73,0x65,0x22,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x2d,0x69,0x6e,0x74,0x65,0x72,0x70,
|
||||
0x6f,0x6c,0x61,0x74,0x69,0x6f,0x6e,0x2d,0x66,0x69,0x6c,0x74,0x65,0x72,0x73,0x3d,
|
||||
0x22,0x73,0x52,0x47,0x42,0x22,0x3e,0xa,0x3c,0x66,0x65,0x46,0x6c,0x6f,0x6f,0x64,
|
||||
0x20,0x66,0x6c,0x6f,0x6f,0x64,0x2d,0x6f,0x70,0x61,0x63,0x69,0x74,0x79,0x3d,0x22,
|
||||
0x30,0x22,0x20,0x72,0x65,0x73,0x75,0x6c,0x74,0x3d,0x22,0x42,0x61,0x63,0x6b,0x67,
|
||||
0x72,0x6f,0x75,0x6e,0x64,0x49,0x6d,0x61,0x67,0x65,0x46,0x69,0x78,0x22,0x2f,0x3e,
|
||||
0xa,0x3c,0x66,0x65,0x42,0x6c,0x65,0x6e,0x64,0x20,0x6d,0x6f,0x64,0x65,0x3d,0x22,
|
||||
0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x22,0x20,0x69,0x6e,0x3d,0x22,0x53,0x6f,0x75,0x72,
|
||||
0x63,0x65,0x47,0x72,0x61,0x70,0x68,0x69,0x63,0x22,0x20,0x69,0x6e,0x32,0x3d,0x22,
|
||||
0x42,0x61,0x63,0x6b,0x67,0x72,0x6f,0x75,0x6e,0x64,0x49,0x6d,0x61,0x67,0x65,0x46,
|
||||
0x69,0x78,0x22,0x20,0x72,0x65,0x73,0x75,0x6c,0x74,0x3d,0x22,0x73,0x68,0x61,0x70,
|
||||
0x65,0x22,0x2f,0x3e,0xa,0x3c,0x66,0x65,0x43,0x6f,0x6c,0x6f,0x72,0x4d,0x61,0x74,
|
||||
0x72,0x69,0x78,0x20,0x69,0x6e,0x3d,0x22,0x53,0x6f,0x75,0x72,0x63,0x65,0x41,0x6c,
|
||||
0x70,0x68,0x61,0x22,0x20,0x74,0x79,0x70,0x65,0x3d,0x22,0x6d,0x61,0x74,0x72,0x69,
|
||||
0x78,0x22,0x20,0x76,0x61,0x6c,0x75,0x65,0x73,0x3d,0x22,0x30,0x20,0x30,0x20,0x30,
|
||||
0x20,0x30,0x20,0x30,0x20,0x30,0x20,0x30,0x20,0x30,0x20,0x30,0x20,0x30,0x20,0x30,
|
||||
0x20,0x30,0x20,0x30,0x20,0x30,0x20,0x30,0x20,0x30,0x20,0x30,0x20,0x30,0x20,0x31,
|
||||
0x32,0x37,0x20,0x30,0x22,0x20,0x72,0x65,0x73,0x75,0x6c,0x74,0x3d,0x22,0x68,0x61,
|
||||
0x72,0x64,0x41,0x6c,0x70,0x68,0x61,0x22,0x2f,0x3e,0xa,0x3c,0x66,0x65,0x4f,0x66,
|
||||
0x66,0x73,0x65,0x74,0x20,0x64,0x79,0x3d,0x22,0x2d,0x31,0x22,0x2f,0x3e,0xa,0x3c,
|
||||
0x66,0x65,0x47,0x61,0x75,0x73,0x73,0x69,0x61,0x6e,0x42,0x6c,0x75,0x72,0x20,0x73,
|
||||
0x74,0x64,0x44,0x65,0x76,0x69,0x61,0x74,0x69,0x6f,0x6e,0x3d,0x22,0x31,0x2e,0x35,
|
||||
0x22,0x2f,0x3e,0xa,0x3c,0x66,0x65,0x43,0x6f,0x6d,0x70,0x6f,0x73,0x69,0x74,0x65,
|
||||
0x20,0x69,0x6e,0x32,0x3d,0x22,0x68,0x61,0x72,0x64,0x41,0x6c,0x70,0x68,0x61,0x22,
|
||||
0x20,0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,0x3d,0x22,0x61,0x72,0x69,0x74,0x68,
|
||||
0x6d,0x65,0x74,0x69,0x63,0x22,0x20,0x6b,0x32,0x3d,0x22,0x2d,0x31,0x22,0x20,0x6b,
|
||||
0x33,0x3d,0x22,0x31,0x22,0x2f,0x3e,0xa,0x3c,0x66,0x65,0x43,0x6f,0x6c,0x6f,0x72,
|
||||
0x4d,0x61,0x74,0x72,0x69,0x78,0x20,0x74,0x79,0x70,0x65,0x3d,0x22,0x6d,0x61,0x74,
|
||||
0x72,0x69,0x78,0x22,0x20,0x76,0x61,0x6c,0x75,0x65,0x73,0x3d,0x22,0x30,0x20,0x30,
|
||||
0x20,0x30,0x20,0x30,0x20,0x30,0x2e,0x36,0x36,0x35,0x31,0x35,0x31,0x20,0x30,0x20,
|
||||
0x30,0x20,0x30,0x20,0x30,0x20,0x30,0x2e,0x36,0x31,0x39,0x32,0x36,0x38,0x20,0x30,
|
||||
0x20,0x30,0x20,0x30,0x20,0x30,0x20,0x30,0x2e,0x35,0x39,0x31,0x38,0x38,0x34,0x20,
|
||||
0x30,0x20,0x30,0x20,0x30,0x20,0x31,0x20,0x30,0x22,0x2f,0x3e,0xa,0x3c,0x66,0x65,
|
||||
0x42,0x6c,0x65,0x6e,0x64,0x20,0x6d,0x6f,0x64,0x65,0x3d,0x22,0x6e,0x6f,0x72,0x6d,
|
||||
0x61,0x6c,0x22,0x20,0x69,0x6e,0x32,0x3d,0x22,0x73,0x68,0x61,0x70,0x65,0x22,0x20,
|
||||
0x72,0x65,0x73,0x75,0x6c,0x74,0x3d,0x22,0x65,0x66,0x66,0x65,0x63,0x74,0x31,0x5f,
|
||||
0x69,0x6e,0x6e,0x65,0x72,0x53,0x68,0x61,0x64,0x6f,0x77,0x5f,0x36,0x32,0x38,0x35,
|
||||
0x5f,0x31,0x38,0x36,0x37,0x33,0x32,0x22,0x2f,0x3e,0xa,0x3c,0x2f,0x66,0x69,0x6c,
|
||||
0x74,0x65,0x72,0x3e,0xa,0x3c,0x6c,0x69,0x6e,0x65,0x61,0x72,0x47,0x72,0x61,0x64,
|
||||
0x69,0x65,0x6e,0x74,0x20,0x69,0x64,0x3d,0x22,0x70,0x61,0x69,0x6e,0x74,0x30,0x5f,
|
||||
0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,0x36,0x37,
|
||||
0x33,0x32,0x22,0x20,0x78,0x31,0x3d,0x22,0x30,0x22,0x20,0x79,0x31,0x3d,0x22,0x34,
|
||||
0x34,0x2e,0x30,0x34,0x38,0x35,0x22,0x20,0x78,0x32,0x3d,0x22,0x33,0x34,0x2e,0x33,
|
||||
0x32,0x36,0x34,0x22,0x20,0x79,0x32,0x3d,0x22,0x34,0x34,0x2e,0x30,0x34,0x38,0x35,
|
||||
0x22,0x20,0x67,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,0x55,0x6e,0x69,0x74,0x73,0x3d,
|
||||
0x22,0x75,0x73,0x65,0x72,0x53,0x70,0x61,0x63,0x65,0x4f,0x6e,0x55,0x73,0x65,0x22,
|
||||
0x3e,0xa,0x3c,0x73,0x74,0x6f,0x70,0x20,0x73,0x74,0x6f,0x70,0x2d,0x63,0x6f,0x6c,
|
||||
0x6f,0x72,0x3d,0x22,0x23,0x45,0x45,0x41,0x45,0x35,0x33,0x22,0x2f,0x3e,0xa,0x3c,
|
||||
0x73,0x74,0x6f,0x70,0x20,0x6f,0x66,0x66,0x73,0x65,0x74,0x3d,0x22,0x30,0x2e,0x31,
|
||||
0x34,0x33,0x39,0x31,0x39,0x22,0x20,0x73,0x74,0x6f,0x70,0x2d,0x63,0x6f,0x6c,0x6f,
|
||||
0x72,0x3d,0x22,0x23,0x46,0x45,0x43,0x36,0x37,0x35,0x22,0x2f,0x3e,0xa,0x3c,0x73,
|
||||
0x74,0x6f,0x70,0x20,0x6f,0x66,0x66,0x73,0x65,0x74,0x3d,0x22,0x30,0x2e,0x38,0x36,
|
||||
0x32,0x38,0x32,0x34,0x22,0x20,0x73,0x74,0x6f,0x70,0x2d,0x63,0x6f,0x6c,0x6f,0x72,
|
||||
0x3d,0x22,0x23,0x45,0x42,0x42,0x35,0x36,0x37,0x22,0x2f,0x3e,0xa,0x3c,0x73,0x74,
|
||||
0x6f,0x70,0x20,0x6f,0x66,0x66,0x73,0x65,0x74,0x3d,0x22,0x31,0x22,0x20,0x73,0x74,
|
||||
0x6f,0x70,0x2d,0x63,0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x23,0x44,0x41,0x38,0x41,0x32,
|
||||
0x43,0x22,0x2f,0x3e,0xa,0x3c,0x2f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x47,0x72,0x61,
|
||||
0x64,0x69,0x65,0x6e,0x74,0x3e,0xa,0x3c,0x6c,0x69,0x6e,0x65,0x61,0x72,0x47,0x72,
|
||||
0x61,0x64,0x69,0x65,0x6e,0x74,0x20,0x69,0x64,0x3d,0x22,0x70,0x61,0x69,0x6e,0x74,
|
||||
0x31,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,
|
||||
0x36,0x37,0x33,0x32,0x22,0x20,0x78,0x31,0x3d,0x22,0x34,0x39,0x2e,0x34,0x30,0x37,
|
||||
0x32,0x22,0x20,0x79,0x31,0x3d,0x22,0x34,0x38,0x2e,0x35,0x39,0x39,0x35,0x22,0x20,
|
||||
0x78,0x32,0x3d,0x22,0x34,0x39,0x2e,0x36,0x31,0x33,0x38,0x22,0x20,0x79,0x32,0x3d,
|
||||
0x22,0x31,0x30,0x2e,0x35,0x34,0x35,0x36,0x22,0x20,0x67,0x72,0x61,0x64,0x69,0x65,
|
||||
0x6e,0x74,0x55,0x6e,0x69,0x74,0x73,0x3d,0x22,0x75,0x73,0x65,0x72,0x53,0x70,0x61,
|
||||
0x63,0x65,0x4f,0x6e,0x55,0x73,0x65,0x22,0x3e,0xa,0x3c,0x73,0x74,0x6f,0x70,0x20,
|
||||
0x73,0x74,0x6f,0x70,0x2d,0x63,0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x23,0x43,0x33,0x43,
|
||||
0x46,0x43,0x46,0x22,0x2f,0x3e,0xa,0x3c,0x73,0x74,0x6f,0x70,0x20,0x6f,0x66,0x66,
|
||||
0x73,0x65,0x74,0x3d,0x22,0x31,0x22,0x20,0x73,0x74,0x6f,0x70,0x2d,0x63,0x6f,0x6c,
|
||||
0x6f,0x72,0x3d,0x22,0x23,0x43,0x38,0x43,0x38,0x43,0x38,0x22,0x2f,0x3e,0xa,0x3c,
|
||||
0x2f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x47,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,0x3e,
|
||||
0xa,0x3c,0x6c,0x69,0x6e,0x65,0x61,0x72,0x47,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,
|
||||
0x20,0x69,0x64,0x3d,0x22,0x70,0x61,0x69,0x6e,0x74,0x32,0x5f,0x6c,0x69,0x6e,0x65,
|
||||
0x61,0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,0x36,0x37,0x33,0x32,0x22,0x20,
|
||||
0x78,0x31,0x3d,0x22,0x33,0x30,0x2e,0x38,0x31,0x32,0x39,0x22,0x20,0x79,0x31,0x3d,
|
||||
0x22,0x34,0x38,0x2e,0x30,0x38,0x31,0x33,0x22,0x20,0x78,0x32,0x3d,0x22,0x33,0x30,
|
||||
0x2e,0x38,0x38,0x38,0x37,0x22,0x20,0x79,0x32,0x3d,0x22,0x33,0x32,0x2e,0x36,0x38,
|
||||
0x31,0x39,0x22,0x20,0x67,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,0x55,0x6e,0x69,0x74,
|
||||
0x73,0x3d,0x22,0x75,0x73,0x65,0x72,0x53,0x70,0x61,0x63,0x65,0x4f,0x6e,0x55,0x73,
|
||||
0x65,0x22,0x3e,0xa,0x3c,0x73,0x74,0x6f,0x70,0x20,0x73,0x74,0x6f,0x70,0x2d,0x63,
|
||||
0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x23,0x42,0x38,0x42,0x34,0x42,0x34,0x22,0x2f,0x3e,
|
||||
0xa,0x3c,0x73,0x74,0x6f,0x70,0x20,0x6f,0x66,0x66,0x73,0x65,0x74,0x3d,0x22,0x31,
|
||||
0x22,0x20,0x73,0x74,0x6f,0x70,0x2d,0x63,0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x23,0x42,
|
||||
0x30,0x42,0x44,0x42,0x44,0x22,0x2f,0x3e,0xa,0x3c,0x2f,0x6c,0x69,0x6e,0x65,0x61,
|
||||
0x72,0x47,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,0x3e,0xa,0x3c,0x6c,0x69,0x6e,0x65,
|
||||
0x61,0x72,0x47,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,0x20,0x69,0x64,0x3d,0x22,0x70,
|
||||
0x61,0x69,0x6e,0x74,0x33,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x36,0x32,0x38,
|
||||
0x35,0x5f,0x31,0x38,0x36,0x37,0x33,0x32,0x22,0x20,0x78,0x31,0x3d,0x22,0x32,0x37,
|
||||
0x2e,0x30,0x31,0x39,0x31,0x22,0x20,0x79,0x31,0x3d,0x22,0x34,0x36,0x2e,0x39,0x32,
|
||||
0x32,0x35,0x22,0x20,0x78,0x32,0x3d,0x22,0x32,0x37,0x2e,0x31,0x31,0x32,0x33,0x22,
|
||||
0x20,0x79,0x32,0x3d,0x22,0x33,0x30,0x2e,0x37,0x37,0x38,0x33,0x22,0x20,0x67,0x72,
|
||||
0x61,0x64,0x69,0x65,0x6e,0x74,0x55,0x6e,0x69,0x74,0x73,0x3d,0x22,0x75,0x73,0x65,
|
||||
0x72,0x53,0x70,0x61,0x63,0x65,0x4f,0x6e,0x55,0x73,0x65,0x22,0x3e,0xa,0x3c,0x73,
|
||||
0x74,0x6f,0x70,0x20,0x73,0x74,0x6f,0x70,0x2d,0x63,0x6f,0x6c,0x6f,0x72,0x3d,0x22,
|
||||
0x23,0x42,0x38,0x42,0x34,0x42,0x34,0x22,0x2f,0x3e,0xa,0x3c,0x73,0x74,0x6f,0x70,
|
||||
0x20,0x6f,0x66,0x66,0x73,0x65,0x74,0x3d,0x22,0x31,0x22,0x20,0x73,0x74,0x6f,0x70,
|
||||
0x2d,0x63,0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x23,0x42,0x30,0x42,0x44,0x42,0x44,0x22,
|
||||
0x2f,0x3e,0xa,0x3c,0x2f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x47,0x72,0x61,0x64,0x69,
|
||||
0x65,0x6e,0x74,0x3e,0xa,0x3c,0x6c,0x69,0x6e,0x65,0x61,0x72,0x47,0x72,0x61,0x64,
|
||||
0x69,0x65,0x6e,0x74,0x20,0x69,0x64,0x3d,0x22,0x70,0x61,0x69,0x6e,0x74,0x34,0x5f,
|
||||
0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,0x36,0x37,
|
||||
0x33,0x32,0x22,0x20,0x78,0x31,0x3d,0x22,0x33,0x32,0x2e,0x37,0x31,0x30,0x35,0x22,
|
||||
0x20,0x79,0x31,0x3d,0x22,0x35,0x35,0x2e,0x31,0x35,0x39,0x36,0x22,0x20,0x78,0x32,
|
||||
0x3d,0x22,0x33,0x33,0x2e,0x31,0x36,0x39,0x36,0x22,0x20,0x79,0x32,0x3d,0x22,0x32,
|
||||
0x38,0x2e,0x31,0x36,0x37,0x38,0x22,0x20,0x67,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,
|
||||
0x55,0x6e,0x69,0x74,0x73,0x3d,0x22,0x75,0x73,0x65,0x72,0x53,0x70,0x61,0x63,0x65,
|
||||
0x4f,0x6e,0x55,0x73,0x65,0x22,0x3e,0xa,0x3c,0x73,0x74,0x6f,0x70,0x20,0x73,0x74,
|
||||
0x6f,0x70,0x2d,0x63,0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x23,0x36,0x41,0x36,0x41,0x36,
|
||||
0x41,0x22,0x2f,0x3e,0xa,0x3c,0x73,0x74,0x6f,0x70,0x20,0x6f,0x66,0x66,0x73,0x65,
|
||||
0x74,0x3d,0x22,0x31,0x22,0x20,0x73,0x74,0x6f,0x70,0x2d,0x63,0x6f,0x6c,0x6f,0x72,
|
||||
0x3d,0x22,0x23,0x44,0x34,0x44,0x34,0x44,0x34,0x22,0x2f,0x3e,0xa,0x3c,0x2f,0x6c,
|
||||
0x69,0x6e,0x65,0x61,0x72,0x47,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,0x3e,0xa,0x3c,
|
||||
0x6c,0x69,0x6e,0x65,0x61,0x72,0x47,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,0x20,0x69,
|
||||
0x64,0x3d,0x22,0x70,0x61,0x69,0x6e,0x74,0x35,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,
|
||||
0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,0x36,0x37,0x33,0x32,0x22,0x20,0x78,0x31,
|
||||
0x3d,0x22,0x32,0x33,0x2e,0x34,0x39,0x38,0x39,0x22,0x20,0x79,0x31,0x3d,0x22,0x33,
|
||||
0x37,0x2e,0x31,0x39,0x37,0x37,0x22,0x20,0x78,0x32,0x3d,0x22,0x31,0x39,0x2e,0x30,
|
||||
0x35,0x22,0x20,0x79,0x32,0x3d,0x22,0x33,0x34,0x2e,0x33,0x36,0x33,0x33,0x22,0x20,
|
||||
0x67,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,0x55,0x6e,0x69,0x74,0x73,0x3d,0x22,0x75,
|
||||
0x73,0x65,0x72,0x53,0x70,0x61,0x63,0x65,0x4f,0x6e,0x55,0x73,0x65,0x22,0x3e,0xa,
|
||||
0x3c,0x73,0x74,0x6f,0x70,0x20,0x73,0x74,0x6f,0x70,0x2d,0x63,0x6f,0x6c,0x6f,0x72,
|
||||
0x3d,0x22,0x23,0x36,0x41,0x36,0x41,0x36,0x41,0x22,0x2f,0x3e,0xa,0x3c,0x73,0x74,
|
||||
0x6f,0x70,0x20,0x6f,0x66,0x66,0x73,0x65,0x74,0x3d,0x22,0x31,0x22,0x20,0x73,0x74,
|
||||
0x6f,0x70,0x2d,0x63,0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x23,0x45,0x30,0x45,0x30,0x45,
|
||||
0x30,0x22,0x2f,0x3e,0xa,0x3c,0x2f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x47,0x72,0x61,
|
||||
0x64,0x69,0x65,0x6e,0x74,0x3e,0xa,0x3c,0x6c,0x69,0x6e,0x65,0x61,0x72,0x47,0x72,
|
||||
0x61,0x64,0x69,0x65,0x6e,0x74,0x20,0x69,0x64,0x3d,0x22,0x70,0x61,0x69,0x6e,0x74,
|
||||
0x36,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,
|
||||
0x36,0x37,0x33,0x32,0x22,0x20,0x78,0x31,0x3d,0x22,0x35,0x30,0x2e,0x35,0x32,0x32,
|
||||
0x34,0x22,0x20,0x79,0x31,0x3d,0x22,0x32,0x31,0x2e,0x36,0x36,0x38,0x33,0x22,0x20,
|
||||
0x78,0x32,0x3d,0x22,0x33,0x35,0x2e,0x35,0x36,0x32,0x37,0x22,0x20,0x79,0x32,0x3d,
|
||||
0x22,0x35,0x2e,0x35,0x38,0x36,0x31,0x34,0x22,0x20,0x67,0x72,0x61,0x64,0x69,0x65,
|
||||
0x6e,0x74,0x55,0x6e,0x69,0x74,0x73,0x3d,0x22,0x75,0x73,0x65,0x72,0x53,0x70,0x61,
|
||||
0x63,0x65,0x4f,0x6e,0x55,0x73,0x65,0x22,0x3e,0xa,0x3c,0x73,0x74,0x6f,0x70,0x20,
|
||||
0x73,0x74,0x6f,0x70,0x2d,0x63,0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x23,0x37,0x46,0x37,
|
||||
0x46,0x37,0x46,0x22,0x2f,0x3e,0xa,0x3c,0x73,0x74,0x6f,0x70,0x20,0x6f,0x66,0x66,
|
||||
0x73,0x65,0x74,0x3d,0x22,0x31,0x22,0x20,0x73,0x74,0x6f,0x70,0x2d,0x63,0x6f,0x6c,
|
||||
0x6f,0x72,0x3d,0x22,0x23,0x45,0x45,0x45,0x45,0x45,0x45,0x22,0x2f,0x3e,0xa,0x3c,
|
||||
0x2f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x47,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,0x3e,
|
||||
0xa,0x3c,0x6c,0x69,0x6e,0x65,0x61,0x72,0x47,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,
|
||||
0x20,0x69,0x64,0x3d,0x22,0x70,0x61,0x69,0x6e,0x74,0x37,0x5f,0x6c,0x69,0x6e,0x65,
|
||||
0x61,0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,0x36,0x37,0x33,0x32,0x22,0x20,
|
||||
0x78,0x31,0x3d,0x22,0x2d,0x31,0x2e,0x35,0x33,0x36,0x30,0x37,0x22,0x20,0x79,0x31,
|
||||
0x3d,0x22,0x36,0x30,0x2e,0x38,0x38,0x33,0x39,0x22,0x20,0x78,0x32,0x3d,0x22,0x31,
|
||||
0x35,0x2e,0x32,0x34,0x32,0x39,0x22,0x20,0x79,0x32,0x3d,0x22,0x34,0x37,0x2e,0x33,
|
||||
0x35,0x33,0x22,0x20,0x67,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,0x55,0x6e,0x69,0x74,
|
||||
0x73,0x3d,0x22,0x75,0x73,0x65,0x72,0x53,0x70,0x61,0x63,0x65,0x4f,0x6e,0x55,0x73,
|
||||
0x65,0x22,0x3e,0xa,0x3c,0x73,0x74,0x6f,0x70,0x20,0x73,0x74,0x6f,0x70,0x2d,0x63,
|
||||
0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x23,0x35,0x31,0x35,0x31,0x35,0x31,0x22,0x2f,0x3e,
|
||||
0xa,0x3c,0x73,0x74,0x6f,0x70,0x20,0x6f,0x66,0x66,0x73,0x65,0x74,0x3d,0x22,0x31,
|
||||
0x22,0x20,0x73,0x74,0x6f,0x70,0x2d,0x63,0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x23,0x38,
|
||||
0x33,0x38,0x33,0x38,0x33,0x22,0x2f,0x3e,0xa,0x3c,0x2f,0x6c,0x69,0x6e,0x65,0x61,
|
||||
0x72,0x47,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,0x3e,0xa,0x3c,0x6c,0x69,0x6e,0x65,
|
||||
0x61,0x72,0x47,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,0x20,0x69,0x64,0x3d,0x22,0x70,
|
||||
0x61,0x69,0x6e,0x74,0x38,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x5f,0x36,0x32,0x38,
|
||||
0x35,0x5f,0x31,0x38,0x36,0x37,0x33,0x32,0x22,0x20,0x78,0x31,0x3d,0x22,0x34,0x34,
|
||||
0x2e,0x38,0x39,0x33,0x31,0x22,0x20,0x79,0x31,0x3d,0x22,0x32,0x30,0x2e,0x39,0x36,
|
||||
0x22,0x20,0x78,0x32,0x3d,0x22,0x33,0x39,0x2e,0x33,0x34,0x35,0x34,0x22,0x20,0x79,
|
||||
0x32,0x3d,0x22,0x31,0x35,0x2e,0x33,0x34,0x39,0x33,0x22,0x20,0x67,0x72,0x61,0x64,
|
||||
0x69,0x65,0x6e,0x74,0x55,0x6e,0x69,0x74,0x73,0x3d,0x22,0x75,0x73,0x65,0x72,0x53,
|
||||
0x70,0x61,0x63,0x65,0x4f,0x6e,0x55,0x73,0x65,0x22,0x3e,0xa,0x3c,0x73,0x74,0x6f,
|
||||
0x70,0x20,0x73,0x74,0x6f,0x70,0x2d,0x63,0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x23,0x45,
|
||||
0x45,0x45,0x45,0x45,0x45,0x22,0x2f,0x3e,0xa,0x3c,0x73,0x74,0x6f,0x70,0x20,0x6f,
|
||||
0x66,0x66,0x73,0x65,0x74,0x3d,0x22,0x31,0x22,0x20,0x73,0x74,0x6f,0x70,0x2d,0x63,
|
||||
0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x23,0x36,0x41,0x36,0x41,0x36,0x41,0x22,0x2f,0x3e,
|
||||
0xa,0x3c,0x2f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x47,0x72,0x61,0x64,0x69,0x65,0x6e,
|
||||
0x74,0x3e,0xa,0x3c,0x6c,0x69,0x6e,0x65,0x61,0x72,0x47,0x72,0x61,0x64,0x69,0x65,
|
||||
0x6e,0x74,0x20,0x69,0x64,0x3d,0x22,0x70,0x61,0x69,0x6e,0x74,0x39,0x5f,0x6c,0x69,
|
||||
0x6e,0x65,0x61,0x72,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,0x36,0x37,0x33,0x32,
|
||||
0x22,0x20,0x78,0x31,0x3d,0x22,0x34,0x39,0x2e,0x33,0x30,0x37,0x38,0x22,0x20,0x79,
|
||||
0x31,0x3d,0x22,0x32,0x37,0x2e,0x30,0x31,0x39,0x37,0x22,0x20,0x78,0x32,0x3d,0x22,
|
||||
0x34,0x37,0x2e,0x34,0x36,0x31,0x37,0x22,0x20,0x79,0x32,0x3d,0x22,0x31,0x33,0x2e,
|
||||
0x33,0x30,0x39,0x33,0x22,0x20,0x67,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,0x55,0x6e,
|
||||
0x69,0x74,0x73,0x3d,0x22,0x75,0x73,0x65,0x72,0x53,0x70,0x61,0x63,0x65,0x4f,0x6e,
|
||||
0x55,0x73,0x65,0x22,0x3e,0xa,0x3c,0x73,0x74,0x6f,0x70,0x20,0x6f,0x66,0x66,0x73,
|
||||
0x65,0x74,0x3d,0x22,0x30,0x2e,0x30,0x34,0x38,0x22,0x20,0x73,0x74,0x6f,0x70,0x2d,
|
||||
0x63,0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x77,0x68,0x69,0x74,0x65,0x22,0x20,0x73,0x74,
|
||||
0x6f,0x70,0x2d,0x6f,0x70,0x61,0x63,0x69,0x74,0x79,0x3d,0x22,0x30,0x2e,0x30,0x31,
|
||||
0x22,0x2f,0x3e,0xa,0x3c,0x73,0x74,0x6f,0x70,0x20,0x6f,0x66,0x66,0x73,0x65,0x74,
|
||||
0x3d,0x22,0x30,0x2e,0x39,0x39,0x34,0x22,0x20,0x73,0x74,0x6f,0x70,0x2d,0x63,0x6f,
|
||||
0x6c,0x6f,0x72,0x3d,0x22,0x77,0x68,0x69,0x74,0x65,0x22,0x20,0x73,0x74,0x6f,0x70,
|
||||
0x2d,0x6f,0x70,0x61,0x63,0x69,0x74,0x79,0x3d,0x22,0x30,0x2e,0x35,0x22,0x2f,0x3e,
|
||||
0xa,0x3c,0x2f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x47,0x72,0x61,0x64,0x69,0x65,0x6e,
|
||||
0x74,0x3e,0xa,0x3c,0x72,0x61,0x64,0x69,0x61,0x6c,0x47,0x72,0x61,0x64,0x69,0x65,
|
||||
0x6e,0x74,0x20,0x69,0x64,0x3d,0x22,0x70,0x61,0x69,0x6e,0x74,0x31,0x30,0x5f,0x72,
|
||||
0x61,0x64,0x69,0x61,0x6c,0x5f,0x36,0x32,0x38,0x35,0x5f,0x31,0x38,0x36,0x37,0x33,
|
||||
0x32,0x22,0x20,0x63,0x78,0x3d,0x22,0x30,0x22,0x20,0x63,0x79,0x3d,0x22,0x30,0x22,
|
||||
0x20,0x72,0x3d,0x22,0x31,0x22,0x20,0x67,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,0x55,
|
||||
0x6e,0x69,0x74,0x73,0x3d,0x22,0x75,0x73,0x65,0x72,0x53,0x70,0x61,0x63,0x65,0x4f,
|
||||
0x6e,0x55,0x73,0x65,0x22,0x20,0x67,0x72,0x61,0x64,0x69,0x65,0x6e,0x74,0x54,0x72,
|
||||
0x61,0x6e,0x73,0x66,0x6f,0x72,0x6d,0x3d,0x22,0x74,0x72,0x61,0x6e,0x73,0x6c,0x61,
|
||||
0x74,0x65,0x28,0x34,0x31,0x2e,0x38,0x30,0x35,0x38,0x20,0x32,0x33,0x2e,0x34,0x35,
|
||||
0x33,0x29,0x20,0x72,0x6f,0x74,0x61,0x74,0x65,0x28,0x31,0x33,0x32,0x2e,0x39,0x36,
|
||||
0x37,0x29,0x20,0x73,0x63,0x61,0x6c,0x65,0x28,0x31,0x2e,0x35,0x31,0x35,0x37,0x33,
|
||||
0x20,0x31,0x2e,0x35,0x31,0x32,0x32,0x29,0x22,0x3e,0xa,0x3c,0x73,0x74,0x6f,0x70,
|
||||
0x20,0x73,0x74,0x6f,0x70,0x2d,0x63,0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x77,0x68,0x69,
|
||||
0x74,0x65,0x22,0x2f,0x3e,0xa,0x3c,0x73,0x74,0x6f,0x70,0x20,0x6f,0x66,0x66,0x73,
|
||||
0x65,0x74,0x3d,0x22,0x30,0x2e,0x39,0x39,0x39,0x22,0x20,0x73,0x74,0x6f,0x70,0x2d,
|
||||
0x63,0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x77,0x68,0x69,0x74,0x65,0x22,0x20,0x73,0x74,
|
||||
0x6f,0x70,0x2d,0x6f,0x70,0x61,0x63,0x69,0x74,0x79,0x3d,0x22,0x30,0x2e,0x30,0x31,
|
||||
0x22,0x2f,0x3e,0xa,0x3c,0x2f,0x72,0x61,0x64,0x69,0x61,0x6c,0x47,0x72,0x61,0x64,
|
||||
0x69,0x65,0x6e,0x74,0x3e,0xa,0x3c,0x2f,0x64,0x65,0x66,0x73,0x3e,0xa,0x3c,0x2f,
|
||||
0x73,0x76,0x67,0x3e,0xa,
|
||||
|
||||
};
|
||||
|
||||
static const unsigned char qt_resource_name[] = {
|
||||
// authorize.svg
|
||||
0x0,0xd,
|
||||
0x0,0x95,0xb6,0x47,
|
||||
0x0,0x61,
|
||||
0x0,0x75,0x0,0x74,0x0,0x68,0x0,0x6f,0x0,0x72,0x0,0x69,0x0,0x7a,0x0,0x65,0x0,0x2e,0x0,0x73,0x0,0x76,0x0,0x67,
|
||||
|
||||
};
|
||||
|
||||
static const unsigned char qt_resource_struct[] = {
|
||||
// :
|
||||
0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x1,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
// :/authorize.svg
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x1,0x80,0xdf,0x58,0x2d,0xf4,
|
||||
|
||||
};
|
||||
|
||||
#ifdef QT_NAMESPACE
|
||||
# define QT_RCC_PREPEND_NAMESPACE(name) ::QT_NAMESPACE::name
|
||||
# define QT_RCC_MANGLE_NAMESPACE0(x) x
|
||||
# define QT_RCC_MANGLE_NAMESPACE1(a, b) a##_##b
|
||||
# define QT_RCC_MANGLE_NAMESPACE2(a, b) QT_RCC_MANGLE_NAMESPACE1(a,b)
|
||||
# define QT_RCC_MANGLE_NAMESPACE(name) QT_RCC_MANGLE_NAMESPACE2( \
|
||||
QT_RCC_MANGLE_NAMESPACE0(name), QT_RCC_MANGLE_NAMESPACE0(QT_NAMESPACE))
|
||||
#else
|
||||
# define QT_RCC_PREPEND_NAMESPACE(name) name
|
||||
# define QT_RCC_MANGLE_NAMESPACE(name) name
|
||||
#endif
|
||||
|
||||
#ifdef QT_NAMESPACE
|
||||
namespace QT_NAMESPACE {
|
||||
#endif
|
||||
|
||||
bool qRegisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *);
|
||||
|
||||
bool qUnregisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *);
|
||||
|
||||
#ifdef QT_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
|
||||
int QT_RCC_MANGLE_NAMESPACE(qInitResources_svg)();
|
||||
int QT_RCC_MANGLE_NAMESPACE(qInitResources_svg)()
|
||||
{
|
||||
QT_RCC_PREPEND_NAMESPACE(qRegisterResourceData)
|
||||
(0x2, qt_resource_struct, qt_resource_name, qt_resource_data);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int QT_RCC_MANGLE_NAMESPACE(qCleanupResources_svg)();
|
||||
int QT_RCC_MANGLE_NAMESPACE(qCleanupResources_svg)()
|
||||
{
|
||||
QT_RCC_PREPEND_NAMESPACE(qUnregisterResourceData)
|
||||
(0x2, qt_resource_struct, qt_resource_name, qt_resource_data);
|
||||
return 1;
|
||||
}
|
||||
|
||||
namespace {
|
||||
struct initializer {
|
||||
initializer() { QT_RCC_MANGLE_NAMESPACE(qInitResources_svg)(); }
|
||||
~initializer() { QT_RCC_MANGLE_NAMESPACE(qCleanupResources_svg)(); }
|
||||
} dummy;
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>authorize.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
|
@ -0,0 +1,75 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="bo_CN">
|
||||
<context>
|
||||
<name>KyPasswordDialog</name>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="57"/>
|
||||
<source>Kylin NM</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="60"/>
|
||||
<source>kylin network desktop message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="130"/>
|
||||
<source>Wi-Fi authentication required</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="138"/>
|
||||
<source>Access wireless networks</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="140"/>
|
||||
<source>needs password or encryption key</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="185"/>
|
||||
<source>user name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="202"/>
|
||||
<source>Connect</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="208"/>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="228"/>
|
||||
<source>password error!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="230"/>
|
||||
<source>username or password error!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="146"/>
|
||||
<source>password</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>KylinSecretAgent</name>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinsecretagent.cpp" line="454"/>
|
||||
<source>userAndPwd</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinsecretagent.cpp" line="513"/>
|
||||
<source>tls</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
|
@ -0,0 +1,75 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="tr_TR">
|
||||
<context>
|
||||
<name>KyPasswordDialog</name>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="57"/>
|
||||
<source>Kylin NM</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="60"/>
|
||||
<source>kylin network desktop message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="130"/>
|
||||
<source>Wi-Fi authentication required</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="138"/>
|
||||
<source>Access wireless networks</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="140"/>
|
||||
<source>needs password or encryption key</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="185"/>
|
||||
<source>user name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="202"/>
|
||||
<source>Connect</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="208"/>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="228"/>
|
||||
<source>password error!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="230"/>
|
||||
<source>username or password error!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="146"/>
|
||||
<source>password</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>KylinSecretAgent</name>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinsecretagent.cpp" line="454"/>
|
||||
<source>userAndPwd</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinsecretagent.cpp" line="513"/>
|
||||
<source>tls</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
Binary file not shown.
|
@ -0,0 +1,83 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="zh_CN">
|
||||
<context>
|
||||
<name>KyPasswordDialog</name>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="57"/>
|
||||
<source>Kylin NM</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="60"/>
|
||||
<source>kylin network desktop message</source>
|
||||
<translation>网络提示信息</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="130"/>
|
||||
<source>Wi-Fi authentication required</source>
|
||||
<translation>此无线网络需要密码认证</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="138"/>
|
||||
<source>Access wireless networks</source>
|
||||
<translation>访问无线网络</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="140"/>
|
||||
<source>needs password or encryption key</source>
|
||||
<translation>需要密码或加密秘钥</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="185"/>
|
||||
<source>user name</source>
|
||||
<translation>用户名</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="202"/>
|
||||
<source>Connect</source>
|
||||
<translation>连接</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="208"/>
|
||||
<source>Cancel</source>
|
||||
<translation>取消</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="228"/>
|
||||
<source>password error!</source>
|
||||
<translation>密码错误!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="230"/>
|
||||
<source>username or password error!</source>
|
||||
<translation>用户名或密码错误!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>WiFi </source>
|
||||
<translation type="vanished">访问无线网络</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> needs password</source>
|
||||
<translation type="vanished">需要密码或加密秘钥</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinpassworddialog.cpp" line="146"/>
|
||||
<source>password</source>
|
||||
<translation>密码</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>KylinSecretAgent</name>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinsecretagent.cpp" line="454"/>
|
||||
<source>userAndPwd</source>
|
||||
<translation>用户名和密码</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../kylin-agent/kylinsecretagent.cpp" line="513"/>
|
||||
<source>tls</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
|
@ -0,0 +1,5 @@
|
|||
TEMPLATE = subdirs
|
||||
|
||||
SUBDIRS += \
|
||||
kylin-nm-main \
|
||||
# kylin-nm-simple
|
|
@ -0,0 +1,152 @@
|
|||
#include "customstyle.h"
|
||||
|
||||
CustomStyle::CustomStyle(const QString &proxyStyleName) : QProxyStyle (proxyStyleName)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QSize CustomStyle::sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget) const
|
||||
{
|
||||
switch (type) {
|
||||
case CT_TabBarTab: {
|
||||
QSize size(0,40);
|
||||
if (const QStyleOptionTab *tab= qstyleoption_cast<const QStyleOptionTab *>(option)) {
|
||||
switch (tab->shape) {
|
||||
case QTabBar::RoundedNorth:
|
||||
case QTabBar::RoundedSouth: {
|
||||
return size + QSize(50,0);
|
||||
break;
|
||||
}
|
||||
case QTabBar::RoundedWest:
|
||||
case QTabBar::RoundedEast: {
|
||||
return size + QSize(0,50);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return size;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return QProxyStyle::sizeFromContents(type, option, contentsSize, widget);
|
||||
}
|
||||
void CustomStyle::drawControl(QStyle::ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
|
||||
{
|
||||
// switch (element) {
|
||||
// case CE_TabBarTab: {
|
||||
// if (QStyle::State_Selected != option->state) {
|
||||
// painter->save();
|
||||
// painter->setBrush(QColor(0,0,0,0));
|
||||
// painter->drawRect(widget->rect());
|
||||
//// painter->setOpacity(0.1);
|
||||
// painter->restore();
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// default: {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
return QProxyStyle::drawControl(element, option, painter, widget);
|
||||
}
|
||||
|
||||
//void CustomStyle::drawComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const
|
||||
//{
|
||||
// return QProxyStyle::drawComplexControl(control, option, painter, widget);
|
||||
//}
|
||||
|
||||
//void CustomStyle::drawItemPixmap(QPainter *painter, const QRect &rectangle, int alignment, const QPixmap &pixmap) const
|
||||
//{
|
||||
// return QProxyStyle::drawItemPixmap(painter, rectangle, alignment, pixmap);
|
||||
//}
|
||||
|
||||
//void CustomStyle::drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, bool enabled, const QString &text, QPalette::ColorRole textRole) const
|
||||
//{
|
||||
// return QProxyStyle::drawItemText(painter, rectangle, alignment, palette, enabled, text, textRole);
|
||||
//}
|
||||
|
||||
//void CustomStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
|
||||
//{
|
||||
// return QProxyStyle::drawPrimitive(element, option, painter, widget);
|
||||
//}
|
||||
|
||||
//QPixmap CustomStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const
|
||||
//{
|
||||
// return QProxyStyle::generatedIconPixmap(iconMode, pixmap, option);
|
||||
//}
|
||||
|
||||
//QStyle::SubControl CustomStyle::hitTestComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, const QPoint &position, const QWidget *widget) const
|
||||
//{
|
||||
// return QProxyStyle::hitTestComplexControl(control, option, position, widget);
|
||||
//}
|
||||
|
||||
//QRect CustomStyle::itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const
|
||||
//{
|
||||
// return QProxyStyle::itemPixmapRect(rectangle, alignment, pixmap);
|
||||
//}
|
||||
|
||||
//QRect CustomStyle::itemTextRect(const QFontMetrics &metrics, const QRect &rectangle, int alignment, bool enabled, const QString &text) const
|
||||
//{
|
||||
// return QProxyStyle::itemTextRect(metrics, rectangle, alignment, enabled, text);
|
||||
//}
|
||||
|
||||
//int CustomStyle::pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option, const QWidget *widget) const
|
||||
//{
|
||||
// return QProxyStyle::pixelMetric(metric, option, widget);
|
||||
//}
|
||||
|
||||
//void CustomStyle::polish(QWidget *widget)
|
||||
//{
|
||||
// return QProxyStyle::polish(widget);
|
||||
//}
|
||||
|
||||
//void CustomStyle::polish(QApplication *application)
|
||||
//{
|
||||
// return QProxyStyle::polish(application);
|
||||
//}
|
||||
|
||||
//void CustomStyle::polish(QPalette &palette)
|
||||
//{
|
||||
// return QProxyStyle::polish(palette);
|
||||
//}
|
||||
|
||||
//void CustomStyle::unpolish(QWidget *widget)
|
||||
//{
|
||||
// return QProxyStyle::unpolish(widget);
|
||||
//}
|
||||
|
||||
//void CustomStyle::unpolish(QApplication *application)
|
||||
//{
|
||||
// return QProxyStyle::unpolish(application);
|
||||
//}
|
||||
|
||||
//QIcon CustomStyle::standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const
|
||||
//{
|
||||
// return QProxyStyle::standardIcon(standardIcon, option, widget);
|
||||
//}
|
||||
|
||||
//QPalette CustomStyle::standardPalette() const
|
||||
//{
|
||||
// return QProxyStyle::standardPalette();
|
||||
//}
|
||||
|
||||
//int CustomStyle::styleHint(QStyle::StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const
|
||||
//{
|
||||
// return QProxyStyle::styleHint(hint, option, widget, returnData);
|
||||
//}
|
||||
|
||||
//QRect CustomStyle::subControlRect(QStyle::ComplexControl control, const QStyleOptionComplex *option, QStyle::SubControl subControl, const QWidget *widget) const
|
||||
//{
|
||||
// return QProxyStyle::subControlRect(control, option, subControl, widget);
|
||||
//}
|
||||
|
||||
//QRect CustomStyle::subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget) const
|
||||
//{
|
||||
// return QProxyStyle::subElementRect(element, option, widget);
|
||||
//}
|
|
@ -0,0 +1,47 @@
|
|||
#ifndef CUSTOMSTYLE_H
|
||||
#define CUSTOMSTYLE_H
|
||||
|
||||
#include <QStyle>
|
||||
#include <QProxyStyle>
|
||||
#include <QStyleFactory>
|
||||
#include <QWidget>
|
||||
#include <QPainter>
|
||||
#include <QPainterPath>
|
||||
#include <QStyleOptionSlider>
|
||||
|
||||
class CustomStyle : public QProxyStyle
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CustomStyle(const QString &proxyStyleName = "windows");
|
||||
~CustomStyle() = default;
|
||||
virtual QSize sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget = nullptr) const;
|
||||
virtual void drawControl(QStyle::ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const;
|
||||
// virtual void drawComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = nullptr) const;
|
||||
|
||||
// virtual void drawItemPixmap(QPainter *painter, const QRect &rectangle, int alignment, const QPixmap &pixmap) const;
|
||||
// virtual void drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, bool enabled, const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const;
|
||||
|
||||
// virtual void drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const;
|
||||
// virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const;
|
||||
// virtual QStyle::SubControl hitTestComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, const QPoint &position, const QWidget *widget = nullptr) const;
|
||||
// virtual QRect itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const;
|
||||
// virtual QRect itemTextRect(const QFontMetrics &metrics, const QRect &rectangle, int alignment, bool enabled, const QString &text) const;
|
||||
// //virtual int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option, const QWidget *widget);
|
||||
// virtual int pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const;
|
||||
|
||||
// virtual void polish(QWidget *widget);
|
||||
// virtual void polish(QApplication *application);
|
||||
// virtual void polish(QPalette &palette);
|
||||
// virtual void unpolish(QWidget *widget);
|
||||
// virtual void unpolish(QApplication *application);
|
||||
|
||||
// virtual QIcon standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const;
|
||||
// virtual QPalette standardPalette() const;
|
||||
|
||||
// virtual int styleHint(QStyle::StyleHint hint, const QStyleOption *option = nullptr, const QWidget *widget = nullptr, QStyleHintReturn *returnData = nullptr) const;
|
||||
// virtual QRect subControlRect(QStyle::ComplexControl control, const QStyleOptionComplex *option, QStyle::SubControl subControl, const QWidget *widget = nullptr) const;
|
||||
// virtual QRect subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget = nullptr) const;
|
||||
};
|
||||
|
||||
#endif // CUSTOMSTYLE_H
|
|
@ -0,0 +1,9 @@
|
|||
INCLUDEPATH += $$PWD
|
||||
|
||||
FORMS += \
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/enterprisewlandialog.h \
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/enterprisewlandialog.cpp \
|
|
@ -0,0 +1,217 @@
|
|||
#include "enterprisewlandialog.h"
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QGSettings>
|
||||
|
||||
#include "xatom-helper.h"
|
||||
#define MAIN_SIZE_EXPAND 400,500
|
||||
#define MAIN_SIZE_NARROW 400,400
|
||||
|
||||
#define THEME_SCHAME "org.ukui.style"
|
||||
#define COLOR_THEME "styleName"
|
||||
|
||||
EnterpriseWlanDialog::EnterpriseWlanDialog(KyWirelessNetItem &wirelessNetItem, QString device, QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
//设置窗口无边框,阴影
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
||||
MotifWmHints window_hints;
|
||||
window_hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
|
||||
window_hints.functions = MWM_FUNC_ALL;
|
||||
window_hints.decorations = MWM_DECOR_BORDER;
|
||||
XAtomHelper::getInstance()->setWindowMotifHint(this->winId(), window_hints);
|
||||
#else
|
||||
this->setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint);
|
||||
#endif
|
||||
this->setAttribute(Qt::WA_DeleteOnClose);
|
||||
this->setWindowFlag(Qt::Window);
|
||||
this->setWindowTitle(tr("Connect Enterprise WLAN"));
|
||||
|
||||
m_wirelessNetItem = wirelessNetItem;
|
||||
m_deviceName = device;
|
||||
m_connectOperation = new KyWirelessConnectOperation();
|
||||
m_resource = new KyWirelessNetResource();
|
||||
|
||||
initUI();
|
||||
initData();
|
||||
centerToScreen();
|
||||
}
|
||||
|
||||
EnterpriseWlanDialog::~EnterpriseWlanDialog() {
|
||||
if (m_securityPage) {
|
||||
delete m_securityPage;
|
||||
m_securityPage = nullptr;
|
||||
}
|
||||
if (m_connectOperation) {
|
||||
delete m_connectOperation;
|
||||
m_connectOperation = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void EnterpriseWlanDialog::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
Q_EMIT this->enterpriseWlanDialogClose(false);
|
||||
return QWidget::closeEvent(event);
|
||||
|
||||
}
|
||||
|
||||
void EnterpriseWlanDialog::initUI()
|
||||
{
|
||||
#define MAIN_LAYOUT_MARGINS 8,8,8,8
|
||||
#define SSID_LAYOUT_MARGINS 8,8,8,0
|
||||
#define MAIN_LAYOUT_SPACING 0
|
||||
#define BUTTON_SPACING 8
|
||||
|
||||
m_mainLayout = new QVBoxLayout(this);
|
||||
this->setLayout(m_mainLayout);
|
||||
m_mainLayout->setContentsMargins(MAIN_LAYOUT_MARGINS);
|
||||
m_mainLayout->setSpacing(MAIN_LAYOUT_SPACING);
|
||||
|
||||
m_ssidLayout = new QHBoxLayout();
|
||||
m_ssidLayout->setContentsMargins(SSID_LAYOUT_MARGINS);
|
||||
m_ssidTitleLabel = new QLabel(this);
|
||||
m_ssidTitleLabel->setText("SSID");
|
||||
m_ssidLabel = new QLabel(this);
|
||||
m_ssidLabel->setText(m_wirelessNetItem.m_NetSsid);
|
||||
|
||||
m_ssidLayout->addWidget(m_ssidTitleLabel);
|
||||
m_ssidLayout->addStretch();
|
||||
m_ssidLayout->addWidget(m_ssidLabel);
|
||||
|
||||
m_securityPage = new SecurityPage(this);
|
||||
m_securityPage->setSecurity(KySecuType::WPA_AND_WPA2_ENTERPRISE);
|
||||
m_securityPage->setSecurityVisible(false);
|
||||
|
||||
m_btnLayout = new QHBoxLayout();
|
||||
m_btnLayout->setSpacing(BUTTON_SPACING);
|
||||
m_cancelBtn = new QPushButton(this);
|
||||
m_connectBtn = new QPushButton(this);
|
||||
m_cancelBtn->setText(tr("Cancel"));
|
||||
m_connectBtn->setText(tr("Connect"));
|
||||
m_connectBtn->setEnabled(false);
|
||||
m_btnLayout->addStretch();
|
||||
m_btnLayout->addWidget(m_cancelBtn);
|
||||
m_btnLayout->addWidget(m_connectBtn);
|
||||
m_mainLayout->addLayout(m_ssidLayout);
|
||||
m_mainLayout->addWidget(m_securityPage);
|
||||
m_mainLayout->addLayout(m_btnLayout);
|
||||
m_mainLayout->addStretch();
|
||||
|
||||
this->setFixedSize(MAIN_SIZE_EXPAND);
|
||||
initConnections();
|
||||
onPaletteChanged();
|
||||
}
|
||||
|
||||
void EnterpriseWlanDialog::centerToScreen()
|
||||
{
|
||||
QDesktopWidget* m = QApplication::desktop();
|
||||
QRect desk_rect = m->screenGeometry(m->screenNumber(QCursor::pos()));
|
||||
int desk_x = desk_rect.width();
|
||||
int desk_y = desk_rect.height();
|
||||
int x = this->width();
|
||||
int y = this->height();
|
||||
this->move(desk_x / 2 - x / 2 + desk_rect.left(), desk_y / 2 - y / 2 + desk_rect.top());
|
||||
}
|
||||
|
||||
void EnterpriseWlanDialog::initConnections()
|
||||
{
|
||||
connect(m_closeBtn, &QPushButton::clicked, this, &EnterpriseWlanDialog::close);
|
||||
connect(m_cancelBtn, &QPushButton::clicked, this, &EnterpriseWlanDialog::close);
|
||||
connect(m_connectBtn, &QPushButton::clicked, this, &EnterpriseWlanDialog::onBtnConnectClicked);
|
||||
connect(m_securityPage, &SecurityPage::eapTypeChanged, this, &EnterpriseWlanDialog::onEapTypeChanged);
|
||||
connect(m_securityPage, &SecurityPage::setSecuPageState, this, [ = ](bool status) {
|
||||
m_connectBtn->setEnabled(status);
|
||||
});
|
||||
|
||||
connect(qApp, &QApplication::paletteChanged, this, &EnterpriseWlanDialog::onPaletteChanged);
|
||||
}
|
||||
|
||||
void EnterpriseWlanDialog::onPaletteChanged()
|
||||
{
|
||||
QPalette pal = qApp->palette();
|
||||
|
||||
QGSettings * styleGsettings = nullptr;
|
||||
const QByteArray style_id(THEME_SCHAME);
|
||||
if (QGSettings::isSchemaInstalled(style_id)) {
|
||||
styleGsettings = new QGSettings(style_id);
|
||||
QString currentTheme = styleGsettings->get(COLOR_THEME).toString();
|
||||
if(currentTheme == "ukui-default"){
|
||||
pal = lightPalette(this);
|
||||
}
|
||||
}
|
||||
|
||||
this->setPalette(pal);
|
||||
|
||||
setFramePalette(m_securityPage, pal);
|
||||
}
|
||||
|
||||
void EnterpriseWlanDialog::initData()
|
||||
{
|
||||
if (m_wirelessNetItem.m_isConfigured) {
|
||||
KyEapMethodType type;
|
||||
m_connectOperation->getEnterpiseEapMethod(m_wirelessNetItem.m_connectUuid, type);
|
||||
if (type) {
|
||||
onEapTypeChanged(type);
|
||||
} else {
|
||||
qWarning() << "Get eap type failed!" << Q_FUNC_INFO << __LINE__;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnterpriseWlanDialog::onBtnConnectClicked()
|
||||
{
|
||||
qDebug() << "Clicked connectBtn, will connect enterprise WLAN, ssid = "
|
||||
<< m_wirelessNetItem.m_NetSsid << "." << Q_FUNC_INFO << __LINE__;
|
||||
KySecuType secuType;
|
||||
KyEapMethodType eapType;
|
||||
m_securityPage->getSecuType(secuType, eapType);
|
||||
|
||||
KyWirelessConnectSetting connetSetting;
|
||||
connetSetting.setConnectName(m_wirelessNetItem.m_NetSsid);
|
||||
connetSetting.setIfaceName(m_deviceName);
|
||||
connetSetting.isAutoConnect = true; //ZJP_TODO 自动连接选项
|
||||
connetSetting.m_type = KyKeyMgmt::WpaEap;
|
||||
connetSetting.m_ssid = m_wirelessNetItem.m_NetSsid;
|
||||
connetSetting.m_secretFlag = 0;
|
||||
connetSetting.dumpInfo();
|
||||
|
||||
if (eapType == KyEapMethodType::TLS) {
|
||||
m_info.tlsInfo.devIfaceName = m_deviceName;
|
||||
m_securityPage->updateTlsChange(m_info.tlsInfo);
|
||||
m_connectOperation->addAndActiveWirelessEnterPriseTlsConnect(m_info.tlsInfo, connetSetting, m_deviceName, false);
|
||||
} else if (eapType == KyEapMethodType::PEAP) {
|
||||
m_securityPage->updatePeapChange(m_info.peapInfo);
|
||||
m_connectOperation->addAndActiveWirelessEnterPrisePeapConnect(m_info.peapInfo, connetSetting, m_deviceName, false);
|
||||
} else if (eapType == KyEapMethodType::TTLS) {
|
||||
m_securityPage->updateTtlsChange(m_info.ttlsInfo);
|
||||
m_connectOperation->addAndActiveWirelessEnterPriseTtlsConnect(m_info.ttlsInfo, connetSetting, m_deviceName, false);
|
||||
} else {
|
||||
qWarning() << "Connect enterprise wlan failed!(Unknown eap type)" << Q_FUNC_INFO << __LINE__;
|
||||
}
|
||||
close();
|
||||
}
|
||||
|
||||
void EnterpriseWlanDialog::onEapTypeChanged(const KyEapMethodType &type)
|
||||
{
|
||||
switch (type) {
|
||||
case KyEapMethodType::TLS:
|
||||
if (!m_wirelessNetItem.m_connectUuid.isEmpty()) {
|
||||
m_resource->getEnterPriseInfoTls(m_wirelessNetItem.m_connectUuid, m_info.tlsInfo);
|
||||
}
|
||||
this->setFixedSize(MAIN_SIZE_EXPAND);
|
||||
break;
|
||||
case KyEapMethodType::PEAP:
|
||||
if (m_wirelessNetItem.m_connectUuid.isEmpty()) {
|
||||
m_resource->getEnterPriseInfoPeap(m_wirelessNetItem.m_connectUuid, m_info.peapInfo);
|
||||
}
|
||||
this->setFixedSize(MAIN_SIZE_NARROW);
|
||||
break;
|
||||
case KyEapMethodType::TTLS:
|
||||
if (!m_wirelessNetItem.m_connectUuid.isEmpty()) {
|
||||
m_resource->getEnterPriseInfoTtls(m_wirelessNetItem.m_connectUuid, m_info.ttlsInfo);
|
||||
}
|
||||
this->setFixedSize(MAIN_SIZE_NARROW);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
#ifndef ENTERPRISEWLANDIALOG_H
|
||||
#define ENTERPRISEWLANDIALOG_H
|
||||
#include <QDialog>
|
||||
#include <QPushButton>
|
||||
#include "securitypage.h"
|
||||
#include "kywirelessnetitem.h"
|
||||
#include "coninfo.h"
|
||||
|
||||
class EnterpriseWlanDialog : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
EnterpriseWlanDialog(KyWirelessNetItem &wirelessNetItem, QString device, QWidget *parent = nullptr);
|
||||
~EnterpriseWlanDialog();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
|
||||
private:
|
||||
void initUI(); //初始化UI界面
|
||||
void centerToScreen();
|
||||
void initConnections();
|
||||
void initData();
|
||||
|
||||
private:
|
||||
KyWirelessNetItem m_wirelessNetItem;
|
||||
ConInfo m_info;
|
||||
QString m_deviceName;
|
||||
KyWirelessConnectOperation *m_connectOperation = nullptr;
|
||||
KyWirelessNetResource *m_resource = nullptr;
|
||||
|
||||
/* 弹窗布局
|
||||
* Connect Enterprise WLAN············X
|
||||
* SSID··························[SSID]
|
||||
* -----------SecurityPage-------------
|
||||
* | |
|
||||
* ------------------------------------
|
||||
* ····················CANCEL···CONNECT
|
||||
*/
|
||||
QVBoxLayout *m_mainLayout = nullptr;
|
||||
|
||||
QHBoxLayout *m_titleLayout = nullptr;
|
||||
QLabel *m_titleLabel = nullptr;
|
||||
QPushButton *m_closeBtn = nullptr;
|
||||
|
||||
QHBoxLayout *m_ssidLayout = nullptr;
|
||||
QLabel *m_ssidTitleLabel = nullptr;
|
||||
QLabel *m_ssidLabel = nullptr;
|
||||
|
||||
SecurityPage *m_securityPage = nullptr;
|
||||
|
||||
QHBoxLayout *m_btnLayout = nullptr;
|
||||
QPushButton *m_cancelBtn = nullptr;
|
||||
QPushButton *m_connectBtn = nullptr;
|
||||
|
||||
private Q_SLOTS:
|
||||
void onBtnConnectClicked();
|
||||
void onEapTypeChanged(const KyEapMethodType &type);
|
||||
void onPaletteChanged();
|
||||
|
||||
Q_SIGNALS:
|
||||
void enterpriseWlanDialogClose(bool);
|
||||
};
|
||||
|
||||
#endif // ENTERPRISEWLANDIALOG_H
|
|
@ -0,0 +1,18 @@
|
|||
INCLUDEPATH += $$PWD
|
||||
include(tools/tools.pri)
|
||||
include(xatom/xatom.pri)
|
||||
include(tab-pages/tab-pages.pri)
|
||||
include(list-items/list-items.pri)
|
||||
include(netdetails/netdetails.pri)
|
||||
include(enterprise-wlan/enterprise-wlan.pri)
|
||||
|
||||
FORMS += \
|
||||
$$PWD/wificonfigdialog.ui
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/customstyle.h \
|
||||
$$PWD/mainwindow.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/customstyle.cpp \
|
||||
$$PWD/mainwindow.cpp
|
|
@ -0,0 +1,218 @@
|
|||
#include "lanlistitem.h"
|
||||
#include "kylinconnectitem.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#define LOG_FLAG "[LanListItem]"
|
||||
|
||||
LanListItem::LanListItem(const KyConnectItem *lanConnectItem,
|
||||
const QString &deviceName, QWidget *parent):ListItem(parent)
|
||||
{
|
||||
m_connectOperation = new KyWiredConnectOperation(this);
|
||||
m_deviceResource = new KyNetworkDeviceResourse(this);
|
||||
|
||||
connectItemCopy(lanConnectItem);
|
||||
m_deviceName = deviceName;
|
||||
|
||||
m_nameLabel->setText(m_lanConnectItem.m_connectName);
|
||||
m_netButton->setButtonIcon(QIcon::fromTheme("network-wired-connected-symbolic"));
|
||||
|
||||
qDebug() << "LanListItem init:" << m_lanConnectItem.m_connectName << m_lanConnectItem.m_connectState << m_lanConnectItem.m_ifaceName;
|
||||
|
||||
if (CONNECT_STATE_DEACTIVATED == m_lanConnectItem.m_connectState
|
||||
|| CONNECT_STATE_ACTIVATED == m_lanConnectItem.m_connectState) {
|
||||
m_netButton->stopLoading();
|
||||
if (m_lanConnectItem.m_connectState == CONNECT_STATE_ACTIVATED) {
|
||||
setIcon(true);
|
||||
} else {
|
||||
setIcon(false);
|
||||
}
|
||||
} else {
|
||||
m_netButton->startLoading();
|
||||
}
|
||||
|
||||
m_itemFrame->installEventFilter(this);
|
||||
connect(this->m_infoButton, &InfoButton::clicked, this, &LanListItem::onInfoButtonClicked);
|
||||
connect(m_menu, &QMenu::triggered, this, &LanListItem::onMenuTriggered);
|
||||
}
|
||||
|
||||
|
||||
LanListItem::LanListItem(QWidget *parent) : ListItem(parent)
|
||||
{
|
||||
m_isActive = false;
|
||||
m_netButton->setButtonIcon(QIcon::fromTheme("network-wired-disconnected-symbolic"));
|
||||
setIcon(false);
|
||||
const QString str=tr("Not connected");
|
||||
m_nameLabel->setText(str);
|
||||
this->m_infoButton->hide();
|
||||
}
|
||||
|
||||
LanListItem::~LanListItem()
|
||||
{
|
||||
qDebug()<<"[LanPage] lan list item is deleted." << m_lanConnectItem.m_connectName;
|
||||
}
|
||||
|
||||
void LanListItem::setIcon(bool isOn)
|
||||
{
|
||||
if (isOn) {
|
||||
m_netButton->setActive(true); //设置图标显示不同颜色
|
||||
} else {
|
||||
m_netButton->setActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
void LanListItem::connectItemCopy(const KyConnectItem *lanConnectItem)
|
||||
{
|
||||
if (lanConnectItem) {
|
||||
m_lanConnectItem.m_connectName = lanConnectItem->m_connectName;
|
||||
m_lanConnectItem.m_connectPath = lanConnectItem->m_connectPath;
|
||||
m_lanConnectItem.m_connectState = lanConnectItem->m_connectState;
|
||||
m_lanConnectItem.m_connectUuid = lanConnectItem->m_connectUuid;
|
||||
m_lanConnectItem.m_ifaceName = lanConnectItem->m_ifaceName;
|
||||
m_lanConnectItem.m_itemType = lanConnectItem->m_itemType;
|
||||
} else {
|
||||
qDebug() << LOG_FLAG <<"the connect item is nullptr";
|
||||
m_lanConnectItem.m_connectName = "";
|
||||
m_lanConnectItem.m_connectPath = "";
|
||||
m_lanConnectItem.m_connectState = CONNECT_STATE_UNKONW;
|
||||
m_lanConnectItem.m_connectUuid = "";
|
||||
m_lanConnectItem.m_ifaceName = "";
|
||||
m_lanConnectItem.m_itemType = CONNECT_TYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void LanListItem::onNetButtonClicked()
|
||||
{
|
||||
if (m_lanConnectItem.m_connectUuid.isEmpty()) {
|
||||
qDebug() << LOG_FLAG << "connect is empty, so can not connect or disconnect.";
|
||||
return;
|
||||
}
|
||||
|
||||
if (CONNECT_STATE_DEACTIVATED == m_lanConnectItem.m_connectState) {
|
||||
//断开的连接,点击激活连接
|
||||
if (m_deviceResource->wiredDeviceIsCarriered(m_deviceName)) {
|
||||
m_connectOperation->activateWiredConnection(m_lanConnectItem.m_connectUuid, m_deviceName);
|
||||
qDebug() << LOG_FLAG << "it will activate connection" << m_lanConnectItem.m_connectName
|
||||
<< ". it's device is" << m_deviceName;
|
||||
m_netButton->startLoading();
|
||||
} else {
|
||||
qDebug() << LOG_FLAG << m_deviceName << "is not carried, so can not activate connection";
|
||||
this->showDesktopNotify(tr("Wired Device not carried"));
|
||||
}
|
||||
} else {
|
||||
qDebug() << LOG_FLAG <<"the connection" << m_lanConnectItem.m_connectName
|
||||
<< "is not deactived, so it can not be operation.";
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
void LanListItem::onRightButtonClicked()
|
||||
{
|
||||
//右键点击事件
|
||||
qDebug()<< LOG_FLAG <<"onRightButtonClicked";
|
||||
if (!m_menu) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_menu->clear();
|
||||
if (CONNECT_STATE_ACTIVATED == m_lanConnectItem.m_connectState
|
||||
|| CONNECT_STATE_ACTIVATING == m_lanConnectItem.m_connectState) {
|
||||
m_menu->addAction(new QAction(tr("Disconnect"), this));
|
||||
} else if (CONNECT_STATE_DEACTIVATED == m_lanConnectItem.m_connectState) {
|
||||
m_menu->addAction(new QAction(tr("Connect"), this));
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
m_menu->move(cursor().pos());
|
||||
m_menu->show();
|
||||
return;
|
||||
}
|
||||
|
||||
void LanListItem::onMenuTriggered(QAction *action)
|
||||
{
|
||||
if (action->text() == tr("Connect")) {
|
||||
this->onNetButtonClicked();
|
||||
} else if (action->text() == tr("Disconnect")) {
|
||||
m_connectOperation->deactivateWiredConnection(m_lanConnectItem.m_connectName, m_lanConnectItem.m_connectUuid);
|
||||
qDebug() << LOG_FLAG << "it will disconnect connection" << m_lanConnectItem.m_connectName
|
||||
<< ". it's device is" << m_deviceName;
|
||||
m_netButton->startLoading();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void LanListItem::onInfoButtonClicked()
|
||||
{
|
||||
if (m_lanConnectItem.m_connectUuid.isEmpty()) {
|
||||
qDebug() << LOG_FLAG << "connect is empty, so can not show detail info.";
|
||||
return;
|
||||
}
|
||||
|
||||
if(isDetailShow){
|
||||
qDebug()<< LOG_FLAG << "the detail page has be shown , so do not show again" << Q_FUNC_INFO << __LINE__;
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug()<< LOG_FLAG << "the info button of lan is clicked! uuid = "
|
||||
<< m_lanConnectItem.m_connectUuid << "; name = " << m_lanConnectItem.m_connectName
|
||||
<< "." <<Q_FUNC_INFO << __LINE__;
|
||||
|
||||
bool isActivated = false;
|
||||
if (CONNECT_STATE_ACTIVATED == m_lanConnectItem.m_connectState) {
|
||||
isActivated = true;
|
||||
}
|
||||
|
||||
NetDetail *netDetail = new NetDetail(m_deviceName, m_lanConnectItem.m_connectName,
|
||||
m_lanConnectItem.m_connectUuid, isActivated,false, false, this);
|
||||
connect(netDetail, &NetDetail::detailPageClose, this, &LanListItem::onDetailShow);
|
||||
netDetail->show();
|
||||
Q_EMIT this->detailShow(true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void LanListItem::updateConnectionState(KyConnectState state)
|
||||
{
|
||||
m_lanConnectItem.m_connectState = state;
|
||||
|
||||
if (CONNECT_STATE_DEACTIVATED == state || CONNECT_STATE_ACTIVATED == state) {
|
||||
m_netButton->stopLoading();
|
||||
if (state == CONNECT_STATE_ACTIVATED) {
|
||||
setIcon(true);
|
||||
} else {
|
||||
setIcon(false);
|
||||
}
|
||||
} else {
|
||||
m_netButton->startLoading();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
QString LanListItem::getConnectionName()
|
||||
{
|
||||
return m_lanConnectItem.m_connectName;
|
||||
}
|
||||
|
||||
void LanListItem::updateConnectionName(QString connectionName)
|
||||
{
|
||||
m_lanConnectItem.m_connectName = connectionName;
|
||||
m_nameLabel->setText(m_lanConnectItem.m_connectName);
|
||||
return;
|
||||
}
|
||||
|
||||
QString LanListItem::getConnectionPath()
|
||||
{
|
||||
return m_lanConnectItem.m_connectPath;
|
||||
}
|
||||
|
||||
void LanListItem::updateConnectionPath(QString connectionPath)
|
||||
{
|
||||
m_lanConnectItem.m_connectPath = connectionPath;
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
#ifndef LANLISTITEM_H
|
||||
#define LANLISTITEM_H
|
||||
#include "listitem.h"
|
||||
#include "kylinactiveconnectresource.h"
|
||||
|
||||
#include <QDBusInterface>
|
||||
#include <QEvent>
|
||||
#include <QAction>
|
||||
|
||||
class LanListItem : public ListItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LanListItem(const KyConnectItem *lanConnectItem, const QString &deviceName, QWidget *parent = nullptr);
|
||||
LanListItem(QWidget *parent = nullptr);
|
||||
|
||||
~LanListItem();
|
||||
|
||||
public:
|
||||
void updateConnectionState(KyConnectState state);
|
||||
|
||||
QString getConnectionName();
|
||||
void updateConnectionName(QString connectionName);
|
||||
|
||||
QString getConnectionPath();
|
||||
void updateConnectionPath(QString connectionPath);
|
||||
|
||||
protected:
|
||||
void setIcon(bool isOn);
|
||||
void onRightButtonClicked();
|
||||
|
||||
private:
|
||||
void connectItemCopy(const KyConnectItem *lanConnectItem);
|
||||
|
||||
private Q_SLOTS:
|
||||
void onInfoButtonClicked();
|
||||
void onNetButtonClicked();
|
||||
void onMenuTriggered(QAction *action);
|
||||
|
||||
private:
|
||||
KyConnectItem m_lanConnectItem;
|
||||
|
||||
KyWiredConnectOperation *m_connectOperation = nullptr;
|
||||
KyNetworkDeviceResourse *m_deviceResource = nullptr;
|
||||
|
||||
QString m_deviceName = "";
|
||||
};
|
||||
|
||||
#endif // LANLISTITEM_H
|
|
@ -0,0 +1,18 @@
|
|||
INCLUDEPATH += $$PWD
|
||||
|
||||
FORMS += \
|
||||
$$PWD/oneconnform.ui \
|
||||
$$PWD/onelancform.ui
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/lanlistitem.h \
|
||||
$$PWD/listitem.h \
|
||||
$$PWD/wlanlistitem.h \
|
||||
$$PWD/wlanmoreitem.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/lanlistitem.cpp \
|
||||
$$PWD/listitem.cpp \
|
||||
$$PWD/wlanlistitem.cpp \
|
||||
$$PWD/wlanmoreitem.cpp
|
||||
|
|
@ -0,0 +1,172 @@
|
|||
#include "listitem.h"
|
||||
#include <QDebug>
|
||||
|
||||
#define MAIN_LAYOUT_MARGINS 0,0,0,0
|
||||
#define MAIN_LAYOUT_SPACING 0
|
||||
#define ITEM_FRAME_MARGINS 16,6,16,6
|
||||
#define ITEM_FRAME_SPACING 10
|
||||
#define FRAME_WIDTH 395
|
||||
#define INFO_ICON_WIDTH 16
|
||||
#define INFO_ICON_HEIGHT 16
|
||||
#define LIGHT_HOVER_COLOR QColor(240,240,240,255)
|
||||
#define DARK_HOVER_COLOR QColor(15,15,15,255)
|
||||
|
||||
ListItem::ListItem(QWidget *parent) : QFrame(parent)
|
||||
{
|
||||
m_connectState = CONNECT_STATE_UNKONW;
|
||||
isDetailShow = false;
|
||||
|
||||
initUI();
|
||||
initConnection();
|
||||
connect(qApp, &QApplication::paletteChanged, this, &ListItem::onPaletteChanged);
|
||||
connect(this, &ListItem::detailShow, this, &ListItem::onDetailShow);
|
||||
// m_itemFrame->installEventFilter(this);
|
||||
}
|
||||
|
||||
ListItem::~ListItem()
|
||||
{
|
||||
if (nullptr != m_netButton) {
|
||||
delete m_netButton;
|
||||
m_netButton = nullptr;
|
||||
}
|
||||
|
||||
if (nullptr != m_infoButton) {
|
||||
delete m_infoButton;
|
||||
m_infoButton = nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ListItem::setName(const QString &name)
|
||||
{
|
||||
m_nameLabel->setText(name);
|
||||
}
|
||||
|
||||
//仅无线调用,有线自己获取
|
||||
void ListItem::setActive(const bool &isActive)
|
||||
{
|
||||
m_netButton->setActive(isActive);
|
||||
m_isActive = isActive;
|
||||
}
|
||||
|
||||
void ListItem::setConnectState(KyConnectState state)
|
||||
{
|
||||
m_connectState = state;
|
||||
}
|
||||
|
||||
void ListItem::showDesktopNotify(const QString &message)
|
||||
{
|
||||
QDBusInterface iface("org.freedesktop.Notifications",
|
||||
"/org/freedesktop/Notifications",
|
||||
"org.freedesktop.Notifications",
|
||||
QDBusConnection::sessionBus());
|
||||
QList<QVariant> args;
|
||||
args<<(tr("Kylin NM"))
|
||||
<<((unsigned int) 0)
|
||||
<<QString("/usr/share/icons/ukui-icon-theme-default/24x24/devices/gnome-dev-ethernet.png")
|
||||
<<tr("kylin network applet desktop message") //显示的是什么类型的信息
|
||||
<<message //显示的具体信息
|
||||
<<QStringList()
|
||||
<<QVariantMap()
|
||||
<<(int)-1;
|
||||
iface.callWithArgumentList(QDBus::AutoDetect,"Notify",args);
|
||||
}
|
||||
|
||||
void ListItem::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
qDebug()<<"[ListItem]"<<"mousePressEvent";
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
onNetButtonClicked();
|
||||
} else if (event->button() == Qt::RightButton) {
|
||||
onRightButtonClicked();
|
||||
}
|
||||
return QFrame::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void ListItem::enterEvent(QEvent *event)
|
||||
{
|
||||
// QPalette pal = qApp->palette();
|
||||
// QColor baseColor = qApp->palette().base().color();
|
||||
// if (baseColor.red() > MIDDLE_COLOR) {
|
||||
// pal.setColor(QPalette::Window, LIGHT_HOVER_COLOR);
|
||||
// } else {
|
||||
// pal.setColor(QPalette::Window, DARK_HOVER_COLOR);
|
||||
// }
|
||||
// this->setPalette(pal);
|
||||
// return QFrame::enterEvent(event);
|
||||
}
|
||||
|
||||
void ListItem::leaveEvent(QEvent *event)
|
||||
{
|
||||
// QPalette pal = qApp->palette();
|
||||
// pal.setColor(QPalette::Window, qApp->palette().base().color());
|
||||
// this->setPalette(pal);
|
||||
// return QFrame::leaveEvent(event);
|
||||
}
|
||||
|
||||
void ListItem::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
// QPainter painter(this);
|
||||
// painter.setRenderHint(QPainter::Antialiasing); //反锯齿
|
||||
// painter.setBrush(this->palette().brush(QPalette::Window));
|
||||
// painter.setPen(Qt::transparent);
|
||||
// painter.drawRoundedRect(this->rect(), 6, 6);
|
||||
// return QFrame::paintEvent(event);
|
||||
}
|
||||
|
||||
void ListItem::initUI()
|
||||
{
|
||||
m_menu = new QMenu(this);//右键菜单
|
||||
// m_menu->setStyleSheet("QMenu::item{border:3px; border-radius:3px}");
|
||||
// m_menu->setStyleSheet("QMenu{border-radius:6px; margin:6px 6px 6px 6px}");
|
||||
connect(m_menu, &QMenu::triggered, this, &ListItem::onMenuTriggered);
|
||||
|
||||
m_mainLayout = new QVBoxLayout(this);
|
||||
m_mainLayout->setContentsMargins(MAIN_LAYOUT_MARGINS);
|
||||
m_mainLayout->setSpacing(MAIN_LAYOUT_SPACING);
|
||||
this->setLayout(m_mainLayout);
|
||||
|
||||
m_itemFrame = new QFrame(this);
|
||||
m_itemFrame->setFixedWidth(FRAME_WIDTH);
|
||||
|
||||
m_hItemLayout = new QHBoxLayout(m_itemFrame);
|
||||
m_hItemLayout->setContentsMargins(ITEM_FRAME_MARGINS);
|
||||
// m_hItemLayout->setSpacing(ITEM_FRAME_SPACING);
|
||||
|
||||
m_netButton = new RadioItemButton(m_itemFrame);
|
||||
m_nameLabel = new FixLabel(m_itemFrame);
|
||||
m_infoButton = new InfoButton(m_itemFrame);
|
||||
m_infoButton->setIconSize(QSize(INFO_ICON_WIDTH,INFO_ICON_HEIGHT));
|
||||
|
||||
m_hItemLayout->addWidget(m_netButton);
|
||||
m_hItemLayout->addWidget(m_nameLabel);
|
||||
m_hItemLayout->addStretch();
|
||||
m_hItemLayout->addWidget(m_infoButton);
|
||||
|
||||
m_mainLayout->addWidget(m_itemFrame);
|
||||
|
||||
// this->setAutoFillBackground(true);
|
||||
// this->setBackgroundRole(QPalette::Base);
|
||||
// QPalette pal = qApp->palette();
|
||||
// pal.setColor(QPalette::Window, qApp->palette().base().color());
|
||||
// this->setPalette(pal);
|
||||
}
|
||||
|
||||
|
||||
void ListItem::initConnection()
|
||||
{
|
||||
connect(this->m_netButton, &RadioItemButton::clicked, this, &ListItem::onNetButtonClicked);
|
||||
// connect(this->m_infoButton, &InfoButton::clicked, this, &ListItem::onInfoButtonClicked);
|
||||
}
|
||||
|
||||
void ListItem::onPaletteChanged()
|
||||
{
|
||||
// QPalette pal = qApp->palette();
|
||||
// pal.setColor(QPalette::Window, qApp->palette().base().color());
|
||||
// this->setPalette(pal);
|
||||
}
|
||||
|
||||
void ListItem::onDetailShow(bool isShow)
|
||||
{
|
||||
isDetailShow = isShow;
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
#ifndef LISTITEM_H
|
||||
#define LISTITEM_H
|
||||
#include <QFrame>
|
||||
#include <QEvent>
|
||||
#include <QHBoxLayout>
|
||||
#include <QDebug>
|
||||
#include <QMouseEvent>
|
||||
#include <QMenu>
|
||||
#include "radioitembutton.h"
|
||||
#include "infobutton.h"
|
||||
#include "netdetails/netdetail.h"
|
||||
|
||||
class ListItem : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ListItem(QWidget *parent = nullptr);
|
||||
~ListItem();
|
||||
void setName(const QString &name);
|
||||
void setActive(const bool &isActive);
|
||||
void setConnectState(KyConnectState state);
|
||||
static void showDesktopNotify(const QString &message);
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void enterEvent(QEvent *event);
|
||||
void leaveEvent(QEvent *event);
|
||||
void paintEvent(QPaintEvent *event);
|
||||
virtual void onRightButtonClicked() = 0;
|
||||
|
||||
protected:
|
||||
QFrame * m_itemFrame = nullptr;
|
||||
|
||||
FixLabel * m_nameLabel = nullptr;
|
||||
RadioItemButton * m_netButton = nullptr;
|
||||
InfoButton * m_infoButton = nullptr;
|
||||
|
||||
bool m_isActive = false;
|
||||
KyConnectState m_connectState;
|
||||
|
||||
QMenu *m_menu = nullptr;
|
||||
public:
|
||||
QVBoxLayout * m_mainLayout = nullptr;
|
||||
QHBoxLayout * m_hItemLayout = nullptr;
|
||||
bool isDetailShow;
|
||||
private:
|
||||
void initUI();
|
||||
void initConnection();
|
||||
|
||||
public Q_SLOTS:
|
||||
virtual void onNetButtonClicked() = 0;
|
||||
void onPaletteChanged();
|
||||
void onDetailShow(bool isShow);
|
||||
virtual void onMenuTriggered(QAction *action)=0;
|
||||
|
||||
Q_SIGNALS:
|
||||
void detailShow(bool isShow);
|
||||
};
|
||||
|
||||
#endif // LISTITEM_H
|
|
@ -0,0 +1,302 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OneConnForm</class>
|
||||
<widget class="QWidget" name="OneConnForm">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>424</width>
|
||||
<height>142</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="lbName">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>63</x>
|
||||
<y>8</y>
|
||||
<width>241</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btnConnSub">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>316</x>
|
||||
<y>14</y>
|
||||
<width>100</width>
|
||||
<height>34</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btnConn">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>316</x>
|
||||
<y>14</y>
|
||||
<width>100</width>
|
||||
<height>34</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="lbSignal">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>14</x>
|
||||
<y>14</y>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="lbConned">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>63</x>
|
||||
<y>31</y>
|
||||
<width>140</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="wbg_2" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>424</width>
|
||||
<height>106</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QLineEdit" name="lePassword">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>64</x>
|
||||
<y>64</y>
|
||||
<width>352</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBoxPwd">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>390</x>
|
||||
<y>75</y>
|
||||
<width>18</width>
|
||||
<height>9</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btnDisConn">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>316</x>
|
||||
<y>14</y>
|
||||
<width>100</width>
|
||||
<height>34</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btnConnPWD">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>316</x>
|
||||
<y>14</y>
|
||||
<width>100</width>
|
||||
<height>34</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btnHideConn">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>316</x>
|
||||
<y>14</y>
|
||||
<width>100</width>
|
||||
<height>34</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="wbg_3" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>424</width>
|
||||
<height>138</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QPushButton" name="btnInfo">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>63</x>
|
||||
<y>64</y>
|
||||
<width>230</width>
|
||||
<height>61</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="leInfo_1">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>63</x>
|
||||
<y>62</y>
|
||||
<width>230</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="leInfo_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>63</x>
|
||||
<y>86</y>
|
||||
<width>230</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="leInfo_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>63</x>
|
||||
<y>110</y>
|
||||
<width>230</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<zorder>leInfo_1</zorder>
|
||||
<zorder>leInfo_2</zorder>
|
||||
<zorder>leInfo_3</zorder>
|
||||
<zorder>btnInfo</zorder>
|
||||
</widget>
|
||||
<widget class="Line" name="line">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>2</x>
|
||||
<y>59</y>
|
||||
<width>421</width>
|
||||
<height>2</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgba(156, 156, 156,0.1);</string>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="wbg" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>424</width>
|
||||
<height>60</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="lbWaiting">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>316</x>
|
||||
<y>14</y>
|
||||
<width>100</width>
|
||||
<height>34</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="lbWaitingIcon">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>380</x>
|
||||
<y>20</y>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btnCancel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>316</x>
|
||||
<y>14</y>
|
||||
<width>70</width>
|
||||
<height>34</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<zorder>wbg_3</zorder>
|
||||
<zorder>wbg_2</zorder>
|
||||
<zorder>lbName</zorder>
|
||||
<zorder>lbSignal</zorder>
|
||||
<zorder>lbConned</zorder>
|
||||
<zorder>line</zorder>
|
||||
<zorder>wbg</zorder>
|
||||
<zorder>btnConnSub</zorder>
|
||||
<zorder>btnConn</zorder>
|
||||
<zorder>btnConnPWD</zorder>
|
||||
<zorder>btnDisConn</zorder>
|
||||
<zorder>btnHideConn</zorder>
|
||||
<zorder>lbWaiting</zorder>
|
||||
<zorder>lbWaitingIcon</zorder>
|
||||
<zorder>btnCancel</zorder>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -0,0 +1,254 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OneLancForm</class>
|
||||
<widget class="QWidget" name="OneLancForm">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>424</width>
|
||||
<height>167</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="lbName">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>63</x>
|
||||
<y>8</y>
|
||||
<width>190</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btnConn">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>316</x>
|
||||
<y>14</y>
|
||||
<width>100</width>
|
||||
<height>34</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btnConnSub">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>316</x>
|
||||
<y>14</y>
|
||||
<width>100</width>
|
||||
<height>34</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btnDisConn">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>316</x>
|
||||
<y>14</y>
|
||||
<width>100</width>
|
||||
<height>34</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="lbConned">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>63</x>
|
||||
<y>31</y>
|
||||
<width>200</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="wbg" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>424</width>
|
||||
<height>162</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QPushButton" name="btnInfo">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>63</x>
|
||||
<y>64</y>
|
||||
<width>238</width>
|
||||
<height>85</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="leInfo_1">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>63</x>
|
||||
<y>62</y>
|
||||
<width>238</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="leInfo_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>63</x>
|
||||
<y>86</y>
|
||||
<width>260</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="leInfo_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>63</x>
|
||||
<y>110</y>
|
||||
<width>238</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="leInfo_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>63</x>
|
||||
<y>134</y>
|
||||
<width>238</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<zorder>leInfo_1</zorder>
|
||||
<zorder>leInfo_2</zorder>
|
||||
<zorder>leInfo_3</zorder>
|
||||
<zorder>leInfo_4</zorder>
|
||||
<zorder>btnInfo</zorder>
|
||||
</widget>
|
||||
<widget class="QLabel" name="lbIcon">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>14</x>
|
||||
<y>14</y>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>2</x>
|
||||
<y>59</y>
|
||||
<width>421</width>
|
||||
<height>2</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgba(156, 156, 156,0.1);</string>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="wbg_2" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>424</width>
|
||||
<height>60</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="lbWaiting">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>316</x>
|
||||
<y>14</y>
|
||||
<width>100</width>
|
||||
<height>34</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="lbWaitingIcon">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>380</x>
|
||||
<y>20</y>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btnCancel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>316</x>
|
||||
<y>14</y>
|
||||
<width>70</width>
|
||||
<height>34</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<zorder>wbg</zorder>
|
||||
<zorder>wbg_2</zorder>
|
||||
<zorder>lbName</zorder>
|
||||
<zorder>lbConned</zorder>
|
||||
<zorder>lbIcon</zorder>
|
||||
<zorder>line</zorder>
|
||||
<zorder>btnConnSub</zorder>
|
||||
<zorder>btnDisConn</zorder>
|
||||
<zorder>btnConn</zorder>
|
||||
<zorder>lbWaiting</zorder>
|
||||
<zorder>lbWaitingIcon</zorder>
|
||||
<zorder>btnCancel</zorder>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -0,0 +1,588 @@
|
|||
#include "wlanlistitem.h"
|
||||
#include <QResizeEvent>
|
||||
#include <kwindowsystem.h>
|
||||
#include <kwindowsystem_export.h>
|
||||
|
||||
#define EMPTY_SSID "EMPTY_SSID"
|
||||
#define LOG_FLAG "[WlanListItem]"
|
||||
#define WAIT_US 10*1000
|
||||
|
||||
WlanListItem::WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, bool isApMode, QWidget *parent)
|
||||
: WlanListItem(wirelessNetItem, device, parent)
|
||||
{
|
||||
m_isApMode = isApMode;
|
||||
refreshIcon(false); // 额外刷新一次图标,因为WlanListItem执行时,m_isApMode尚未赋值
|
||||
}
|
||||
|
||||
WlanListItem::WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, QWidget *parent) : ListItem(parent)
|
||||
{
|
||||
m_wlanDevice = device;
|
||||
m_wirelessNetItem = wirelessNetItem;
|
||||
|
||||
qDebug()<<"[WlanPage] wlan list item is created." << m_wirelessNetItem.m_NetSsid;
|
||||
|
||||
initWlanUI();
|
||||
setExpanded(false);
|
||||
|
||||
connect(this->m_infoButton, &InfoButton::clicked, this, &WlanListItem::onInfoButtonClicked);
|
||||
connect(m_menu, &QMenu::triggered, this, &WlanListItem::onMenuTriggered);
|
||||
|
||||
m_wirelessConnectOperation = new KyWirelessConnectOperation(this);
|
||||
}
|
||||
|
||||
WlanListItem::WlanListItem(QWidget *parent) : ListItem(parent)
|
||||
{
|
||||
m_wirelessNetItem.m_NetSsid = EMPTY_SSID;
|
||||
|
||||
qDebug()<<"[WlanPage] wlan list item is created." << m_wirelessNetItem.m_NetSsid;
|
||||
|
||||
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-offline-symbolic"));
|
||||
m_netButton->setActive(false);
|
||||
// m_netButton->setDefaultPixmap();
|
||||
const QString name = tr("Not connected");
|
||||
setExpanded(false);
|
||||
this->setName(name);
|
||||
// this->m_netButton->setEnabled(false);
|
||||
this->m_infoButton->hide();
|
||||
}
|
||||
|
||||
WlanListItem::~WlanListItem()
|
||||
{
|
||||
qDebug()<<"[WlanPage] wlan list item is deleted." << m_wirelessNetItem.m_NetSsid;
|
||||
}
|
||||
|
||||
QString WlanListItem::getSsid()
|
||||
{
|
||||
return m_wirelessNetItem.m_NetSsid;
|
||||
}
|
||||
|
||||
void WlanListItem::setSignalStrength(const int &signal)
|
||||
{
|
||||
m_wirelessNetItem.m_signalStrength = signal;
|
||||
if (CONNECT_STATE_ACTIVATED == m_connectState) {
|
||||
refreshIcon(true);
|
||||
} else if (CONNECT_STATE_DEACTIVATED == m_connectState) {
|
||||
refreshIcon(false);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int WlanListItem::getSignalStrength()
|
||||
{
|
||||
return m_wirelessNetItem.m_signalStrength;
|
||||
}
|
||||
|
||||
bool WlanListItem::isConfigured()
|
||||
{
|
||||
return m_wirelessNetItem.m_isConfigured;
|
||||
}
|
||||
|
||||
void WlanListItem::setWlanState(const int &state)
|
||||
{
|
||||
// m_wirelessNetItem.m_state = state; //ZJP_TODO 后端接口待补全
|
||||
refreshIcon(false);
|
||||
}
|
||||
|
||||
void WlanListItem::setExpanded(const bool &expanded)
|
||||
{
|
||||
if (!m_pwdFrame || !m_autoConnectFrame) {
|
||||
this->setFixedHeight(NORMAL_HEIGHT);
|
||||
return;
|
||||
}
|
||||
|
||||
m_pwdFrame->setVisible(expanded);
|
||||
m_autoConnectFrame->setVisible(expanded);
|
||||
|
||||
if (expanded) {
|
||||
m_pwdLineEdit->setFocus();
|
||||
setFixedHeight(EXPANDED_HEIGHT);
|
||||
} else {
|
||||
setFixedHeight(NORMAL_HEIGHT);
|
||||
QPalette pal = qApp->palette();
|
||||
pal.setColor(QPalette::Window, qApp->palette().base().color());
|
||||
this->setPalette(pal);
|
||||
}
|
||||
|
||||
Q_EMIT this->itemHeightChanged(expanded, m_wirelessNetItem.m_NetSsid);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void WlanListItem::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
this->blockSignals(true);
|
||||
|
||||
if (this->height() == EXPANDED_HEIGHT) {
|
||||
this->setExpanded(true);
|
||||
} else {
|
||||
this->setExpanded(false);
|
||||
}
|
||||
|
||||
this->blockSignals(false);
|
||||
|
||||
return ListItem::resizeEvent(event);
|
||||
}
|
||||
|
||||
void WlanListItem::onRightButtonClicked()
|
||||
{
|
||||
qDebug()<< LOG_FLAG <<"onRightButtonClicked";
|
||||
|
||||
if (!m_menu) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_menu->clear();
|
||||
|
||||
if (CONNECT_STATE_ACTIVATED == m_connectState || CONNECT_STATE_ACTIVATING == m_connectState) {
|
||||
m_menu->addAction(new QAction(tr("Disconnect"), this));
|
||||
} else if (CONNECT_STATE_DEACTIVATED == m_connectState) {
|
||||
m_menu->addAction(new QAction(tr("Connect"), this));
|
||||
qDebug() << "add connect action";
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_wirelessNetItem.m_isConfigured) {
|
||||
m_menu->addAction(new QAction(tr("Forget"), this));
|
||||
}
|
||||
|
||||
m_menu->move(cursor().pos());
|
||||
m_menu->show();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void WlanListItem::enterEvent(QEvent *event)
|
||||
{
|
||||
//qDebug()<< LOG_FLAG <<"enterEvent" << m_wirelessNetItem.m_NetSsid;
|
||||
m_mouseIsOut = false;
|
||||
return ListItem::enterEvent(event);
|
||||
}
|
||||
|
||||
void WlanListItem::leaveEvent(QEvent *event)
|
||||
{
|
||||
//qDebug()<< LOG_FLAG <<"leaveEvent"<< m_wirelessNetItem.m_NetSsid;
|
||||
m_mouseIsOut = true;
|
||||
if (m_pwdFrame && m_pwdFrame->isVisible()) {
|
||||
if (m_focusIsOut) {
|
||||
setExpanded(false);
|
||||
}
|
||||
return QFrame::leaveEvent(event);
|
||||
}
|
||||
|
||||
return ListItem::leaveEvent(event);
|
||||
}
|
||||
|
||||
bool WlanListItem::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if (watched == m_showPwdButton || watched == m_autoConnectCheckBox) {
|
||||
if (event->type() == QEvent::FocusIn) {
|
||||
m_pwdLineEdit->setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
if (watched == m_pwdLineEdit) {
|
||||
if (event->type() == QEvent::FocusOut) {
|
||||
m_focusIsOut = true;
|
||||
//qDebug()<< LOG_FLAG <<"focusOutEvent" << m_wirelessNetItem.m_NetSsid;
|
||||
if (m_mouseIsOut) {
|
||||
setExpanded(false);
|
||||
}
|
||||
} else if (event->type() == QEvent::FocusIn) {
|
||||
//qDebug()<< LOG_FLAG <<"focusInEvent" << m_wirelessNetItem.m_NetSsid;
|
||||
m_focusIsOut = false;
|
||||
}
|
||||
}
|
||||
|
||||
return QFrame::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
void WlanListItem::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) {
|
||||
if (m_pwdFrame && m_pwdFrame->isVisible() && m_pwdLineEdit->text().length() >= PWD_LENGTH_LIMIT) {
|
||||
onConnectButtonClicked();
|
||||
}
|
||||
}
|
||||
return QFrame::keyPressEvent(event);
|
||||
}
|
||||
|
||||
void WlanListItem::initWlanUI()
|
||||
{
|
||||
m_hasPwd = (m_wirelessNetItem.m_secuType.isEmpty() || m_wirelessNetItem.m_secuType == "") ? false : true;
|
||||
//设置显示的Wlan名称
|
||||
// this->setName((m_wirelessNetItem.m_connName != "") ? m_wirelessNetItem.m_connName : m_wirelessNetItem.m_NetSsid);
|
||||
this->setName(m_wirelessNetItem.m_NetSsid);
|
||||
//刷新左侧按钮图标
|
||||
refreshIcon(false);
|
||||
|
||||
#define PWD_AREA_HEIGHT 36
|
||||
#define CONNECT_BUTTON_WIDTH 96
|
||||
#define FRAME_CONTENT_MARGINS 56,0,16,4
|
||||
#define FRAME_SPACING 8
|
||||
#define LINEEDIT_WIDTH 220
|
||||
#define PWD_CONTENT_MARGINS 8,0,34,0
|
||||
#define SHOW_PWD_BUTTON_SIZE 24,24
|
||||
#define PWD_LAYOUT_MARGINS 8,0,8,0
|
||||
//密码输入区域的UI
|
||||
m_pwdFrame = new QFrame(this);
|
||||
m_pwdFrameLyt = new QHBoxLayout(m_pwdFrame);
|
||||
m_pwdFrameLyt->setContentsMargins(FRAME_CONTENT_MARGINS);
|
||||
m_pwdFrameLyt->setSpacing(FRAME_SPACING);
|
||||
m_pwdFrame->setLayout(m_pwdFrameLyt);
|
||||
|
||||
m_pwdLineEdit = new QLineEdit(m_pwdFrame);
|
||||
m_pwdLineEdit->setFixedWidth(LINEEDIT_WIDTH);
|
||||
m_pwdLineEdit->setAttribute(Qt::WA_InputMethodEnabled, false);
|
||||
m_pwdLineEdit->setContextMenuPolicy(Qt::NoContextMenu);
|
||||
|
||||
QRegExp rx("^[A-Za-z0-9`~!@#$%^&*()_-+=<>,.\\\/]+$");
|
||||
QRegExpValidator *latitude = new QRegExpValidator(rx, this);
|
||||
m_pwdLineEdit->setValidator(latitude);
|
||||
|
||||
m_pwdLineEdit->installEventFilter(this);
|
||||
connect(m_pwdLineEdit, &QLineEdit::textChanged, this, &WlanListItem::onPwdEditorTextChanged);
|
||||
m_pwdLineEdit->setFixedHeight(PWD_AREA_HEIGHT);
|
||||
m_pwdLineEdit->setEchoMode(QLineEdit::EchoMode::Password);
|
||||
m_pwdLineEdit->setTextMargins(PWD_CONTENT_MARGINS);
|
||||
m_pwdFrameLyt->addWidget(m_pwdLineEdit);
|
||||
|
||||
m_pwdLineEditLyt = new QHBoxLayout(m_pwdLineEdit);
|
||||
m_pwdLineEditLyt->setContentsMargins(PWD_LAYOUT_MARGINS);
|
||||
m_pwdLineEdit->setLayout(m_pwdLineEditLyt);
|
||||
|
||||
m_showPwdButton = new QPushButton(m_pwdLineEdit);
|
||||
m_showPwdButton->setFlat(true); //去除边框
|
||||
m_showPwdButton->installEventFilter(this);
|
||||
m_showPwdButton->setFixedSize(SHOW_PWD_BUTTON_SIZE);
|
||||
m_showPwdButton->setIcon(QIcon::fromTheme("ukui-eye-hidden-symbolic"));
|
||||
m_showPwdButton->setCursor(Qt::PointingHandCursor);
|
||||
connect(m_showPwdButton, &QPushButton::clicked, this, &WlanListItem::onShowPwdButtonClicked);
|
||||
m_pwdLineEditLyt->addStretch();
|
||||
m_pwdLineEditLyt->addWidget(m_showPwdButton);
|
||||
|
||||
m_connectButton = new QPushButton(m_pwdFrame);
|
||||
m_connectButton->setFixedSize(CONNECT_BUTTON_WIDTH, PWD_AREA_HEIGHT);
|
||||
m_connectButton->setText(tr("Connect"));
|
||||
m_connectButton->setEnabled(false);
|
||||
connect(m_connectButton, &QPushButton::clicked, this, &WlanListItem::onConnectButtonClicked);
|
||||
m_pwdFrameLyt->addWidget(m_connectButton);
|
||||
m_pwdFrameLyt->addStretch();
|
||||
|
||||
//自动连接选择区域UI
|
||||
m_autoConnectFrame = new QFrame(this);
|
||||
|
||||
m_autoConnectFrameLyt = new QHBoxLayout(m_autoConnectFrame);
|
||||
m_autoConnectFrameLyt->setContentsMargins(FRAME_CONTENT_MARGINS);
|
||||
m_autoConnectFrameLyt->setSpacing(FRAME_SPACING);
|
||||
m_autoConnectFrame->setLayout(m_autoConnectFrameLyt);
|
||||
|
||||
m_autoConnectCheckBox = new QCheckBox(m_autoConnectFrame);
|
||||
m_autoConnectCheckBox->installEventFilter(this);
|
||||
m_autoConnectCheckBox->setChecked(true);
|
||||
m_autoConnectCheckBox->setFixedSize(SHOW_PWD_BUTTON_SIZE);
|
||||
m_autoConnectFrameLyt->addWidget(m_autoConnectCheckBox);
|
||||
|
||||
m_autoConnectLabel = new QLabel(m_autoConnectFrame);
|
||||
m_autoConnectLabel->setText(tr("Auto Connect"));
|
||||
m_autoConnectFrameLyt->addWidget(m_autoConnectLabel);
|
||||
m_autoConnectFrameLyt->addStretch();
|
||||
|
||||
m_mainLayout->addWidget(m_pwdFrame);
|
||||
m_mainLayout->addWidget(m_autoConnectFrame);
|
||||
|
||||
m_pwdFrame->hide();
|
||||
m_autoConnectFrame->hide();
|
||||
}
|
||||
|
||||
void WlanListItem::refreshIcon(bool isActivated)
|
||||
{
|
||||
#define FULL_SIGNAL 5
|
||||
#define EXCELLENT_SIGNAL 4
|
||||
#define GOOD_SIGNAL 3
|
||||
#define OK_SIGNAL 2
|
||||
#define LOW_SIGNAL 1
|
||||
#define STEP 25
|
||||
if (m_isApMode) {
|
||||
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-hotspot-symbolic", QIcon(":/res/w/wifi-full.png")));
|
||||
m_netButton->setActive(isActivated);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_hasPwd) {
|
||||
//ZJP_TODO 无加密 注意信号格数计算方式,可能需要修改
|
||||
switch (m_wirelessNetItem.m_signalStrength / STEP + 1) {
|
||||
case FULL_SIGNAL:
|
||||
case EXCELLENT_SIGNAL:
|
||||
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-excellent-symbolic",
|
||||
QIcon(":/res/w/wifi-full.png")));
|
||||
break;
|
||||
case GOOD_SIGNAL:
|
||||
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-good-symbolic",
|
||||
QIcon(":/res/w/wifi-high.png")));
|
||||
break;
|
||||
case OK_SIGNAL:
|
||||
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-ok",
|
||||
QIcon(":/res/w/wifi-medium.png")));
|
||||
break;
|
||||
case LOW_SIGNAL:
|
||||
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-low",
|
||||
QIcon(":/res/w/wifi-low.png")));
|
||||
break;
|
||||
default:
|
||||
qDebug() << "Set wlan(without passwd) icon failed, signal = "
|
||||
<< m_wirelessNetItem.m_signalStrength << Q_FUNC_INFO << __LINE__;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
//ZJP_TODO 有加密
|
||||
switch (m_wirelessNetItem.m_signalStrength / STEP + 1) {
|
||||
case FULL_SIGNAL:
|
||||
case EXCELLENT_SIGNAL:
|
||||
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-excellent-secure-symbolic",
|
||||
QIcon(":/res/w/wifi-full-pwd.png")));
|
||||
break;
|
||||
case GOOD_SIGNAL:
|
||||
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-good-secure-symbolic",
|
||||
QIcon(":/res/w/wifi-high-pwd.png")));
|
||||
break;
|
||||
case OK_SIGNAL:
|
||||
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-ok-secure-symbolic",
|
||||
QIcon(":/res/w/wifi-medium-pwd.png")));
|
||||
break;
|
||||
case LOW_SIGNAL:
|
||||
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-low-secure-symbolic",
|
||||
QIcon(":/res/w/wifi-low-pwd.png")));
|
||||
break;
|
||||
default:
|
||||
qDebug() << "Set wlan(with passwd) icon failed, signal = "
|
||||
<< m_wirelessNetItem.m_signalStrength << Q_FUNC_INFO << __LINE__;
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_netButton->setActive(isActivated);
|
||||
}
|
||||
|
||||
void WlanListItem::onInfoButtonClicked()
|
||||
{
|
||||
//ZJP_TODO 呼出无线详情页
|
||||
if(isDetailShow){
|
||||
qDebug() << "has show the detail page,and do not show again" << Q_FUNC_INFO << __LINE__;
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << LOG_FLAG << "Net active or not:"<< m_connectState;
|
||||
qDebug() << LOG_FLAG << "On wlan info button clicked! ssid = "
|
||||
<< m_wirelessNetItem.m_NetSsid << "; name = "
|
||||
<< m_wirelessNetItem.m_connName << "." <<Q_FUNC_INFO << __LINE__;
|
||||
|
||||
|
||||
bool isActive = false;
|
||||
if (CONNECT_STATE_ACTIVATED == m_connectState) {
|
||||
isActive = true;
|
||||
}
|
||||
|
||||
NetDetail *netDetail = new NetDetail(m_wlanDevice, m_wirelessNetItem.m_NetSsid,
|
||||
m_wirelessNetItem.m_connectUuid, isActive, true,
|
||||
!m_wirelessNetItem.m_isConfigured, this);
|
||||
connect(netDetail, &NetDetail::detailPageClose, this, &WlanListItem::onDetailShow);
|
||||
netDetail->show();
|
||||
Q_EMIT this->detailShow(true);
|
||||
}
|
||||
|
||||
void WlanListItem::onNetButtonClicked()
|
||||
{
|
||||
qDebug() << LOG_FLAG << "onNetButtonClicked";
|
||||
if (m_wirelessNetItem.m_NetSsid == EMPTY_SSID) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (CONNECT_STATE_DEACTIVATED != m_connectState) {
|
||||
qDebug() << LOG_FLAG <<"the connection" << m_wirelessNetItem.m_connName
|
||||
<< "is not deactived, so it can not be operation." << Q_FUNC_INFO << __LINE__;
|
||||
return;
|
||||
}
|
||||
|
||||
//有配置或者无密码的wifi直接连接
|
||||
if (m_wirelessNetItem.m_isConfigured) {
|
||||
m_wirelessConnectOperation->activeWirelessConnect(m_wlanDevice, m_wirelessNetItem.m_connectUuid);
|
||||
qDebug()<<"[WlanListItem] Has configuration, will be activated. ssid = "
|
||||
<< m_wirelessNetItem.m_NetSsid << Q_FUNC_INFO << __LINE__;
|
||||
m_netButton->startLoading();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this->m_connectButton->isVisible() && m_wirelessNetItem.m_secuType != "") {
|
||||
if (m_wirelessNetItem.m_secuType.contains("802.1x", Qt::CaseInsensitive)) {
|
||||
if (isEnterpriseWlanDialogShow && enterpriseWlanDialog != nullptr) {
|
||||
qDebug() << LOG_FLAG <<"EnterpriseWlanDialog is show do not show again!";
|
||||
KWindowSystem::raiseWindow(enterpriseWlanDialog->winId());
|
||||
return;
|
||||
} else {
|
||||
enterpriseWlanDialog = new EnterpriseWlanDialog(m_wirelessNetItem, m_wlanDevice, this);
|
||||
connect(enterpriseWlanDialog, &EnterpriseWlanDialog::enterpriseWlanDialogClose, this, &WlanListItem::onEnterpriseWlanDialogClose);
|
||||
enterpriseWlanDialog->show();
|
||||
isEnterpriseWlanDialogShow = true;
|
||||
}
|
||||
} else {
|
||||
this->setExpanded(true);
|
||||
}
|
||||
} else {
|
||||
onConnectButtonClicked();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void WlanListItem::updateWirelessNetSecurity(QString ssid, QString securityType)
|
||||
{
|
||||
if (ssid != m_wirelessNetItem.m_NetSsid) {
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << LOG_FLAG << "Security changed! ssid = " << m_wirelessNetItem.m_NetSsid
|
||||
<< "; security = " << m_wirelessNetItem.m_secuType << "." <<Q_FUNC_INFO << __LINE__;
|
||||
|
||||
m_wirelessNetItem.m_secuType = securityType;
|
||||
bool newSecu = (m_wirelessNetItem.m_secuType.isEmpty() || m_wirelessNetItem.m_secuType == "") ? false : true;
|
||||
if (m_hasPwd^newSecu) {
|
||||
m_hasPwd = newSecu;
|
||||
refreshIcon(false);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void WlanListItem::updateWirelessNetItem(KyWirelessNetItem &wirelessNetItem)
|
||||
{
|
||||
m_wirelessNetItem = wirelessNetItem;
|
||||
return;
|
||||
}
|
||||
|
||||
void WlanListItem::onPwdEditorTextChanged()
|
||||
{
|
||||
if (!m_pwdLineEdit || !m_connectButton) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_pwdLineEdit->text().length() < PWD_LENGTH_LIMIT) {
|
||||
m_connectButton->setEnabled(false);
|
||||
} else {
|
||||
m_connectButton->setEnabled(true);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void WlanListItem::onShowPwdButtonClicked()
|
||||
{
|
||||
qDebug()<< LOG_FLAG << "onShowPwdButtonClicked";
|
||||
if (!m_pwdLineEdit) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_pwdLineEdit->echoMode() == QLineEdit::EchoMode::Password) {
|
||||
m_showPwdButton->setIcon(QIcon::fromTheme("ukui-eye-display-symbolic"));
|
||||
m_pwdLineEdit->setEchoMode(QLineEdit::EchoMode::Normal);
|
||||
} else {
|
||||
m_showPwdButton->setIcon(QIcon::fromTheme("ukui-eye-hidden-symbolic"));
|
||||
m_pwdLineEdit->setEchoMode(QLineEdit::EchoMode::Password);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void WlanListItem::onConnectButtonClicked()
|
||||
{
|
||||
qDebug()<< LOG_FLAG << "onConnectButtonClicked";
|
||||
if ((CONNECT_STATE_ACTIVATING == m_connectState || CONNECT_STATE_DEACTIVATING == m_connectState)) {
|
||||
qDebug() << LOG_FLAG << "On wlan clicked! But there is nothing to do because it is already activating/deactivating!"
|
||||
<< Q_FUNC_INFO << __LINE__;
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_connectButton->isVisible() && !m_connectButton->isEnabled()) {
|
||||
qWarning() << "Connect wlan failed because of null pointer or button state!" << Q_FUNC_INFO << __LINE__;
|
||||
return;
|
||||
}
|
||||
|
||||
KyWirelessConnectSetting settings;
|
||||
settings.m_connectName = m_wirelessNetItem.m_NetSsid;
|
||||
settings.m_ssid = m_wirelessNetItem.m_NetSsid;
|
||||
settings.isAutoConnect = m_autoConnectCheckBox->isChecked();
|
||||
settings.m_psk = m_pwdLineEdit->text();
|
||||
if (m_wirelessNetItem.m_secuType.isEmpty() || m_wirelessNetItem.m_secuType == "") {
|
||||
settings.m_type = WpaNone;
|
||||
} else if (m_wirelessNetItem.m_secuType.contains("WPA1") || m_wirelessNetItem.m_secuType.contains("WPA2")) {
|
||||
settings.m_type = WpaPsk;
|
||||
} else if (m_wirelessNetItem.m_secuType.contains("WPA3")) {
|
||||
settings.m_type = SAE;
|
||||
}
|
||||
|
||||
qDebug() << "[WlanListItem] On button connect clicked, will connect wlan. ssid = "
|
||||
<< m_wirelessNetItem.m_NetSsid << Q_FUNC_INFO <<__LINE__;
|
||||
|
||||
m_wirelessConnectOperation->addAndActiveWirelessConnect(m_wlanDevice, settings, false);
|
||||
setExpanded(false);
|
||||
m_netButton->startLoading();
|
||||
return;
|
||||
}
|
||||
|
||||
KyConnectState WlanListItem::getConnectionState()
|
||||
{
|
||||
return m_connectState;
|
||||
}
|
||||
|
||||
void WlanListItem::updateConnectState(KyConnectState state)
|
||||
{
|
||||
m_connectState = state;
|
||||
|
||||
if (CONNECT_STATE_ACTIVATED == state) {
|
||||
m_netButton->stopLoading();
|
||||
m_netButton->setActive(true);
|
||||
} else if(CONNECT_STATE_DEACTIVATED == state) {
|
||||
qDebug() << "[WlanListItem] stop loading connect state:" << state;
|
||||
m_netButton->stopLoading();
|
||||
m_netButton->setActive(false);
|
||||
} else {
|
||||
qDebug() << "[WlanListItem] start loading connect state:" << state;
|
||||
m_netButton->startLoading();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void WlanListItem::onMenuTriggered(QAction *action)
|
||||
{
|
||||
if (action->text() == tr("Connect")) {
|
||||
this->onNetButtonClicked();
|
||||
} else if (action->text() == tr("Disconnect")) {
|
||||
m_wirelessConnectOperation->deActivateWirelessConnection(m_wlanDevice, m_wirelessNetItem.m_connectUuid);
|
||||
qDebug()<<"[WlanListItem] Clicked on connected wifi, it will be inactivated. ssid = "
|
||||
<< m_wirelessNetItem.m_NetSsid << Q_FUNC_INFO << __LINE__;
|
||||
m_netButton->startLoading();
|
||||
} else if (action->text() == tr("Forget")) {
|
||||
m_wirelessConnectOperation->deleteWirelessConnect(m_wirelessNetItem.m_connectUuid);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void WlanListItem::onEnterpriseWlanDialogClose(bool isShow)
|
||||
{
|
||||
isEnterpriseWlanDialogShow = isShow;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void WlanListItem::forgetPwd()
|
||||
{
|
||||
if (!this->isConfigured()) {
|
||||
m_pwdLineEdit->setText("");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
#ifndef WLANLISTITEM_H
|
||||
#define WLANLISTITEM_H
|
||||
#include "listitem.h"
|
||||
#include "kywirelessnetitem.h"
|
||||
#include "kywirelessnetresource.h"
|
||||
#include "wlanpage.h"
|
||||
#include "kywirelessconnectoperation.h"
|
||||
#include <QCheckBox>
|
||||
#include "kylinactiveconnectresource.h"
|
||||
#include <QAction>
|
||||
#include "enterprisewlandialog.h"
|
||||
|
||||
#include <networkmanagerqt/wirelesssecuritysetting.h>
|
||||
|
||||
#define PSK_SETTING_NAME "802-11-wireless-security"
|
||||
|
||||
#define NORMAL_HEIGHT 48
|
||||
#define EXPANDED_HEIGHT 120
|
||||
#define PWD_LENGTH_LIMIT 8
|
||||
|
||||
class WlanListItem : public ListItem
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, bool isApMode, QWidget *parent = nullptr);
|
||||
WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, QWidget *parent = nullptr);
|
||||
WlanListItem(QWidget *parent = nullptr);
|
||||
~WlanListItem();
|
||||
|
||||
public:
|
||||
QString getSsid();
|
||||
|
||||
void setSignalStrength(const int &signal);
|
||||
int getSignalStrength();
|
||||
|
||||
bool isConfigured();
|
||||
|
||||
void setWlanState(const int &state);
|
||||
void setExpanded(const bool &expanded);
|
||||
|
||||
KyConnectState getConnectionState();
|
||||
void updateConnectState(KyConnectState state);
|
||||
|
||||
void updateWirelessNetSecurity(QString ssid, QString securityType);
|
||||
void updateWirelessNetItem(KyWirelessNetItem &wirelessNetItem);
|
||||
|
||||
void forgetPwd();
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
void onRightButtonClicked();
|
||||
void enterEvent(QEvent *event);
|
||||
void leaveEvent(QEvent *event);
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
|
||||
Q_SIGNALS:
|
||||
void itemHeightChanged(const bool isExpanded, const QString &ssid);
|
||||
|
||||
private:
|
||||
void initWlanUI();
|
||||
void refreshIcon(bool isActivated);
|
||||
|
||||
private:
|
||||
KyWirelessNetItem m_wirelessNetItem;
|
||||
KyWirelessConnectOperation *m_wirelessConnectOperation = nullptr;
|
||||
EnterpriseWlanDialog *enterpriseWlanDialog = nullptr;
|
||||
|
||||
bool m_hasPwd = true;
|
||||
QString m_wlanDevice;
|
||||
|
||||
bool isEnterpriseWlanDialogShow = false;
|
||||
|
||||
//密码输入区域的UI
|
||||
QFrame *m_pwdFrame = nullptr;
|
||||
QHBoxLayout *m_pwdFrameLyt = nullptr;
|
||||
|
||||
QLineEdit * m_pwdLineEdit = nullptr;
|
||||
QHBoxLayout *m_pwdLineEditLyt = nullptr;
|
||||
QPushButton *m_showPwdButton = nullptr;
|
||||
QPushButton *m_connectButton = nullptr;
|
||||
|
||||
//自动连接选择区域UI
|
||||
QFrame *m_autoConnectFrame = nullptr;
|
||||
QHBoxLayout *m_autoConnectFrameLyt = nullptr;
|
||||
QCheckBox *m_autoConnectCheckBox = nullptr;
|
||||
QLabel *m_autoConnectLabel = nullptr;
|
||||
|
||||
bool m_focusIsOut = true;
|
||||
bool m_mouseIsOut = true;
|
||||
|
||||
bool m_forgetConnection = false;
|
||||
bool m_isApMode = false;
|
||||
|
||||
protected Q_SLOTS:
|
||||
void onInfoButtonClicked();
|
||||
|
||||
private Q_SLOTS:
|
||||
void onNetButtonClicked();
|
||||
void onPwdEditorTextChanged();
|
||||
void onShowPwdButtonClicked();
|
||||
void onConnectButtonClicked();
|
||||
void onMenuTriggered(QAction *action);
|
||||
void onEnterpriseWlanDialogClose(bool isShow);
|
||||
};
|
||||
|
||||
#endif // WLANLISTITEM_H
|
|
@ -0,0 +1,25 @@
|
|||
#include "wlanmoreitem.h"
|
||||
|
||||
WlanMoreItem::WlanMoreItem(QWidget *parent) : ListItem(parent)
|
||||
{
|
||||
setObjectName(WMI_OB_NAME);
|
||||
m_netButton->setVisible(false);
|
||||
m_infoButton->setVisible(false);
|
||||
m_nameLabel->setText(tr("Add Others..."));
|
||||
}
|
||||
|
||||
WlanMoreItem::~WlanMoreItem() {
|
||||
|
||||
}
|
||||
|
||||
void WlanMoreItem::onNetButtonClicked() {
|
||||
Q_EMIT hiddenWlanClicked();
|
||||
}
|
||||
|
||||
void WlanMoreItem::onRightButtonClicked() {
|
||||
// Todo
|
||||
}
|
||||
|
||||
void WlanMoreItem::onMenuTriggered(QAction *action) {
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef WLANMOREITEM_H
|
||||
#define WLANMOREITEM_H
|
||||
|
||||
#include <QObject>
|
||||
#include "listitem.h"
|
||||
|
||||
const QString WMI_OB_NAME = "WlanMoreItemObjName";
|
||||
|
||||
class WlanMoreItem : public ListItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
void onRightButtonClicked();
|
||||
|
||||
public:
|
||||
WlanMoreItem(QWidget *parent = nullptr);
|
||||
~WlanMoreItem();
|
||||
|
||||
void onNetButtonClicked();
|
||||
void onMenuTriggered(QAction *action);
|
||||
Q_SIGNALS:
|
||||
void hiddenWlanClicked();
|
||||
};
|
||||
|
||||
#endif // WLANMOREITEM_H
|
|
@ -0,0 +1,726 @@
|
|||
#include "mainwindow.h"
|
||||
#include "customstyle.h"
|
||||
#include <KWindowEffects>
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QDBusReply>
|
||||
#include <QKeyEvent>
|
||||
#include <QProcess>
|
||||
|
||||
#include "kylinnetworkdeviceresource.h"
|
||||
|
||||
#define MAINWINDOW_WIDTH 420
|
||||
#define MAINWINDOW_HEIGHT 476
|
||||
#define LAYOUT_MARGINS 0,0,0,0
|
||||
#define LOADING_TRAYICON_TIMER_MS 60
|
||||
#define THEME_SCHAME "org.ukui.style"
|
||||
#define COLOR_THEME "styleName"
|
||||
|
||||
#define LAN_PAGE_INDEX 0
|
||||
#define WLAN_PAGE_INDEX 1
|
||||
|
||||
#include <kwindowsystem.h>
|
||||
#include <kwindowsystem_export.h>
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
|
||||
{
|
||||
firstlyStart();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief MainWindow::showMainwindow show主窗口,同时也作为dbus接口提供给外部组件调用
|
||||
*/
|
||||
void MainWindow::showMainwindow()
|
||||
{
|
||||
if (!m_loadFinished) {
|
||||
m_secondaryStartTimer->stop();
|
||||
secondaryStart();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置主界面跳过任务栏和分页器的属性,隐藏再次展示有可能辉冲刷掉该属性,需要展示时重新设置
|
||||
*/
|
||||
const KWindowInfo info(this->winId(), NET::WMState);
|
||||
if (!info.hasState(NET::SkipTaskbar) || !info.hasState(NET::SkipPager)) {
|
||||
KWindowSystem::setState(this->winId(), NET::SkipTaskbar | NET::SkipPager);
|
||||
}
|
||||
|
||||
this->resetWindowPosition();
|
||||
this->showNormal();
|
||||
this->raise();
|
||||
this->activateWindow();
|
||||
Q_EMIT this->mainWindowVisibleChanged(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief MainWindow::hideMainwindow 隐藏主页面时要进行的操作,后续可以添加到此函数
|
||||
*/
|
||||
void MainWindow::hideMainwindow()
|
||||
{
|
||||
this->hide();
|
||||
Q_EMIT this->mainWindowVisibleChanged(false);
|
||||
}
|
||||
|
||||
///**
|
||||
// * @brief MainWindow::setWiredDefaultDevice 设置有线设备默认网卡
|
||||
// */
|
||||
//void MainWindow::setWiredDefaultDevice(QString deviceName)
|
||||
//{
|
||||
//// m_lanWidget->updateDefaultDevice(deviceName);
|
||||
//}
|
||||
|
||||
///**
|
||||
// * @brief MainWindow::hideMainwindow 设置无线设备默认网卡
|
||||
// */
|
||||
//void MainWindow::setWirelessDefaultDevice(QString deviceName)
|
||||
//{
|
||||
//// m_wlanWidget->updateDefaultDevice(deviceName);
|
||||
//}
|
||||
|
||||
/**
|
||||
* @brief MainWindow::firstlyStart 一级启动,执行重要且不耗时的启动操作
|
||||
*/
|
||||
void MainWindow::firstlyStart()
|
||||
{
|
||||
initWindowProperties();
|
||||
initTransparency();
|
||||
initUI();
|
||||
initDbusConnnect();
|
||||
initWindowTheme();
|
||||
initTrayIcon();
|
||||
installEventFilter(this);
|
||||
m_secondaryStartTimer = new QTimer(this);
|
||||
connect(m_secondaryStartTimer, &QTimer::timeout, this, [ = ]() {
|
||||
m_secondaryStartTimer->stop();
|
||||
secondaryStart();//满足条件后执行比较耗时的二级启动
|
||||
});
|
||||
m_secondaryStartTimer->start(5 * 1000);
|
||||
|
||||
m_createPagePtrMap.clear();
|
||||
|
||||
//加载key ring
|
||||
//agent_init();
|
||||
//m_secretAgent = new KylinSecretAgent("kylinagent", this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief MainWindow::secondaryStart 二级启动,可以将较耗时的初始化操作放到此处执行
|
||||
*/
|
||||
void MainWindow::secondaryStart()
|
||||
{
|
||||
if (m_loadFinished)
|
||||
return;
|
||||
m_loadFinished = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief MainWindow::initWindowProperties 初始化一些窗口属性
|
||||
*/
|
||||
void MainWindow::initWindowProperties()
|
||||
{
|
||||
this->setWindowTitle(tr("kylin-nm"));
|
||||
this->setWindowIcon(QIcon::fromTheme("kylin-network", QIcon(":/res/x/setup.png")));
|
||||
this->setFixedSize(MAINWINDOW_WIDTH, MAINWINDOW_HEIGHT);
|
||||
// //绘制毛玻璃特效
|
||||
this->setAttribute(Qt::WA_TranslucentBackground, true); //透明
|
||||
this->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
QPainterPath path;
|
||||
auto rect = this->rect();
|
||||
path.addRoundedRect(rect, 12, 12);
|
||||
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); //背景模糊
|
||||
}
|
||||
|
||||
void MainWindow::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter::Antialiasing); // 反锯齿;
|
||||
painter.setPen(Qt::transparent);
|
||||
auto rect = this->rect();
|
||||
painter.drawRoundedRect(rect, 12, 12); //窗口圆角
|
||||
}
|
||||
|
||||
void MainWindow::initTransparency()
|
||||
{
|
||||
if(QGSettings::isSchemaInstalled(TRANSPARENCY_GSETTINGS)) {
|
||||
m_transGsettings = new QGSettings(TRANSPARENCY_GSETTINGS);
|
||||
if(m_transGsettings->keys().contains(QString("transparency"))) {
|
||||
m_transparency=m_transGsettings->get("transparency").toDouble() + 0.15;
|
||||
m_transparency = (m_transparency > 1) ? 1 : m_transparency;
|
||||
connect(m_transGsettings, &QGSettings::changed, this, &MainWindow::onTransChanged);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::onTransChanged()
|
||||
{
|
||||
m_transparency = m_transGsettings->get("transparency").toDouble() + 0.15;
|
||||
m_transparency = (m_transparency > 1) ? 1 : m_transparency;
|
||||
paintWithTrans();
|
||||
}
|
||||
|
||||
void MainWindow::paintWithTrans()
|
||||
{
|
||||
QPalette pal = m_centralWidget->palette();
|
||||
QColor color = qApp->palette().base().color();
|
||||
color.setAlphaF(m_transparency);
|
||||
pal.setColor(QPalette::Base, color);
|
||||
m_centralWidget->setPalette(pal);
|
||||
|
||||
QPalette tabPal = m_centralWidget->tabBar()->palette();
|
||||
tabPal.setColor(QPalette::Base, color);
|
||||
|
||||
QColor inactiveColor = qApp->palette().window().color();
|
||||
inactiveColor.setAlphaF(0.86 *m_transparency);
|
||||
tabPal.setColor(QPalette::Window, inactiveColor);
|
||||
|
||||
m_centralWidget->tabBar()->setPalette(tabPal);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief MainWindow::initUI 初始化窗口内控件
|
||||
*/
|
||||
void MainWindow::initUI()
|
||||
{
|
||||
m_centralWidget = new QTabWidget(this);
|
||||
this->setCentralWidget(m_centralWidget);
|
||||
m_centralWidget->tabBar()->setFixedWidth(this->width()+1);
|
||||
// m_centralWidget->tabBar()->setStyleSheet("QTabBar::tab{min-height:40px}");
|
||||
m_lanWidget = new LanPage(m_centralWidget);
|
||||
m_wlanWidget = new WlanPage(m_centralWidget);
|
||||
connect(this, &MainWindow::mainWindowVisibleChanged, m_wlanWidget, &WlanPage::onMainWindowVisibleChanged);
|
||||
// m_centralWidget->addTab(m_lanWidget, QIcon::fromTheme("network-wired-connected-symbolic", QIcon::fromTheme("network-wired-symbolic", QIcon(":/res/l/network-online.svg"))), tr("LAN"));
|
||||
// m_centralWidget->addTab(m_wlanWidget, QIcon::fromTheme("network-wireless-signal-excellent-symbolic", QIcon(":/res/x/wifi-list-bg.svg")), tr("WLAN"));
|
||||
|
||||
m_centralWidget->addTab(m_lanWidget, tr(""));
|
||||
m_centralWidget->addTab(m_wlanWidget,tr(""));
|
||||
m_tabBarLayout = new QHBoxLayout(this);
|
||||
m_tabBarLayout->setContentsMargins(LAYOUT_MARGINS);
|
||||
m_lanLabel = new QLabel(tr("LAN"));
|
||||
m_lanLabel->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
|
||||
m_wlanLabel = new QLabel(tr("WLAN"));
|
||||
m_wlanLabel->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
|
||||
m_tabBarLayout->addWidget(m_lanLabel);
|
||||
m_tabBarLayout->addWidget(m_wlanLabel);
|
||||
m_centralWidget->tabBar()->setLayout(m_tabBarLayout);
|
||||
m_centralWidget->tabBar()->setProperty("useTabbarSeparateLine", false); // 去掉中间的分割线
|
||||
m_centralWidget->setAttribute(Qt::WA_TranslucentBackground, true); // 背景透明 解决切换黑屏问题
|
||||
connect(m_centralWidget, &QTabWidget::currentChanged, m_wlanWidget, &WlanPage::onWlanPageVisibleChanged);
|
||||
paintWithTrans();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief MainWindow::initTrayIcon 初始化托盘图标和托盘右键菜单
|
||||
*/
|
||||
void MainWindow::initTrayIcon()
|
||||
{
|
||||
loadIcons.append(QIcon::fromTheme("kylin-network-1"));
|
||||
loadIcons.append(QIcon::fromTheme("kylin-network-2"));
|
||||
loadIcons.append(QIcon::fromTheme("kylin-network-3"));
|
||||
loadIcons.append(QIcon::fromTheme("kylin-network-4"));
|
||||
loadIcons.append(QIcon::fromTheme("kylin-network-5"));
|
||||
loadIcons.append(QIcon::fromTheme("kylin-network-6"));
|
||||
loadIcons.append(QIcon::fromTheme("kylin-network-7"));
|
||||
loadIcons.append(QIcon::fromTheme("kylin-network-8"));
|
||||
loadIcons.append(QIcon::fromTheme("kylin-network-9"));
|
||||
loadIcons.append(QIcon::fromTheme("kylin-network-10"));
|
||||
loadIcons.append(QIcon::fromTheme("kylin-network-11"));
|
||||
loadIcons.append(QIcon::fromTheme("kylin-network-12"));
|
||||
iconTimer = new QTimer(this);
|
||||
connect(iconTimer, &QTimer::timeout, this, &MainWindow::onSetTrayIconLoading);
|
||||
|
||||
m_trayIcon = new QSystemTrayIcon();
|
||||
m_trayIconMenu = new QMenu();
|
||||
m_showMainwindowAction = new QAction(tr("Show MainWindow"),this);
|
||||
m_showSettingsAction = new QAction(tr("Settings"),this);
|
||||
|
||||
m_trayIcon->setToolTip(QString(tr("kylin-nm")));
|
||||
m_showSettingsAction->setIcon(QIcon::fromTheme("document-page-setup-symbolic", QIcon(":/res/x/setup.png")) );
|
||||
// m_trayIconMenu->addAction(m_showMainwindowAction);
|
||||
m_trayIconMenu->addAction(m_showSettingsAction);
|
||||
m_trayIcon->setContextMenu(m_trayIconMenu);
|
||||
m_trayIcon->setIcon(QIcon::fromTheme("network-wired-signal-excellent-symbolic"));
|
||||
iconStatus = IconActiveType::LAN_CONNECTED;
|
||||
onRefreshTrayIcon();
|
||||
|
||||
connect(m_trayIcon, &QSystemTrayIcon::activated, this, &MainWindow::onTrayIconActivated);
|
||||
// connect(m_showMainwindowAction, &QAction::triggered, this, &MainWindow::onShowMainwindowActionTriggled);
|
||||
connect(m_showSettingsAction, &QAction::triggered, this, &MainWindow::onShowSettingsActionTriggled);
|
||||
m_trayIcon->show();
|
||||
}
|
||||
|
||||
void MainWindow::initDbusConnnect()
|
||||
{
|
||||
// connect(m_lanWidget, &LanPage::deviceStatusChanged, this, &MainWindow::deviceStatusChanged);
|
||||
// connect(m_lanWidget, &LanPage::deviceNameChanged, this, &MainWindow::deviceNameChanged);
|
||||
// connect(m_wlanWidget, &WlanPage::deviceStatusChanged, this, &MainWindow::deviceStatusChanged);
|
||||
// connect(m_wlanWidget, &WlanPage::deviceNameChanged, this, &MainWindow::deviceNameChanged);
|
||||
|
||||
// connect(m_wlanWidget, &WlanPage::activateFailed, this, &MainWindow::activateFailed);
|
||||
// connect(m_wlanWidget, &WlanPage::deactivateFailed, this, &MainWindow::deactivateFailed);
|
||||
// connect(m_lanWidget, &LanPage::activateFailed, this, &MainWindow::activateFailed);
|
||||
// connect(m_lanWidget, &LanPage::deactivateFailed, this, &MainWindow::deactivateFailed);
|
||||
|
||||
// connect(m_lanWidget, &LanPage::lanAdd, this, &MainWindow::lanAdd);
|
||||
// connect(m_lanWidget, &LanPage::lanRemove, this, &MainWindow::lanRemove);
|
||||
// connect(m_lanWidget, &LanPage::lanUpdate, this, &MainWindow::lanUpdate);
|
||||
// connect(m_lanWidget, &LanPage::lanActiveConnectionStateChanged, this, &MainWindow::lanActiveConnectionStateChanged);
|
||||
connect(m_lanWidget, &LanPage::lanConnectChanged, this, &MainWindow::onLanConnectStatusToChangeTrayIcon);
|
||||
|
||||
|
||||
// connect(m_wlanWidget, &WlanPage::wlanAdd, this, &MainWindow::wlanAdd);
|
||||
// connect(m_wlanWidget, &WlanPage::wlanRemove, this, &MainWindow::wlanRemove);
|
||||
// connect(m_wlanWidget, &WlanPage::wlanActiveConnectionStateChanged, this, &MainWindow::wlanactiveConnectionStateChanged);
|
||||
// connect(m_wlanWidget, &WlanPage::wlanConnectChanged, this, &MainWindow::onWlanConnectStatusToChangeTrayIcon);
|
||||
// connect(m_wlanWidget, &WlanPage::hotspotDeactivated, this, &MainWindow::hotspotDeactivated);
|
||||
// connect(m_wlanWidget, &WlanPage::hotspotActivated, this, &MainWindow::hotspotActivated);
|
||||
// connect(m_wlanWidget, &WlanPage::secuTypeChange, this, &MainWindow::secuTypeChange);
|
||||
// connect(m_wlanWidget, &WlanPage::signalStrengthChange, this, &MainWindow::signalStrengthChange);
|
||||
// connect(m_wlanWidget, &WlanPage::timeToUpdate , this, &MainWindow::timeToUpdate);
|
||||
connect(m_wlanWidget, &WlanPage::showMainWindow, this, &MainWindow::onShowByWlanPage);
|
||||
connect(m_wlanWidget, &WlanPage::connectivityChanged, this, &MainWindow::onConnectivityChanged);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief MainWindow::resetWindowPosition 重新计算窗口位置
|
||||
*/
|
||||
void MainWindow::resetWindowPosition()
|
||||
{
|
||||
#define MARGIN 4
|
||||
#define PANEL_TOP 1
|
||||
#define PANEL_LEFT 2
|
||||
#define PANEL_RIGHT 3
|
||||
//#define PANEL_BOTTOM 4
|
||||
if (!m_positionInterface) {
|
||||
m_positionInterface = new QDBusInterface("org.ukui.panel",
|
||||
"/panel/position",
|
||||
"org.ukui.panel",
|
||||
QDBusConnection::sessionBus());
|
||||
}
|
||||
QDBusReply<QVariantList> reply = m_positionInterface->call("GetPrimaryScreenGeometry");
|
||||
//reply获取的参数共5个,分别是 主屏可用区域的起点x坐标,主屏可用区域的起点y坐标,主屏可用区域的宽度,主屏可用区域高度,任务栏位置
|
||||
if (!m_positionInterface->isValid() || !reply.isValid() || reply.value().size() < 5) {
|
||||
qCritical() << QDBusConnection::sessionBus().lastError().message();
|
||||
this->setGeometry(0, 0, this->width(), this->height());
|
||||
return;
|
||||
}
|
||||
QVariantList position_list = reply.value();
|
||||
int position = position_list.at(4).toInt();
|
||||
switch(position){
|
||||
case PANEL_TOP:
|
||||
//任务栏位于上方
|
||||
this->setGeometry(position_list.at(0).toInt() + position_list.at(2).toInt() - this->width() - MARGIN,
|
||||
position_list.at(1).toInt() + MARGIN,
|
||||
this->width(), this->height());
|
||||
break;
|
||||
//任务栏位于左边
|
||||
case PANEL_LEFT:
|
||||
this->setGeometry(position_list.at(0).toInt() + MARGIN,
|
||||
position_list.at(1).toInt() + reply.value().at(3).toInt() - this->height() - MARGIN,
|
||||
this->width(), this->height());
|
||||
break;
|
||||
//任务栏位于右边
|
||||
case PANEL_RIGHT:
|
||||
this->setGeometry(position_list.at(0).toInt() + position_list.at(2).toInt() - this->width() - MARGIN,
|
||||
position_list.at(1).toInt() + reply.value().at(3).toInt() - this->height() - MARGIN,
|
||||
this->width(), this->height());
|
||||
break;
|
||||
//任务栏位于下方
|
||||
default:
|
||||
this->setGeometry(position_list.at(0).toInt() + position_list.at(2).toInt() - this->width() - MARGIN,
|
||||
position_list.at(1).toInt() + reply.value().at(3).toInt() - this->height() - MARGIN,
|
||||
this->width(), this->height());
|
||||
break;
|
||||
}
|
||||
qDebug() << " Position of ukui-panel is " << position << "; Position of mainwindow is " << this->geometry() << "." << Q_FUNC_INFO << __LINE__;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief MainWindow::resetTrayIconTool 重新获取网络连接状态并重新设置图标和tooltip
|
||||
*/
|
||||
void MainWindow::resetTrayIconTool()
|
||||
{
|
||||
//ZJP_TODO 检测当前连接的是有线还是无线,是否可用,设置图标和tooltip,图标最好提前define
|
||||
// int connectivity = objKyDBus->getNetworkConectivity();
|
||||
// qDebug() << "Value of current network Connectivity property : "<< connectivity;
|
||||
// switch (connectivity) {
|
||||
// case UnknownConnectivity:
|
||||
// case Portal:
|
||||
// case Limited:
|
||||
// setTrayIcon(iconLanOnlineNoInternet);
|
||||
// trayIcon->setToolTip(QString(tr("Network Connected But Can Not Access Internet")));
|
||||
// break;
|
||||
// case NoConnectivity:
|
||||
// case Full:
|
||||
// setTrayIcon(iconLanOnline);
|
||||
// trayIcon->setToolTip(QString(tr("kylin-nm")));
|
||||
// break;
|
||||
// }
|
||||
qDebug() << "Has set tray icon to be XXX." << Q_FUNC_INFO << __LINE__;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief MainWindow::initWindowTheme 初始化窗口主题并创建信号槽
|
||||
*/
|
||||
void MainWindow::initWindowTheme()
|
||||
{
|
||||
const QByteArray style_id(THEME_SCHAME);
|
||||
if (QGSettings::isSchemaInstalled(style_id)) {
|
||||
m_styleGsettings = new QGSettings(style_id);
|
||||
// resetWindowTheme();
|
||||
connect(m_styleGsettings, &QGSettings::changed, this, &MainWindow::onThemeChanged);
|
||||
} else {
|
||||
qWarning() << "Gsettings interface \"org.ukui.style\" is not exist!" << Q_FUNC_INFO << __LINE__;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief MainWindow::resetWindowTheme 读取和设置窗口主题
|
||||
*/
|
||||
void MainWindow::resetWindowTheme()
|
||||
{
|
||||
if (!m_styleGsettings) { return; }
|
||||
QString currentTheme = m_styleGsettings->get(COLOR_THEME).toString();
|
||||
auto app = static_cast<QApplication*>(QCoreApplication::instance());
|
||||
if(currentTheme == "ukui-dark" || currentTheme == "ukui-black"){
|
||||
app->setStyle(new CustomStyle("ukui-dark"));
|
||||
qDebug() << "Has set color theme to ukui-dark." << Q_FUNC_INFO << __LINE__;
|
||||
Q_EMIT qApp->paletteChanged(qApp->palette());
|
||||
return;
|
||||
}
|
||||
app->setStyle(new CustomStyle("ukui-light"));
|
||||
qDebug() << "Has set color theme to " << currentTheme << Q_FUNC_INFO << __LINE__;
|
||||
Q_EMIT qApp->paletteChanged(qApp->palette());
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief MainWindow::showControlCenter 打开控制面板网络界面
|
||||
*/
|
||||
void MainWindow::showControlCenter()
|
||||
{
|
||||
QProcess process;
|
||||
if (!m_lanWidget->lanIsConnected() && m_wlanWidget->wlanIsConnected()){
|
||||
process.startDetached("ukui-control-center -m wlanconnect");
|
||||
} else {
|
||||
process.startDetached("ukui-control-center -m netconnect");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief MainWindow::onTrayIconActivated 点击托盘图标的槽函数
|
||||
*/
|
||||
void MainWindow::onTrayIconActivated()
|
||||
{
|
||||
if (this->isVisible()) {
|
||||
qDebug() << "Received signal of tray icon activated, will hide mainwindow." << Q_FUNC_INFO << __LINE__;
|
||||
hideMainwindow();
|
||||
return;
|
||||
}
|
||||
qDebug() << "Received signal of tray icon activated, will show mainwindow." << Q_FUNC_INFO << __LINE__;
|
||||
this->showMainwindow();
|
||||
}
|
||||
|
||||
void MainWindow::onShowMainwindowActionTriggled()
|
||||
{
|
||||
showMainwindow();
|
||||
}
|
||||
|
||||
void MainWindow::onShowSettingsActionTriggled()
|
||||
{
|
||||
showControlCenter();
|
||||
}
|
||||
|
||||
void MainWindow::onThemeChanged(const QString &key)
|
||||
{
|
||||
if (key == COLOR_THEME) {
|
||||
qDebug() << "Received signal of theme changed, will reset theme." << Q_FUNC_INFO << __LINE__;
|
||||
// resetWindowTheme();
|
||||
paintWithTrans();
|
||||
Q_EMIT qApp->paletteChanged(qApp->palette());
|
||||
} else {
|
||||
qDebug() << "Received signal of theme changed, key=" << key << " will do nothing." << Q_FUNC_INFO << __LINE__;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::onRefreshTrayIcon()
|
||||
{
|
||||
//更新托盘图标显示
|
||||
iconTimer->stop();
|
||||
if (m_lanWidget->lanIsConnected()) {
|
||||
m_trayIcon->setIcon(QIcon::fromTheme("network-wired-connected-symbolic"));
|
||||
iconStatus = IconActiveType::LAN_CONNECTED;
|
||||
} else if (m_wlanWidget->wlanIsConnected()){
|
||||
m_trayIcon->setIcon(QIcon::fromTheme("network-wireless-connected-symbolic"));
|
||||
iconStatus = IconActiveType::WLAN_CONNECTED;
|
||||
} else {
|
||||
m_trayIcon->setIcon(QIcon::fromTheme("network-wired-disconnected-symbolic"));
|
||||
iconStatus = IconActiveType::NOT_CONNECTED;
|
||||
}
|
||||
|
||||
KyConnectivity connecttivity;
|
||||
m_wlanWidget->getConnectivity(connecttivity);
|
||||
if (connecttivity == NetworkManager::Connectivity::Portal || connecttivity == NetworkManager::Connectivity::Limited) {
|
||||
if (iconStatus == IconActiveType::LAN_CONNECTED) {
|
||||
m_trayIcon->setIcon(QIcon::fromTheme("network-error-symbolic"));
|
||||
iconStatus = IconActiveType::LAN_CONNECTED_LIMITED;
|
||||
} else if (iconStatus == IconActiveType::WLAN_CONNECTED) {
|
||||
//todo 信号强度
|
||||
m_trayIcon->setIcon(QIcon::fromTheme("network-wireless-signal-excellent-error-symbolic"));
|
||||
iconStatus = IconActiveType::WLAN_CONNECTED_LIMITED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::onSetTrayIconLoading()
|
||||
{
|
||||
if (currentIconIndex > 11) {
|
||||
currentIconIndex = 0;
|
||||
}
|
||||
m_trayIcon->setIcon(loadIcons.at(currentIconIndex));
|
||||
iconStatus = IconActiveType::ACTIVATING;
|
||||
currentIconIndex ++;
|
||||
}
|
||||
|
||||
void MainWindow::onLanConnectStatusToChangeTrayIcon(int state)
|
||||
{
|
||||
qDebug() << "lan state:" << state << Q_FUNC_INFO << __LINE__;
|
||||
if (state==1 || state==3){
|
||||
m_lanIsLoading = true;
|
||||
iconTimer->start(LOADING_TRAYICON_TIMER_MS);
|
||||
} else {
|
||||
m_lanIsLoading = false;
|
||||
if (m_wlanIsLoading == false) {
|
||||
onRefreshTrayIcon();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::onWlanConnectStatusToChangeTrayIcon(int state)
|
||||
{
|
||||
qDebug() << "wlan state:" << state << Q_FUNC_INFO << __LINE__;
|
||||
if (state==1 || state==3){
|
||||
m_wlanIsLoading = true;
|
||||
iconTimer->start(LOADING_TRAYICON_TIMER_MS);
|
||||
} else {
|
||||
m_wlanIsLoading = false;
|
||||
if (m_lanIsLoading == false) {
|
||||
onRefreshTrayIcon();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::onShowByWlanPage()
|
||||
{
|
||||
m_centralWidget->setCurrentIndex(WLAN_PAGE_INDEX);
|
||||
|
||||
if(QApplication::activeWindow() != this) {
|
||||
this->resetWindowPosition();
|
||||
this->showNormal();
|
||||
this->raise();
|
||||
this->activateWindow();
|
||||
Q_EMIT this->mainWindowVisibleChanged(true);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::onConnectivityChanged(KyConnectivity connectivity)
|
||||
{
|
||||
if (!m_trayIcon) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (iconStatus == ACTIVATING) {
|
||||
return;
|
||||
}
|
||||
|
||||
onRefreshTrayIcon();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief MainWindow::keyPressEvent 按esc键关闭主界面
|
||||
* @param event
|
||||
*/
|
||||
void MainWindow::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
if (event->key() == Qt::Key_Escape) {
|
||||
hideMainwindow();
|
||||
}
|
||||
return QWidget::keyPressEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief MainWindow::eventFilter 事件过滤器
|
||||
* @param watched
|
||||
* @param event
|
||||
* @return
|
||||
*/
|
||||
bool MainWindow::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::ActivationChange) {
|
||||
if(QApplication::activeWindow() != this) {
|
||||
hideMainwindow();
|
||||
}
|
||||
}
|
||||
return QMainWindow::eventFilter(watched,event);
|
||||
}
|
||||
|
||||
///**
|
||||
// * @brief MainWindow::getWirelessList 获取wifi列表,供dbus调用
|
||||
// * @param map
|
||||
// */
|
||||
//void MainWindow::getWirelessList(QMap<QString, QVector<QStringList> > &map)
|
||||
//{
|
||||
// map.clear();
|
||||
// if (nullptr != m_wlanWidget) {
|
||||
// m_wlanWidget->getWirelessList(map);
|
||||
// }
|
||||
//}
|
||||
|
||||
///**
|
||||
// * @brief MainWindow::getWiredList 获取lan列表,供dbus调用
|
||||
// * @param map
|
||||
// */
|
||||
//void MainWindow::getWiredList(QMap<QString, QVector<QStringList>> &map)
|
||||
//{
|
||||
// map.clear();
|
||||
// if (nullptr != m_lanWidget) {
|
||||
// m_lanWidget->getWiredList(map);
|
||||
// }
|
||||
//}
|
||||
|
||||
///**
|
||||
// * @brief MainWindow::activeWirelessAp 开启热点,供dbus调用
|
||||
// * @param apName
|
||||
// * @param apPassword
|
||||
// * @param apDevice
|
||||
// */
|
||||
//void MainWindow::activeWirelessAp(const QString apName, const QString apPassword, const QString band, const QString apDevice)
|
||||
//{
|
||||
// m_wlanWidget->activeWirelessAp(apName, apPassword, band, apDevice);
|
||||
//}
|
||||
|
||||
///**
|
||||
// * @brief MainWindow::activeWirelessAp 断开热点,供dbus调用
|
||||
// * @param apName
|
||||
// */
|
||||
//void MainWindow::deactiveWirelessAp(const QString apName, const QString uuid)
|
||||
//{
|
||||
// m_wlanWidget->deactiveWirelessAp(apName, uuid);
|
||||
//}
|
||||
|
||||
///**
|
||||
// * @brief MainWindow::activeWirelessAp 获取热点,供dbus调用
|
||||
// * @param list
|
||||
// */
|
||||
//void MainWindow::getApInfoBySsid(QString devName, QString ssid, QStringList &list)
|
||||
//{
|
||||
// m_wlanWidget->getApInfoBySsid(devName, ssid, list);
|
||||
//}
|
||||
|
||||
//void MainWindow::getStoredApInfo(QStringList &list)
|
||||
//{
|
||||
// m_wlanWidget->getStoredApInfo(list);
|
||||
//}
|
||||
|
||||
////无线开关
|
||||
//void MainWindow::setWirelessSwitchEnable(bool enable)
|
||||
//{
|
||||
// m_wlanWidget->setWirelessSwitchEnable(enable);
|
||||
//}
|
||||
|
||||
//void MainWindow::setWiredDeviceEnable(const QString& devName, bool enable)
|
||||
//{
|
||||
// m_lanWidget->setWiredDeviceEnable(devName, enable);
|
||||
//}
|
||||
//void MainWindow::showPropertyWidget(QString devName, QString ssid)
|
||||
//{
|
||||
// KyNetworkDeviceResourse *devResourse = new KyNetworkDeviceResourse();
|
||||
// QStringList wiredDeviceList;
|
||||
// wiredDeviceList.clear();
|
||||
// devResourse->getNetworkDeviceList(NetworkManager::Device::Type::Ethernet, wiredDeviceList);
|
||||
// if (wiredDeviceList.contains(devName)) {
|
||||
// qDebug() << "showPropertyWidget device type wired device name " << devName << " uuid " << ssid;
|
||||
// m_lanWidget->showDetailPage(devName, ssid);
|
||||
// delete devResourse;
|
||||
// devResourse = nullptr;
|
||||
// return;
|
||||
// }
|
||||
|
||||
// QStringList wirelessDeviceList;
|
||||
// wirelessDeviceList.clear();
|
||||
// devResourse->getNetworkDeviceList(NetworkManager::Device::Type::Wifi, wirelessDeviceList);
|
||||
// if (wirelessDeviceList.contains(devName)) {
|
||||
// qDebug() << "showPropertyWidget device type wireless device name " << devName << " ssid " << ssid;
|
||||
// m_wlanWidget->showDetailPage(devName, ssid);
|
||||
// delete devResourse;
|
||||
// devResourse = nullptr;
|
||||
// return;
|
||||
// }
|
||||
|
||||
// qWarning() << "showPropertyWidget no such device " << devName;
|
||||
// delete devResourse;
|
||||
// devResourse = nullptr;
|
||||
//}
|
||||
|
||||
//void MainWindow::showCreateWiredConnectWidget(const QString devName)
|
||||
//{
|
||||
// qDebug() << "showCreateWiredConnectWidget! devName = " << devName;
|
||||
// if (m_createPagePtrMap.contains(devName)) {
|
||||
// if (m_createPagePtrMap[devName] != nullptr) {
|
||||
// qDebug() << "showCreateWiredConnectWidget" << devName << "already create,just raise";
|
||||
|
||||
// KWindowSystem::raiseWindow(m_createPagePtrMap[devName]->winId());
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// NetDetail *netDetail = new NetDetail(devName, "", "", false, false, true, this);
|
||||
// connect(netDetail, &NetDetail::createPageClose, [&](QString interfaceName){
|
||||
// if (m_createPagePtrMap.contains(interfaceName)) {
|
||||
// m_createPagePtrMap[interfaceName] = nullptr;
|
||||
// }
|
||||
// });
|
||||
// m_createPagePtrMap.insert(devName, netDetail);
|
||||
// netDetail->show();
|
||||
//}
|
||||
|
||||
//void MainWindow::getWirelessDeviceCap(QMap<QString, int> &map)
|
||||
//{
|
||||
// m_wlanWidget->getWirelessDeviceCap(map);
|
||||
//}
|
||||
|
||||
////有线连接断开
|
||||
//void MainWindow::activateWired(const QString& devName, const QString& connUuid)
|
||||
//{
|
||||
// m_lanWidget->activateWired(devName, connUuid);
|
||||
//}
|
||||
//void MainWindow::deactivateWired(const QString& devName, const QString& connUuid)
|
||||
//{
|
||||
// m_lanWidget->deactivateWired(devName, connUuid);
|
||||
//}
|
||||
|
||||
////无线连接断开
|
||||
//void MainWindow::activateWireless(const QString& devName, const QString& ssid)
|
||||
//{
|
||||
// m_wlanWidget->activateWirelessConnection(devName, ssid);
|
||||
//}
|
||||
|
||||
//void MainWindow::deactivateWireless(const QString& devName, const QString& ssid)
|
||||
//{
|
||||
// m_wlanWidget->deactivateWirelessConnection(devName, ssid);
|
||||
//}
|
||||
|
||||
//void MainWindow::rescan()
|
||||
//{
|
||||
// m_wlanWidget->requestScan();
|
||||
//}
|
||||
|
||||
//void MainWindow::keyRingInit()
|
||||
//{
|
||||
// //agent_init();
|
||||
//}
|
||||
|
||||
//void MainWindow::keyRingClear()
|
||||
//{
|
||||
// // agent_clear();
|
||||
//}
|
|
@ -0,0 +1,170 @@
|
|||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QTableWidget>
|
||||
#include <QGSettings/QGSettings>
|
||||
#include <QTimer>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QMenu>
|
||||
#include <QAction>
|
||||
#include <QDBusInterface>
|
||||
#include <QMap>
|
||||
#include "lanpage.h"
|
||||
#include "wlanpage.h"
|
||||
#include "netdetails/netdetail.h"
|
||||
|
||||
enum IconActiveType {
|
||||
NOT_CONNECTED = 0,
|
||||
LAN_CONNECTED,
|
||||
WLAN_CONNECTED,
|
||||
LAN_CONNECTED_LIMITED,
|
||||
WLAN_CONNECTED_LIMITED,
|
||||
ACTIVATING,
|
||||
};
|
||||
|
||||
const QByteArray TRANSPARENCY_GSETTINGS = "org.ukui.control-center.personalise";
|
||||
|
||||
class LanPage;
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = nullptr);
|
||||
void showMainwindow();
|
||||
void hideMainwindow();
|
||||
|
||||
// void setWiredDefaultDevice(QString deviceName);
|
||||
// void setWirelessDefaultDevice(QString deviceName);
|
||||
|
||||
// //for dbus
|
||||
// void getWirelessList(QMap<QString, QVector<QStringList> > &map);
|
||||
// void getWiredList(QMap<QString, QVector<QStringList>> &map);
|
||||
// //开启热点
|
||||
// void activeWirelessAp(const QString apName, const QString apPassword, const QString wirelessBand, const QString apDevice);
|
||||
// //断开热点
|
||||
// void deactiveWirelessAp(const QString apName, const QString uuid);
|
||||
// //获取热点
|
||||
// void getStoredApInfo(QStringList &list);
|
||||
// void getApInfoBySsid(QString devName, QString ssid, QStringList &list);
|
||||
// //有线连接断开
|
||||
// void activateWired(const QString& devName, const QString& connUuid);
|
||||
// void deactivateWired(const QString& devName, const QString& connUuid);
|
||||
// //无线连接断开
|
||||
// void activateWireless(const QString& devName, const QString& ssid);
|
||||
// void deactivateWireless(const QString& devName, const QString& ssid);
|
||||
// //无线总开关
|
||||
// void setWirelessSwitchEnable(bool enable);
|
||||
|
||||
// void setWiredDeviceEnable(const QString& devName, bool enable);
|
||||
|
||||
// //唤起属性页 根据网卡类型 参数2 为ssid/uuid
|
||||
// void showPropertyWidget(QString devName, QString ssid);
|
||||
// //唤起新建有线连接界面
|
||||
// void showCreateWiredConnectWidget(const QString devName);
|
||||
|
||||
// void getWirelessDeviceCap(QMap<QString, int> &map);
|
||||
|
||||
// void rescan();
|
||||
// KylinSecretAgent *m_secretAgent;
|
||||
|
||||
// void keyRingInit();
|
||||
// void keyRingClear();
|
||||
|
||||
Q_SIGNALS:
|
||||
// //设备插拔
|
||||
// void deviceStatusChanged();
|
||||
// //设备名称变化
|
||||
// void deviceNameChanged(QString oldName, QString newName, int type);
|
||||
// //有线无线列表更新(有线增删、无线增加减少)
|
||||
// void lanAdd(QString devName, QStringList info);
|
||||
// void lanRemove(QString dbusPath);
|
||||
// void lanUpdate(QString devName, QStringList info);
|
||||
// void wlanAdd(QString devName, QStringList info);
|
||||
// void wlanRemove(QString devName,QString ssid);
|
||||
// void wlanactiveConnectionStateChanged(QString devName, QString ssid, QString uuid, int status);
|
||||
// void lanActiveConnectionStateChanged(QString devName, QString uuid, int status);
|
||||
// void activateFailed(QString errorMessage);
|
||||
// void deactivateFailed(QString errorMessage);
|
||||
// //热点断开
|
||||
// void hotspotDeactivated(QString devName, QString ssid);
|
||||
// void hotspotActivated(QString devName, QString ssid, QString uuid);
|
||||
// //信号强度变化
|
||||
// void signalStrengthChange(QString devName, QString ssid, int strength);
|
||||
// //安全性变化
|
||||
// void secuTypeChange(QString devName, QString ssid, QString secuType);
|
||||
void mainWindowVisibleChanged(const bool &visible);
|
||||
// //列表排序
|
||||
// void timeToUpdate();
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
void paintEvent(QPaintEvent *event);
|
||||
|
||||
private:
|
||||
void firstlyStart(); //一级启动
|
||||
void secondaryStart(); //二级启动
|
||||
bool m_loadFinished = false; //是否二级启动已执行完
|
||||
QTimer * m_secondaryStartTimer = nullptr; //执行二级启动的倒计时
|
||||
void initWindowProperties();
|
||||
void initTransparency();
|
||||
void paintWithTrans();
|
||||
void initUI();
|
||||
void initDbusConnnect();
|
||||
void initTrayIcon();
|
||||
void resetTrayIconTool();
|
||||
void initWindowTheme();
|
||||
void resetWindowTheme();
|
||||
void showControlCenter();
|
||||
double m_transparency=1.0; //透明度
|
||||
QGSettings * m_transGsettings; //透明度配置文件
|
||||
int currentIconIndex=0;
|
||||
QList<QIcon> loadIcons;
|
||||
QTimer *iconTimer = nullptr;
|
||||
|
||||
//主窗口的主要构成控件
|
||||
QTabWidget * m_centralWidget = nullptr;
|
||||
QHBoxLayout * m_tabBarLayout = nullptr;
|
||||
QLabel * m_lanLabel = nullptr;
|
||||
QLabel * m_wlanLabel = nullptr;
|
||||
|
||||
LanPage * m_lanWidget = nullptr;
|
||||
WlanPage * m_wlanWidget = nullptr;
|
||||
|
||||
//监听主题的Gsettings
|
||||
QGSettings * m_styleGsettings = nullptr;
|
||||
|
||||
//获取和重置窗口位置
|
||||
void resetWindowPosition();
|
||||
QDBusInterface * m_positionInterface = nullptr;
|
||||
|
||||
//托盘图标,托盘图标右键菜单
|
||||
QSystemTrayIcon * m_trayIcon = nullptr;
|
||||
QMenu * m_trayIconMenu = nullptr;
|
||||
QAction * m_showMainwindowAction = nullptr;
|
||||
QAction * m_showSettingsAction = nullptr;
|
||||
|
||||
bool m_lanIsLoading = false;
|
||||
bool m_wlanIsLoading = false;
|
||||
|
||||
IconActiveType iconStatus = IconActiveType::NOT_CONNECTED;
|
||||
|
||||
QMap<QString, NetDetail*> m_createPagePtrMap;
|
||||
|
||||
private Q_SLOTS:
|
||||
void onTransChanged();
|
||||
void onTrayIconActivated();
|
||||
void onShowMainwindowActionTriggled();
|
||||
void onShowSettingsActionTriggled();
|
||||
void onThemeChanged(const QString &key);
|
||||
void onRefreshTrayIcon();
|
||||
void onSetTrayIconLoading();
|
||||
void onLanConnectStatusToChangeTrayIcon(int state);
|
||||
void onWlanConnectStatusToChangeTrayIcon(int state);
|
||||
void onShowByWlanPage();
|
||||
void onConnectivityChanged(KyConnectivity connectivity);
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
|
@ -0,0 +1,271 @@
|
|||
#ifndef CONINFO_H
|
||||
#define CONINFO_H
|
||||
|
||||
#include <QString>
|
||||
#include <QPalette>
|
||||
#include <QComboBox>
|
||||
#include <QAbstractItemView>
|
||||
#include <QMenu>
|
||||
#include <QContextMenuEvent>
|
||||
#include <QLineEdit>
|
||||
|
||||
#include "kywirelessnetitem.h"
|
||||
#include "kylinwirednetresource.h"
|
||||
#include "kylinactiveconnectresource.h"
|
||||
#include "kywirelessconnectoperation.h"
|
||||
#include "kywirelessnetresource.h"
|
||||
#include "kyenterpricesettinginfo.h"
|
||||
|
||||
#define AUTO_CONFIG 0
|
||||
#define MANUAL_CONFIG 1
|
||||
|
||||
enum PeapInnerType
|
||||
{
|
||||
MSCHAPV2_PEAP = 0,
|
||||
MD5_PEAP,
|
||||
GTC_PEAP,
|
||||
};
|
||||
|
||||
enum TtlsInnerType
|
||||
{
|
||||
PAP = 0,
|
||||
MSCHAP,
|
||||
MSCHAPV2_EAP,
|
||||
MSCHAPV2,
|
||||
CHAP,
|
||||
MD5_EAP,
|
||||
GTC_EAP
|
||||
};
|
||||
|
||||
class LineEdit : public QLineEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit LineEdit(QWidget *parent = nullptr) : QLineEdit(parent) {}
|
||||
~LineEdit() {}
|
||||
|
||||
protected:
|
||||
void contextMenuEvent(QContextMenuEvent *event) {
|
||||
QMenu *menu = createStandardContextMenu();//默认的标准右键菜单,如果不需要刻意完全自己实现
|
||||
menu->setPalette(this->palette());
|
||||
menu->exec(event->globalPos());
|
||||
delete menu;
|
||||
}
|
||||
};
|
||||
|
||||
class ConInfo {
|
||||
public:
|
||||
QString strConName;
|
||||
QString strConType;
|
||||
QString strSecType;
|
||||
KySecuType secType = WPA_AND_WPA2_PERSONAL;
|
||||
QString strPassword;
|
||||
QString strChan;
|
||||
QString strMac;
|
||||
QString strHz;
|
||||
QString strBandWidth;
|
||||
QString strDynamicIpv4;
|
||||
QString strDynamicIpv6;
|
||||
QString strDynamicIpv4Dns;
|
||||
bool isAutoConnect = false;
|
||||
|
||||
KyIpConfigType ipv4ConfigType = CONFIG_IP_DHCP;
|
||||
QString strIPV4Address;
|
||||
QString strIPV4NetMask;
|
||||
QString strIPV4FirDns;
|
||||
QString strIPV4SecDns;
|
||||
QString strIPV4GateWay;
|
||||
|
||||
KyIpConfigType ipv6ConfigType = CONFIG_IP_DHCP;
|
||||
QString strIPV6Address;
|
||||
int iIPV6Prefix;
|
||||
QString strIPV6FirDns;
|
||||
QString strIPV6SecDns;
|
||||
QString strIPV6GateWay;
|
||||
|
||||
KyEapMethodType enterpriseType;
|
||||
KyEapMethodTlsInfo tlsInfo;
|
||||
KyEapMethodPeapInfo peapInfo;
|
||||
KyEapMethodTtlsInfo ttlsInfo;
|
||||
};
|
||||
|
||||
static void setFramePalette(QFrame *widget, QPalette &pal) {
|
||||
QList<LineEdit *> lineEditList = widget->findChildren<LineEdit *>();
|
||||
for (int i = 0; i < lineEditList.count(); ++i) {
|
||||
lineEditList.at(i)->setPalette(pal);
|
||||
lineEditList.at(i)->setContextMenuPolicy(Qt::DefaultContextMenu);
|
||||
}
|
||||
QList<QComboBox *> comboBoxList = widget->findChildren<QComboBox *>();
|
||||
for (int i = 0; i < comboBoxList.count(); ++i) {
|
||||
comboBoxList.at(i)->setPalette(pal);
|
||||
if (comboBoxList.at(i)->view()) {
|
||||
comboBoxList.at(i)->view()->setPalette(pal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static QPalette lightPalette(QWidget *widget)
|
||||
{
|
||||
auto palette = widget->palette();
|
||||
//ukui-light palette UKUI3.1
|
||||
QColor windowText_at(38, 38, 38),
|
||||
windowText_iat(38, 38, 38),
|
||||
windowText_dis(166, 166, 166),
|
||||
button_at(230, 230, 230),
|
||||
button_iat(230, 230, 230),
|
||||
button_dis(233, 233, 233),
|
||||
light_at(255, 255, 255),
|
||||
light_iat(255, 255, 255),
|
||||
light_dis(242, 242, 242),
|
||||
midlight_at(218, 218, 218),
|
||||
midlight_iat(218, 218, 218),
|
||||
midlight_dis(230, 230, 230),
|
||||
dark_at(77, 77, 77),
|
||||
dark_iat(77, 77, 77),
|
||||
dark_dis(64, 64, 64),
|
||||
mid_at(115, 115, 115),
|
||||
mid_iat(115, 115, 115),
|
||||
mid_dis(102, 102, 102),
|
||||
text_at(38, 38, 38),
|
||||
text_iat(38, 38, 38),
|
||||
text_dis(140, 140, 140),
|
||||
brightText_at(89, 89, 89),
|
||||
brightText_iat(89, 89, 89),
|
||||
brightText_dis(77, 77, 77),
|
||||
buttonText_at(38, 38, 38),
|
||||
buttonText_iat(38, 38, 38),
|
||||
buttonText_dis(179, 179, 179),
|
||||
base_at(255, 255, 255),
|
||||
base_iat(245, 245, 245),
|
||||
base_dis(237, 237, 237),
|
||||
window_at(245, 245, 245),
|
||||
window_iat(237, 237, 237),
|
||||
window_dis(230, 230, 230),
|
||||
shadow_at(0, 0, 0, 16),
|
||||
shadow_iat(0, 0, 0, 16),
|
||||
shadow_dis(0, 0, 0, 21),
|
||||
// shadow_at(214, 214, 214),
|
||||
// shadow_iat(214, 214, 214),
|
||||
// shadow_dis(201, 201, 201),
|
||||
highLight_at(55, 144, 250),
|
||||
highLight_iat(55, 144, 250),
|
||||
highLight_dis(233, 233, 233),
|
||||
highLightText_at(255, 255, 255),
|
||||
highLightText_iat(255, 255, 255),
|
||||
highLightText_dis(179, 179, 179),
|
||||
link_at(55, 144, 250),
|
||||
link_iat(55, 144, 250),
|
||||
link_dis(55, 144, 250),
|
||||
linkVisited_at(114, 46, 209),
|
||||
linkVisited_iat(114, 46, 209),
|
||||
linkVisited_dis(114, 46, 209),
|
||||
alternateBase_at(245, 245, 245),
|
||||
alternateBase_iat(245, 245, 245),
|
||||
alternateBase_dis(245, 245, 245),
|
||||
noRale_at(240, 240, 240),
|
||||
noRole_iat(240, 240, 240),
|
||||
noRole_dis(217, 217, 217),
|
||||
toolTipBase_at(255, 255, 255),
|
||||
toolTipBase_iat(255, 255, 255),
|
||||
toolTipBase_dis(255, 255, 255),
|
||||
toolTipText_at(38, 38, 38),
|
||||
toolTipText_iat(38, 38, 38),
|
||||
toolTipText_dis(38, 38, 38),
|
||||
placeholderText_at(38, 38, 38),
|
||||
placeholderText_iat(38, 38, 38),
|
||||
placeholderText_dis(38, 38, 38);
|
||||
|
||||
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::WindowText, windowText_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::WindowText, windowText_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::WindowText, windowText_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::Button, button_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::Button, button_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::Button, button_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::Light, light_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::Light, light_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::Light, light_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::Midlight, midlight_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::Midlight, midlight_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::Midlight, midlight_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::Dark, dark_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::Dark, dark_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::Dark, dark_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::Mid, mid_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::Mid, mid_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::Mid, mid_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::Text, text_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::Text, text_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::Text, text_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::BrightText, brightText_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::BrightText, brightText_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::BrightText, brightText_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::ButtonText, buttonText_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::ButtonText, buttonText_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::ButtonText, buttonText_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::Base, base_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::Base, base_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::Base, base_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::Window, window_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::Window, window_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::Window, window_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::Shadow, shadow_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::Shadow, shadow_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::Shadow, shadow_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::Highlight, highLight_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::Highlight, highLight_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::Highlight, highLight_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::HighlightedText, highLightText_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::HighlightedText, highLightText_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::HighlightedText, highLightText_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::Link, link_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::Link, link_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::Link, link_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::LinkVisited, linkVisited_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::LinkVisited, linkVisited_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::LinkVisited, linkVisited_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::AlternateBase, alternateBase_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::AlternateBase, alternateBase_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::AlternateBase, alternateBase_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::NoRole, noRale_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::NoRole, noRole_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::NoRole, noRole_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::ToolTipBase, toolTipBase_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::ToolTipBase, toolTipBase_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::ToolTipBase, toolTipBase_dis);
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::ToolTipText, toolTipText_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::ToolTipText, toolTipText_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::ToolTipText, toolTipText_dis);
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5,12,0))
|
||||
palette.setColor(QPalette::Active, QPalette::PlaceholderText, placeholderText_at);
|
||||
palette.setColor(QPalette::Inactive, QPalette::PlaceholderText, placeholderText_iat);
|
||||
palette.setColor(QPalette::Disabled, QPalette::PlaceholderText, placeholderText_dis);
|
||||
#endif
|
||||
|
||||
return palette;
|
||||
|
||||
}
|
||||
|
||||
#endif // CONINFO_H
|
|
@ -0,0 +1,227 @@
|
|||
#include "creatnetpage.h"
|
||||
#include "math.h"
|
||||
|
||||
#define MAX_NAME_LENGTH 32
|
||||
|
||||
CreatNetPage::CreatNetPage(QWidget *parent):QFrame(parent)
|
||||
{
|
||||
initUI();
|
||||
initComponent();
|
||||
}
|
||||
|
||||
void CreatNetPage::initUI()
|
||||
{
|
||||
connNameEdit = new LineEdit(this);
|
||||
connNameEdit->setMaxLength(MAX_NAME_LENGTH);
|
||||
ipv4ConfigCombox = new QComboBox(this);
|
||||
ipv4addressEdit = new LineEdit(this);
|
||||
netMaskEdit = new LineEdit(this);
|
||||
gateWayEdit = new LineEdit(this);
|
||||
firstDnsEdit = new LineEdit(this);
|
||||
secondDnsEdit = new LineEdit(this);
|
||||
|
||||
m_connNameLabel = new QLabel(this);
|
||||
m_configLabel = new QLabel(this);
|
||||
m_addressLabel = new QLabel(this);
|
||||
m_maskLabel = new QLabel(this);
|
||||
m_gateWayLabel = new QLabel(this);
|
||||
m_dnsLabel = new QLabel(this);
|
||||
m_secDnsLabel = new QLabel(this);
|
||||
|
||||
m_connNameLabel->setText(tr("Connection Name"));
|
||||
m_configLabel->setText(tr("Ipv4Config"));
|
||||
m_addressLabel->setText(tr("Address"));
|
||||
m_maskLabel->setText(tr("Netmask"));
|
||||
m_gateWayLabel->setText(tr("Default Gateway"));
|
||||
m_dnsLabel->setText(tr("Prefs DNS"));
|
||||
m_secDnsLabel->setText(tr("Alternative DNS"));
|
||||
|
||||
m_detailLayout = new QFormLayout(this);
|
||||
m_detailLayout->addRow(m_connNameLabel,connNameEdit);
|
||||
m_detailLayout->addRow(m_configLabel,ipv4ConfigCombox);
|
||||
m_detailLayout->addRow(m_addressLabel,ipv4addressEdit);
|
||||
m_detailLayout->addRow(m_maskLabel,netMaskEdit);
|
||||
m_detailLayout->addRow(m_gateWayLabel,gateWayEdit);
|
||||
m_detailLayout->addRow(m_dnsLabel,firstDnsEdit);
|
||||
m_detailLayout->addRow(m_secDnsLabel,secondDnsEdit);
|
||||
|
||||
ipv4ConfigCombox->addItem(tr("Auto(DHCP)"), AUTO_CONFIG); //"自动(DHCP)"
|
||||
ipv4ConfigCombox->addItem(tr("Manual"), MANUAL_CONFIG); //"手动"
|
||||
|
||||
|
||||
// IP的正则格式限制
|
||||
QRegExp rx("\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b");
|
||||
|
||||
ipv4addressEdit->setValidator(new QRegExpValidator(rx, this));
|
||||
gateWayEdit->setValidator(new QRegExpValidator(rx, this));
|
||||
netMaskEdit->setValidator(new QRegExpValidator(rx, this));
|
||||
firstDnsEdit->setValidator(new QRegExpValidator(rx, this));
|
||||
secondDnsEdit->setValidator(new QRegExpValidator(rx, this));
|
||||
}
|
||||
|
||||
void CreatNetPage::initComponent() {
|
||||
if (ipv4ConfigCombox->currentIndex() == AUTO_CONFIG) {
|
||||
setLineEnabled(false);
|
||||
} else if (ipv4ConfigCombox->currentIndex() == MANUAL_CONFIG) {
|
||||
setLineEnabled(true);
|
||||
}
|
||||
connect(ipv4ConfigCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(configChanged(int)));
|
||||
|
||||
connect(connNameEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||
connect(ipv4ConfigCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEnableOfSaveBtn()));
|
||||
connect(netMaskEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||
connect(gateWayEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||
connect(firstDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||
connect(secondDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||
}
|
||||
|
||||
bool CreatNetPage::checkConnectBtnIsEnabled()
|
||||
{
|
||||
if (connNameEdit->text().isEmpty()) {
|
||||
qDebug() << "create connName empty or invalid";
|
||||
return false;
|
||||
}
|
||||
qDebug() << "checkConnectBtnIsEnabled currentIndex" << ipv4ConfigCombox->currentIndex();
|
||||
if (ipv4ConfigCombox->currentIndex() == AUTO_CONFIG) {
|
||||
return true;
|
||||
} else {
|
||||
if (ipv4addressEdit->text().isEmpty() || !getTextEditState(ipv4addressEdit->text())) {
|
||||
qDebug() << "create ipv4address empty or invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (netMaskEdit->text().isEmpty() || !netMaskIsValide(netMaskEdit->text())) {
|
||||
qDebug() << "create ipv4 netMask empty or invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (gateWayEdit->text().isEmpty() || !getTextEditState(gateWayEdit->text())) {
|
||||
qDebug() << "create ipv4 gateway empty or invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (firstDnsEdit->text().isEmpty() && !secondDnsEdit->text().isEmpty()) {
|
||||
qDebug() << "create ipv4 dns sort invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!getTextEditState(firstDnsEdit->text())) {
|
||||
qDebug() << "create ipv4 first dns invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!getTextEditState(secondDnsEdit->text())) {
|
||||
qDebug() << "create ipv4 second dns invalid";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CreatNetPage::configChanged(int index) {
|
||||
if (index == AUTO_CONFIG) {
|
||||
setLineEnabled(false);
|
||||
}
|
||||
if (index == MANUAL_CONFIG) {
|
||||
setLineEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void CreatNetPage::setLineEnabled(bool check) {
|
||||
|
||||
ipv4addressEdit->setEnabled(check);
|
||||
netMaskEdit->setEnabled(check);
|
||||
gateWayEdit->setEnabled(check);
|
||||
firstDnsEdit->setEnabled(check);
|
||||
secondDnsEdit->setEnabled(check);
|
||||
|
||||
if (!check) {
|
||||
ipv4addressEdit->clear();
|
||||
netMaskEdit->clear();
|
||||
gateWayEdit->clear();
|
||||
firstDnsEdit->clear();
|
||||
secondDnsEdit->clear();
|
||||
}
|
||||
}
|
||||
|
||||
void CreatNetPage::setEnableOfSaveBtn() {
|
||||
Q_EMIT setCreatePageState(checkConnectBtnIsEnabled());
|
||||
}
|
||||
|
||||
bool CreatNetPage::getTextEditState(QString text)
|
||||
{
|
||||
if (text.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
QRegExp rx("\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b");
|
||||
|
||||
bool match = false;
|
||||
match = rx.exactMatch(text);
|
||||
|
||||
return match;
|
||||
}
|
||||
|
||||
void CreatNetPage::constructIpv4Info(KyConnectSetting &setting)
|
||||
{
|
||||
setting.m_connectName = connNameEdit->text();
|
||||
QString ipv4address =ipv4addressEdit->text();
|
||||
QString netMask = getNetMaskText(netMaskEdit->text());
|
||||
QString gateWay = gateWayEdit->text();
|
||||
qDebug() << "constructIpv4Info: " << "ipv4address " << ipv4address
|
||||
<< " netMask " << netMask
|
||||
<< " gateWay " << gateWay;
|
||||
|
||||
QStringList dnsList;
|
||||
dnsList.empty();
|
||||
if (!firstDnsEdit->text().isEmpty()) {
|
||||
dnsList << firstDnsEdit->text();
|
||||
if (!secondDnsEdit->text().isEmpty()) {
|
||||
dnsList << secondDnsEdit->text();
|
||||
}
|
||||
}
|
||||
if (ipv4ConfigCombox->currentData() == AUTO_CONFIG) {
|
||||
setting.setIpConfigType(IPADDRESS_V4, CONFIG_IP_DHCP);
|
||||
} else {
|
||||
setting.setIpConfigType(IPADDRESS_V4, CONFIG_IP_MANUAL);
|
||||
setting.ipv4AddressConstruct(ipv4address, netMask, gateWay, dnsList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool CreatNetPage::netMaskIsValide(QString text)
|
||||
{
|
||||
if (getTextEditState(text)) {
|
||||
return true;
|
||||
} else {
|
||||
if (text.length() > 0 && text.length() < 3) {
|
||||
int num = text.toInt();
|
||||
if (num > 0 && num < 33) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
QString CreatNetPage::getNetMaskText(QString text)
|
||||
{
|
||||
if (text.length() > 2) {
|
||||
return text;
|
||||
}
|
||||
|
||||
int num = text.toInt();
|
||||
QStringList list;
|
||||
list << "0" << "0" << "0" << "0";
|
||||
int count = 0;
|
||||
while (num - 8 >= 0) {
|
||||
list[count] = "255";
|
||||
num = num - 8;
|
||||
count ++;
|
||||
}
|
||||
if (num > 0) {
|
||||
int size = pow(2, 8) - pow(2,(8-num));
|
||||
list[count] = QString::number(size);
|
||||
}
|
||||
return QString("%1.%2.%3.%4").arg(list[0],list[1],list[2],list[3]);
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
#ifndef CREATNETPAGE_H
|
||||
#define CREATNETPAGE_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QLayout>
|
||||
#include <QFormLayout>
|
||||
#include <QLabel>
|
||||
#include <QPainter>
|
||||
#include <QScrollArea>
|
||||
#include <QSpacerItem>
|
||||
#include <QComboBox>
|
||||
#include <QLineEdit>
|
||||
#include <QDebug>
|
||||
|
||||
#include "coninfo.h"
|
||||
|
||||
class CreatNetPage : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CreatNetPage(QWidget *parent = nullptr);
|
||||
|
||||
void constructIpv4Info(KyConnectSetting &setting);
|
||||
private:
|
||||
LineEdit *connNameEdit;
|
||||
QComboBox *ipv4ConfigCombox;
|
||||
LineEdit *ipv4addressEdit;
|
||||
LineEdit *netMaskEdit;
|
||||
LineEdit *gateWayEdit;
|
||||
LineEdit *firstDnsEdit;
|
||||
LineEdit *secondDnsEdit;
|
||||
|
||||
private:
|
||||
QFormLayout *m_detailLayout;
|
||||
QVBoxLayout *mvBoxLayout;
|
||||
QLabel *m_connNameLabel;
|
||||
QLabel *m_configLabel;
|
||||
QLabel *m_addressLabel;
|
||||
QLabel *m_maskLabel;
|
||||
QLabel *m_gateWayLabel;
|
||||
QLabel *m_dnsLabel;
|
||||
QLabel *m_secDnsLabel;
|
||||
private:
|
||||
void initUI();
|
||||
void initComponent();
|
||||
void setLineEnabled(bool check);
|
||||
bool getTextEditState(QString text);
|
||||
bool checkConnectBtnIsEnabled();
|
||||
|
||||
bool netMaskIsValide(QString text);
|
||||
QString getNetMaskText(QString text);
|
||||
|
||||
private Q_SLOTS:
|
||||
void setEnableOfSaveBtn();
|
||||
void configChanged(int index);
|
||||
Q_SIGNALS:
|
||||
void setCreatePageState(bool);
|
||||
|
||||
};
|
||||
|
||||
#endif // CREATNETPAGE_H
|
|
@ -0,0 +1,73 @@
|
|||
#include "customtabstyle.h"
|
||||
|
||||
|
||||
CustomTabStyle::CustomTabStyle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QSize CustomTabStyle::sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const
|
||||
{
|
||||
QSize s = QProxyStyle::sizeFromContents(type, option, size, widget);
|
||||
if (type == QStyle::CT_TabBarTab) {
|
||||
s.transpose();
|
||||
s.rwidth() = 60; // 设置每个tabBar中item的大小
|
||||
s.rheight() = 36;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
void CustomTabStyle::drawControl(QStyle::ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
|
||||
{
|
||||
if (element == CE_TabBarTab) {
|
||||
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
|
||||
QRect allRect = tab->rect;
|
||||
if (tab->state & QStyle::State_Selected) { //选中状态:tab的Qlabel为矩形,底色为白色,边框淡灰色,文字为淡蓝色且加粗居中(具体颜色值由拾色器提取)
|
||||
painter->save();
|
||||
painter->setPen(0x3790FA); //设置画笔颜色为淡灰色
|
||||
painter->setBrush(QBrush(0x3790FA)); //设置画刷为白色
|
||||
painter->drawRoundedRect(allRect.adjusted(0,0,0,0),6,6); //重绘tab的矩形边框
|
||||
painter->restore(); //还原为默认
|
||||
|
||||
painter->save();
|
||||
painter->setPen(0xffffff); //重新设置画笔颜色为淡蓝色
|
||||
QTextOption option;
|
||||
option.setAlignment(Qt::AlignCenter); //设置文字居中
|
||||
painter->drawText(allRect, tab->text, option); //重绘文字
|
||||
painter->restore();
|
||||
}
|
||||
else if(tab->state & QStyle::State_MouseOver) { //hover状态:tab的Qlabel为矩形,底色为灰色,边框仍未淡灰色,文字加粗居中
|
||||
painter->save();
|
||||
painter->setPen(tab->palette.color(QPalette::Window)); //设置画笔颜色为淡灰色
|
||||
painter->setBrush(tab->palette.color(QPalette::Window)); //设置画刷为灰色
|
||||
painter->drawRoundedRect(allRect.adjusted(0,0,0,0),6,6); //重绘tab的矩形边框
|
||||
painter->restore(); //还原
|
||||
|
||||
painter->save();
|
||||
QTextOption option;
|
||||
option.setAlignment(Qt::AlignCenter); //设置文字居中
|
||||
painter->drawText(allRect, tab->text, option); //重绘文字
|
||||
painter->restore();
|
||||
}
|
||||
else //其它的:tab的Qlabel为矩形,底色为灰色,边框为淡灰色不变,文字不加粗但居中
|
||||
{
|
||||
painter->save();
|
||||
painter->setPen(tab->palette.color(QPalette::Button));
|
||||
painter->setBrush(tab->palette.color(QPalette::Button));
|
||||
painter->drawRoundedRect(allRect.adjusted(0,0,0,0),6,6); //重绘tab的矩形边框
|
||||
painter->restore();
|
||||
painter->save();
|
||||
QTextOption option;
|
||||
option.setAlignment(Qt::AlignCenter);
|
||||
painter->drawText(allRect, tab->text, option);
|
||||
painter->restore();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (element == CE_TabBarTab) {
|
||||
QProxyStyle::drawControl(element, option, painter, widget);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef CUSTOMTABSTYLE_H
|
||||
#define CUSTOMTABSTYLE_H
|
||||
|
||||
#include <QPainter>
|
||||
#include <QProxyStyle>
|
||||
#include <QStyleOptionTab>
|
||||
#include <QDebug>
|
||||
#include <QLayout>
|
||||
class CustomTabStyle : public QProxyStyle
|
||||
{
|
||||
public:
|
||||
CustomTabStyle();
|
||||
QSize sizeFromContents(ContentsType type, const QStyleOption *option,
|
||||
const QSize &size, const QWidget *widget) const;
|
||||
|
||||
void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const;
|
||||
};
|
||||
|
||||
#endif // CUSTOMTABSTYLE_H
|
|
@ -0,0 +1,220 @@
|
|||
#include "detailpage.h"
|
||||
#include <QPainter>
|
||||
#include <QListWidget>
|
||||
|
||||
#define MAX_NAME_LENGTH 32
|
||||
#define MAX_LABEL_WIDTH 250
|
||||
extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed);
|
||||
|
||||
DetailPage::DetailPage(bool isWlan, bool isCreate, QWidget *parent)
|
||||
: mIsWlan(isWlan), isCreate(isCreate), QFrame(parent)
|
||||
{
|
||||
this->setFrameShape(QFrame::Shape::StyledPanel);
|
||||
this->setMaximumWidth(960);
|
||||
initUI();
|
||||
if (isCreate) {
|
||||
connect(mSSIDEdit, &LineEdit::textEdited, this, &DetailPage::setEnableOfSaveBtn);
|
||||
}
|
||||
}
|
||||
|
||||
void DetailPage::setSSID(const QString &ssid) {
|
||||
if (isCreate) {
|
||||
return;
|
||||
}
|
||||
this->mSSIDLabel->setText(ssid);
|
||||
}
|
||||
|
||||
void DetailPage::setProtocol(const QString &protocol) {
|
||||
this->mProtocol->setText(protocol);
|
||||
}
|
||||
|
||||
void DetailPage::setSecType(const QString &secType) {
|
||||
this->mSecType->setText(secType);
|
||||
}
|
||||
|
||||
void DetailPage::setHz(const QString &hz) {
|
||||
this->mHz->setText(hz);
|
||||
}
|
||||
|
||||
void DetailPage::setChan(const QString &chan) {
|
||||
this->mChan->setText(chan);
|
||||
}
|
||||
|
||||
void DetailPage::setBandWidth(const QString &brandWidth) {
|
||||
this->mBandWidth->setText(brandWidth);
|
||||
}
|
||||
|
||||
void DetailPage::setIpv4(const QString &ipv4) {
|
||||
this->mIPV4->setText(ipv4);
|
||||
}
|
||||
|
||||
void DetailPage::setIpv4Dns(const QString &ipv4Dns) {
|
||||
this->mIPV4Dns->setText(ipv4Dns);
|
||||
}
|
||||
|
||||
void DetailPage::setIpv6(const QString &ipv6) {
|
||||
this->mIPV6->setText(ipv6);
|
||||
}
|
||||
|
||||
void DetailPage::setMac(const QString &mac) {
|
||||
this->mMac->setText(mac);
|
||||
}
|
||||
|
||||
void DetailPage::setAutoConnect(bool flag)
|
||||
{
|
||||
if (!mIsWlan) {
|
||||
return;
|
||||
}
|
||||
this->forgetNetBox->setChecked(flag);
|
||||
}
|
||||
|
||||
void DetailPage::getSsid(QString &ssid)
|
||||
{
|
||||
if (isCreate) {
|
||||
ssid = mSSIDEdit->text();
|
||||
} else {
|
||||
ssid = mSSIDLabel->text();
|
||||
}
|
||||
}
|
||||
|
||||
bool DetailPage::checkIsChanged(const ConInfo info)
|
||||
{
|
||||
if (!mIsWlan) {
|
||||
return false;
|
||||
}
|
||||
if (info.isAutoConnect != forgetNetBox->isChecked()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void DetailPage::addDetailItem(QListWidget *listWidget, DetailWidget *detailWidget)
|
||||
{
|
||||
QListWidgetItem *listWidgetItem = new QListWidgetItem(listWidget);
|
||||
listWidgetItem->setSizeHint(QSize(listWidget->width(),36));
|
||||
listWidgetItem->setFlags(Qt::NoItemFlags);
|
||||
listWidget->addItem(listWidgetItem);
|
||||
listWidget->setItemWidget(listWidgetItem, detailWidget);
|
||||
}
|
||||
|
||||
void DetailPage::initUI() {
|
||||
layout = new QVBoxLayout(this);
|
||||
layout->setContentsMargins(0,0,0,0);
|
||||
|
||||
QWidget *mDetailFrame = new QFrame(this);
|
||||
mDetailLayout = new QVBoxLayout(mDetailFrame);
|
||||
mDetailLayout->setContentsMargins(0,0,0,0);
|
||||
|
||||
m_listWidget = new QListWidget(mDetailFrame);
|
||||
m_listWidget->setFrameShape(QFrame::Shape::NoFrame);
|
||||
m_listWidget->setBackgroundRole(QPalette::Base);
|
||||
m_listWidget->setFocusPolicy(Qt::FocusPolicy::NoFocus);
|
||||
mDetailLayout->addWidget(m_listWidget);
|
||||
|
||||
if (!isCreate) {
|
||||
mSSIDLabel = new FixLabel(this);
|
||||
mSSIDLabel->setFixedWidth(MAX_LABEL_WIDTH);
|
||||
mSSIDLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
m_ssidWidget = new DetailWidget(qobject_cast<QWidget *>(mSSIDLabel), m_listWidget);
|
||||
|
||||
// mSSID->setStyleSheet("background:transparent;border-width:0px;border-style:none");
|
||||
// mSSID->setFocusPolicy(Qt::NoFocus);
|
||||
} else {
|
||||
// mSSID->setStyleSheet("border-width:1px;;border-style:solid;border-color:black;border-radius:2px");
|
||||
mSSIDEdit = new LineEdit(this);
|
||||
mSSIDEdit->setMaximumWidth(MAX_LABEL_WIDTH);
|
||||
mSSIDEdit->setAlignment(Qt::AlignRight);
|
||||
mSSIDEdit->setStyleSheet("border-top:0px solid;border-bottom:1px solid;border-left:0px solid;border-right: 0px solid;background:transparent");
|
||||
mSSIDEdit->setPlaceholderText(tr("Please input SSID:"));
|
||||
mSSIDEdit->setMaxLength(MAX_NAME_LENGTH);
|
||||
m_ssidWidget = new DetailWidget(qobject_cast<QWidget *>(mSSIDEdit), m_listWidget);
|
||||
}
|
||||
m_ssidWidget->setKey(tr("SSID:"));
|
||||
|
||||
mProtocol = new QLabel(this);
|
||||
m_protocolWidget = new DetailWidget(qobject_cast<QWidget *>(mProtocol), m_listWidget);
|
||||
m_protocolWidget->setKey(tr("Protocol:"));
|
||||
|
||||
mSecType = new QLabel(this);
|
||||
m_secTypeWidget = new DetailWidget(qobject_cast<QWidget *>(mSecType));
|
||||
m_secTypeWidget->setKey(tr("Security Type:"));
|
||||
|
||||
mHz = new QLabel(this);
|
||||
m_hzWidget = new DetailWidget(qobject_cast<QWidget *>(mHz));
|
||||
m_hzWidget->setKey(tr("Hz:"));
|
||||
|
||||
mChan = new QLabel(this);
|
||||
m_chanelWidget = new DetailWidget(qobject_cast<QWidget *>(mChan));
|
||||
m_chanelWidget->setKey(tr("Chan:"));
|
||||
|
||||
mBandWidth = new QLabel(this);
|
||||
m_bandwidthWidget = new DetailWidget(qobject_cast<QWidget *>(mBandWidth), m_listWidget);
|
||||
m_bandwidthWidget->setKey(tr("BandWidth:"));
|
||||
|
||||
mIPV4 = new QLabel(this);
|
||||
m_ipv4Widget = new DetailWidget(qobject_cast<QWidget *>(mIPV4), m_listWidget);
|
||||
m_ipv4Widget->setKey(tr("IPV4:"));
|
||||
|
||||
mIPV4Dns = new QLabel(this);
|
||||
m_ipv4DnsWidget = new DetailWidget(qobject_cast<QWidget *>(mIPV4Dns), m_listWidget);
|
||||
m_ipv4DnsWidget->setKey(tr("IPV4 Dns:"));
|
||||
|
||||
mIPV6 = new FixLabel(this);
|
||||
mIPV6->setFixedWidth(MAX_LABEL_WIDTH);
|
||||
mIPV6->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
m_ipv6Widget = new DetailWidget(qobject_cast<QWidget *>(mIPV6), m_listWidget);
|
||||
m_ipv6Widget->setKey(tr("IPV6:"));
|
||||
|
||||
mMac = new QLabel(this);
|
||||
m_macWidget = new DetailWidget(qobject_cast<QWidget *>(mMac), m_listWidget);
|
||||
m_macWidget->setKey(tr("Mac:"));
|
||||
|
||||
if (mIsWlan) {
|
||||
autoConnect = new QLabel(this);
|
||||
forgetNetBox = new QCheckBox(this);
|
||||
|
||||
autoConnect->setText(tr("Auto Connection"));
|
||||
mAutoLayout = new QHBoxLayout(this);
|
||||
QSpacerItem *horizontalSpacer;
|
||||
horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
|
||||
mAutoLayout->addSpacing(20);
|
||||
mAutoLayout->addWidget(forgetNetBox);
|
||||
mAutoLayout->addWidget(autoConnect);
|
||||
mAutoLayout->addSpacerItem(horizontalSpacer);
|
||||
}
|
||||
|
||||
this->addDetailItem(m_listWidget, m_ssidWidget);
|
||||
this->addDetailItem(m_listWidget, m_protocolWidget);
|
||||
if (mIsWlan) {
|
||||
this->addDetailItem(m_listWidget, m_secTypeWidget);
|
||||
this->addDetailItem(m_listWidget, m_hzWidget);
|
||||
this->addDetailItem(m_listWidget, m_chanelWidget);
|
||||
}
|
||||
this->addDetailItem(m_listWidget, m_bandwidthWidget);
|
||||
this->addDetailItem(m_listWidget, m_ipv6Widget);
|
||||
this->addDetailItem(m_listWidget, m_ipv4Widget);
|
||||
this->addDetailItem(m_listWidget, m_ipv4DnsWidget);
|
||||
this->addDetailItem(m_listWidget, m_macWidget);
|
||||
|
||||
QPalette mpal(m_listWidget->palette());
|
||||
mpal.setColor(QPalette::Base, qApp->palette().base().color());
|
||||
mpal.setColor(QPalette::AlternateBase, qApp->palette().alternateBase().color());
|
||||
m_listWidget->setAlternatingRowColors(true);
|
||||
// m_listWidget->setAutoFillBackground(true);
|
||||
m_listWidget->setPalette(mpal);
|
||||
|
||||
layout->addWidget(mDetailFrame);
|
||||
if (mIsWlan) {
|
||||
layout->addLayout(mAutoLayout);
|
||||
}
|
||||
}
|
||||
|
||||
void DetailPage::setEnableOfSaveBtn() {
|
||||
bool saveEnable = true;
|
||||
if (isCreate) {
|
||||
saveEnable = !mSSIDEdit->text().isEmpty();
|
||||
}
|
||||
Q_EMIT setDetailPageState(saveEnable);
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
#ifndef DETAILPAGE_H
|
||||
#define DETAILPAGE_H
|
||||
#include <QWidget>
|
||||
#include <QLabel>
|
||||
#include <QFormLayout>
|
||||
#include <QPainter>
|
||||
#include <QCheckBox>
|
||||
#include <QSpacerItem>
|
||||
#include <QDebug>
|
||||
#include <QListWidget>
|
||||
#include <QApplication>
|
||||
|
||||
#include "detailwidget.h"
|
||||
#include "coninfo.h"
|
||||
|
||||
class DetailPage : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DetailPage(bool isWlan, bool isCreate = false, QWidget *parent = nullptr);
|
||||
|
||||
void setSSID(const QString &ssid);
|
||||
void setProtocol(const QString &protocol);
|
||||
void setSecType(const QString &secType);
|
||||
void setHz(const QString &hz);
|
||||
void setChan(const QString &chan);
|
||||
void setBandWidth(const QString &brandWidth);
|
||||
void setIpv4(const QString &ipv4);
|
||||
void setIpv4Dns(const QString &ipv4Dns);
|
||||
void setIpv6(const QString &ipv6);
|
||||
void setMac(const QString &mac);
|
||||
void setAutoConnect(bool flag);
|
||||
|
||||
bool checkIsChanged(const ConInfo info);
|
||||
|
||||
void getSsid(QString &ssid);
|
||||
|
||||
private:
|
||||
void initUI();
|
||||
void addDetailItem(QListWidget *listWidget, DetailWidget *detailWidget);
|
||||
|
||||
public:
|
||||
QListWidget * m_listWidget = nullptr;
|
||||
DetailWidget * m_ssidWidget = nullptr;
|
||||
DetailWidget * m_protocolWidget = nullptr;
|
||||
DetailWidget * m_secTypeWidget = nullptr;
|
||||
DetailWidget * m_hzWidget = nullptr;
|
||||
DetailWidget * m_chanelWidget = nullptr;
|
||||
DetailWidget * m_bandwidthWidget = nullptr;
|
||||
DetailWidget * m_ipv4Widget = nullptr;
|
||||
DetailWidget * m_ipv4DnsWidget = nullptr;
|
||||
DetailWidget * m_ipv6Widget = nullptr;
|
||||
DetailWidget * m_macWidget = nullptr;
|
||||
|
||||
LineEdit *mSSIDEdit;
|
||||
FixLabel *mSSIDLabel;
|
||||
QLabel *mProtocol;
|
||||
QLabel *mSecType;
|
||||
QLabel *mHz;
|
||||
QLabel *mChan;
|
||||
QLabel *mBandWidth;
|
||||
QLabel *mIPV4;
|
||||
QLabel *mIPV4Dns;
|
||||
FixLabel *mIPV6;
|
||||
QLabel *mMac;
|
||||
QLabel *autoConnect;
|
||||
|
||||
// QWidget *autoFrame;
|
||||
private:
|
||||
QVBoxLayout *layout;
|
||||
QVBoxLayout *mDetailLayout;
|
||||
QHBoxLayout *mAutoLayout;
|
||||
QCheckBox *forgetNetBox;
|
||||
bool mIsWlan;
|
||||
bool isCreate;
|
||||
|
||||
private Q_SLOTS:
|
||||
void setEnableOfSaveBtn();
|
||||
|
||||
Q_SIGNALS:
|
||||
void setDetailPageState(bool);
|
||||
|
||||
};
|
||||
|
||||
#endif // DETAILPAGE_H
|
|
@ -0,0 +1,73 @@
|
|||
#include "detailwidget.h"
|
||||
#include <QFontMetrics>
|
||||
#include <QDebug>
|
||||
|
||||
#define ITEM_HEIGHT 36
|
||||
#define ITEM_MARGINS 18,0,16,0
|
||||
|
||||
#define MAX_LABEL_WIDTH 138
|
||||
|
||||
FixLabel::FixLabel(QWidget *parent):
|
||||
QLabel(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
FixLabel::~FixLabel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void FixLabel::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QFontMetrics fontMetrics(this->font());
|
||||
int fontSize = fontMetrics.width(mStr);
|
||||
if (fontSize > this->width()) {
|
||||
this->setText(fontMetrics.elidedText(mStr, Qt::ElideRight, this->width()), false);
|
||||
this->setToolTip(mStr);
|
||||
} else {
|
||||
this->setText(mStr, false);
|
||||
this->setToolTip("");
|
||||
}
|
||||
QLabel::paintEvent(event);
|
||||
}
|
||||
|
||||
void FixLabel::setText(const QString & text, bool saveTextFlag)
|
||||
{
|
||||
if (saveTextFlag) {
|
||||
mStr = text;
|
||||
}
|
||||
QLabel::setText(text);
|
||||
}
|
||||
|
||||
DetailWidget::DetailWidget(QWidget *valueWidget, QWidget *parent)
|
||||
: m_valueWidget(valueWidget) , QWidget(parent)
|
||||
{
|
||||
// m_valueWidget = valueWidget;
|
||||
initUI();
|
||||
}
|
||||
|
||||
DetailWidget::~DetailWidget()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DetailWidget::initUI()
|
||||
{
|
||||
this->setFixedHeight(ITEM_HEIGHT);
|
||||
m_mainLayout = new QHBoxLayout(this);
|
||||
m_mainLayout->setContentsMargins(ITEM_MARGINS);
|
||||
|
||||
m_keyLabel = new FixLabel(this);
|
||||
m_keyLabel->setMaximumWidth(MAX_LABEL_WIDTH);
|
||||
m_keyLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||
m_mainLayout->addWidget(m_keyLabel);
|
||||
m_mainLayout->addStretch();
|
||||
m_mainLayout->addWidget(m_valueWidget);
|
||||
// m_valueWidget->setMaximumWidth(100000000000);
|
||||
}
|
||||
|
||||
void DetailWidget::setKey(const QString &keyLabel)
|
||||
{
|
||||
m_keyLabel->setText(keyLabel);
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
#ifndef DetailWidget_H
|
||||
#define DetailWidget_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QLabel>
|
||||
#include <QHBoxLayout>
|
||||
|
||||
//文本长自动省略并添加悬浮
|
||||
class FixLabel : public QLabel
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
FixLabel(QWidget *parent = nullptr);
|
||||
~FixLabel();
|
||||
void setText(const QString &text, bool saveTextFlag = true);
|
||||
private:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
|
||||
private:
|
||||
QString mStr;
|
||||
};
|
||||
|
||||
class DetailWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DetailWidget(QWidget *valueWidget = nullptr, QWidget *parent = nullptr);
|
||||
~DetailWidget();
|
||||
|
||||
void setKey(const QString &keyLabel);
|
||||
|
||||
private:
|
||||
QHBoxLayout * m_mainLayout = nullptr;
|
||||
FixLabel * m_keyLabel = nullptr;
|
||||
QWidget * m_valueWidget = nullptr;
|
||||
|
||||
void initUI();
|
||||
|
||||
};
|
||||
|
||||
#endif // DetailWidget_H
|
|
@ -0,0 +1,280 @@
|
|||
#include "ipv4page.h"
|
||||
#include "netdetail.h"
|
||||
#include "math.h"
|
||||
|
||||
Ipv4Page::Ipv4Page(QWidget *parent):QFrame(parent)
|
||||
{
|
||||
initUI();
|
||||
initComponent();
|
||||
}
|
||||
|
||||
void Ipv4Page::initUI() {
|
||||
ipv4ConfigCombox = new QComboBox(this);
|
||||
ipv4addressEdit = new LineEdit(this);
|
||||
netMaskEdit = new LineEdit(this);
|
||||
gateWayEdit = new LineEdit(this);
|
||||
firstDnsEdit = new LineEdit(this);
|
||||
secondDnsEdit = new LineEdit(this);
|
||||
|
||||
m_configLabel = new QLabel(this);
|
||||
m_addressLabel = new QLabel(this);
|
||||
m_maskLabel = new QLabel(this);
|
||||
m_gateWayLabel = new QLabel(this);
|
||||
m_dnsLabel = new QLabel(this);
|
||||
m_secDnsLabel = new QLabel(this);
|
||||
|
||||
m_configLabel->setText(tr("Ipv4Config"));
|
||||
m_addressLabel->setText(tr("Address"));
|
||||
m_maskLabel->setText(tr("Netmask"));
|
||||
m_gateWayLabel->setText(tr("Default Gateway"));
|
||||
m_dnsLabel->setText(tr("Prefs DNS"));
|
||||
m_secDnsLabel->setText(tr("Alternative DNS"));
|
||||
|
||||
m_detailLayout = new QFormLayout(this);
|
||||
m_detailLayout->addRow(m_configLabel,ipv4ConfigCombox);
|
||||
m_detailLayout->addRow(m_addressLabel,ipv4addressEdit);
|
||||
m_detailLayout->addRow(m_maskLabel,netMaskEdit);
|
||||
m_detailLayout->addRow(m_gateWayLabel,gateWayEdit);
|
||||
m_detailLayout->addRow(m_dnsLabel,firstDnsEdit);
|
||||
m_detailLayout->addRow(m_secDnsLabel,secondDnsEdit);
|
||||
|
||||
ipv4ConfigCombox->addItem(tr("Auto(DHCP)")); //"自动(DHCP)"
|
||||
ipv4ConfigCombox->addItem(tr("Manual")); //"手动"
|
||||
|
||||
// netMaskCombox->addItem("");
|
||||
// netMaskCombox->addItem("255.255.255.0"); //24
|
||||
// netMaskCombox->addItem("255.255.254.0"); //23
|
||||
// netMaskCombox->addItem("255.255.252.0"); //22
|
||||
// netMaskCombox->addItem("255.255.0.0"); //16
|
||||
// netMaskCombox->addItem("255.0.0.0"); //8
|
||||
|
||||
|
||||
// IP的正则格式限制
|
||||
QRegExp rx("\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b");
|
||||
|
||||
ipv4addressEdit->setValidator(new QRegExpValidator(rx, this));
|
||||
gateWayEdit->setValidator(new QRegExpValidator(rx, this));
|
||||
netMaskEdit->setValidator(new QRegExpValidator(rx, this));
|
||||
firstDnsEdit->setValidator(new QRegExpValidator(rx, this));
|
||||
secondDnsEdit->setValidator(new QRegExpValidator(rx, this));
|
||||
}
|
||||
|
||||
void Ipv4Page::initComponent() {
|
||||
if (ipv4ConfigCombox->currentIndex() == AUTO_CONFIG) {
|
||||
setLineEnabled(false);
|
||||
} else if (ipv4ConfigCombox->currentIndex() == MANUAL_CONFIG) {
|
||||
setLineEnabled(true);
|
||||
}
|
||||
connect(ipv4ConfigCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(configChanged(int)));
|
||||
|
||||
connect(ipv4ConfigCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEnableOfSaveBtn()));
|
||||
connect(ipv4addressEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||
connect(netMaskEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||
connect(gateWayEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||
connect(firstDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||
connect(secondDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||
}
|
||||
|
||||
void Ipv4Page::setIpv4Config(KyIpConfigType ipv4Config)
|
||||
{
|
||||
if (ipv4Config == CONFIG_IP_MANUAL) {
|
||||
ipv4ConfigCombox->setCurrentIndex(MANUAL_CONFIG);
|
||||
} else {
|
||||
ipv4ConfigCombox->setCurrentIndex(AUTO_CONFIG);
|
||||
}
|
||||
}
|
||||
|
||||
void Ipv4Page::setIpv4(const QString &ipv4)
|
||||
{
|
||||
ipv4addressEdit->setText(ipv4);
|
||||
}
|
||||
|
||||
void Ipv4Page::setNetMask(const QString &netMask)
|
||||
{
|
||||
netMaskEdit->setText(netMask);
|
||||
}
|
||||
|
||||
void Ipv4Page::setIpv4FirDns(const QString &ipv4FirDns)
|
||||
{
|
||||
firstDnsEdit->setText(ipv4FirDns);
|
||||
}
|
||||
|
||||
void Ipv4Page::setIpv4SecDns(const QString &ipv4SecDns)
|
||||
{
|
||||
secondDnsEdit->setText(ipv4SecDns);
|
||||
}
|
||||
|
||||
void Ipv4Page::setGateWay(const QString &gateWay)
|
||||
{
|
||||
gateWayEdit->setText(gateWay);
|
||||
}
|
||||
|
||||
bool Ipv4Page::checkIsChanged(const ConInfo info, KyConnectSetting &setting)
|
||||
{
|
||||
bool isChanged = false;
|
||||
if (ipv4ConfigCombox->currentIndex() == AUTO_CONFIG) {
|
||||
if (info.ipv4ConfigType != CONFIG_IP_DHCP) {
|
||||
qDebug() << "ipv4ConfigType change to Auto";
|
||||
setting.setIpConfigType(IPADDRESS_V4, CONFIG_IP_DHCP);
|
||||
QString ipv4address("");
|
||||
QString netMask("");
|
||||
QString gateWay("");
|
||||
QStringList dnsList;
|
||||
dnsList.empty();
|
||||
qDebug() << ipv4address << netMask << gateWay;
|
||||
setting.ipv4AddressConstruct(ipv4address, netMask, gateWay, dnsList);
|
||||
isChanged = true;
|
||||
}
|
||||
} else {
|
||||
if (info.ipv4ConfigType != CONFIG_IP_MANUAL) {
|
||||
qDebug() << "ipv4ConfigType change to Manual";
|
||||
setting.setIpConfigType(IPADDRESS_V4, CONFIG_IP_MANUAL);
|
||||
isChanged = true;
|
||||
}
|
||||
qDebug() << "ipv4 netmask " << getNetMaskText(netMaskEdit->text());
|
||||
if(info.strIPV4Address != ipv4addressEdit->text()
|
||||
|| info.strIPV4NetMask != /*netMaskEdit->text()*/getNetMaskText(netMaskEdit->text())
|
||||
|| info.strIPV4GateWay != gateWayEdit->text()
|
||||
|| info.strIPV4FirDns != firstDnsEdit->text()
|
||||
|| info.strIPV4SecDns != secondDnsEdit->text()) {
|
||||
|
||||
qDebug() << "ipv4 info changed";
|
||||
QStringList dnsList;
|
||||
dnsList.empty();
|
||||
if (!firstDnsEdit->text().isEmpty()) {
|
||||
dnsList << firstDnsEdit->text();
|
||||
if (!secondDnsEdit->text().isEmpty()) {
|
||||
dnsList << secondDnsEdit->text();
|
||||
}
|
||||
}
|
||||
|
||||
QString ipv4address =ipv4addressEdit->text();
|
||||
QString netMask = getNetMaskText(netMaskEdit->text());
|
||||
QString gateWay = gateWayEdit->text();
|
||||
qDebug() << ipv4address << netMask << gateWay;
|
||||
setting.ipv4AddressConstruct(ipv4address, netMask, gateWay, dnsList);
|
||||
setting.dumpInfo();
|
||||
isChanged = true;
|
||||
}
|
||||
}
|
||||
return isChanged;
|
||||
}
|
||||
|
||||
bool Ipv4Page::checkConnectBtnIsEnabled()
|
||||
{
|
||||
qDebug() << "checkConnectBtnIsEnabled currentIndex" << ipv4ConfigCombox->currentIndex();
|
||||
if (ipv4ConfigCombox->currentIndex() == AUTO_CONFIG) {
|
||||
return true;
|
||||
} else {
|
||||
if (ipv4addressEdit->text().isEmpty() || !getTextEditState(ipv4addressEdit->text())) {
|
||||
qDebug() << "ipv4address empty or invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (netMaskEdit->text().isEmpty() || !netMaskIsValide(netMaskEdit->text())) {
|
||||
qDebug() << "ipv4 netMask empty or invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
// if (gateWayEdit->text().isEmpty() || !getTextEditState(gateWayEdit->text())) {
|
||||
// qDebug() << "ipv4 gateway empty or invalid";
|
||||
// return false;
|
||||
// }
|
||||
|
||||
if (firstDnsEdit->text().isEmpty() && !secondDnsEdit->text().isEmpty()) {
|
||||
qDebug() << "ipv4 dns sort invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!getTextEditState(firstDnsEdit->text())) {
|
||||
qDebug() << "ipv4 first dns invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!getTextEditState(secondDnsEdit->text())) {
|
||||
qDebug() << "ipv4 second dns invalid";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void Ipv4Page::configChanged(int index) {
|
||||
if (index == AUTO_CONFIG) {
|
||||
setLineEnabled(false);
|
||||
}
|
||||
if (index == MANUAL_CONFIG) {
|
||||
setLineEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void Ipv4Page::setLineEnabled(bool check) {
|
||||
|
||||
ipv4addressEdit->setEnabled(check);
|
||||
netMaskEdit->setEnabled(check);
|
||||
gateWayEdit->setEnabled(check);
|
||||
firstDnsEdit->setEnabled(check);
|
||||
secondDnsEdit->setEnabled(check);
|
||||
|
||||
if (!check) {
|
||||
ipv4addressEdit->clear();
|
||||
netMaskEdit->clear();
|
||||
gateWayEdit->clear();
|
||||
firstDnsEdit->clear();
|
||||
secondDnsEdit->clear();
|
||||
}
|
||||
}
|
||||
|
||||
void Ipv4Page::setEnableOfSaveBtn() {
|
||||
Q_EMIT setIpv4PageState(checkConnectBtnIsEnabled());
|
||||
}
|
||||
|
||||
bool Ipv4Page::getTextEditState(QString text)
|
||||
{
|
||||
if (text.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
QRegExp rx("\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b");
|
||||
|
||||
bool match = false;
|
||||
match = rx.exactMatch(text);
|
||||
|
||||
return match;
|
||||
}
|
||||
|
||||
bool Ipv4Page::netMaskIsValide(QString text)
|
||||
{
|
||||
if (getTextEditState(text)) {
|
||||
return true;
|
||||
} else {
|
||||
if (text.length() > 0 && text.length() < 3) {
|
||||
int num = text.toInt();
|
||||
if (num > 0 && num < 33) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
QString Ipv4Page::getNetMaskText(QString text)
|
||||
{
|
||||
if (text.length() > 2) {
|
||||
return text;
|
||||
}
|
||||
|
||||
int num = text.toInt();
|
||||
QStringList list;
|
||||
list << "0" << "0" << "0" << "0";
|
||||
int count = 0;
|
||||
while (num - 8 >= 0) {
|
||||
list[count] = "255";
|
||||
num = num - 8;
|
||||
count ++;
|
||||
}
|
||||
if (num > 0) {
|
||||
int size = pow(2, 8) - pow(2,(8-num));
|
||||
list[count] = QString::number(size);
|
||||
}
|
||||
return QString("%1.%2.%3.%4").arg(list[0],list[1],list[2],list[3]);
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
#ifndef IPV4PAGE_H
|
||||
#define IPV4PAGE_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QLayout>
|
||||
#include <QFormLayout>
|
||||
#include <QLabel>
|
||||
#include <QPainter>
|
||||
#include <QScrollArea>
|
||||
#include <QSpacerItem>
|
||||
#include <QComboBox>
|
||||
#include <QLineEdit>
|
||||
#include <QDebug>
|
||||
|
||||
//#include "kylinconnectsetting.h"
|
||||
#include "coninfo.h"
|
||||
|
||||
class Ipv4Page : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Ipv4Page(QWidget *parent = nullptr);
|
||||
void setIpv4Config(KyIpConfigType ipv4Config);
|
||||
void setIpv4(const QString &ipv4);
|
||||
void setNetMask(const QString &netMask);
|
||||
void setIpv4FirDns(const QString &ipv4FirDns);
|
||||
void setIpv4SecDns(const QString &ipv4SecDns);
|
||||
void setGateWay(const QString &gateWay);
|
||||
|
||||
bool checkIsChanged(const ConInfo info, KyConnectSetting &setting);
|
||||
private:
|
||||
QComboBox *ipv4ConfigCombox;
|
||||
LineEdit *ipv4addressEdit;
|
||||
LineEdit *netMaskEdit;
|
||||
LineEdit *gateWayEdit;
|
||||
LineEdit *firstDnsEdit;
|
||||
LineEdit *secondDnsEdit;
|
||||
|
||||
private:
|
||||
QFormLayout *m_detailLayout;
|
||||
QVBoxLayout *mvBoxLayout;
|
||||
QLabel *m_configLabel;
|
||||
QLabel *m_addressLabel;
|
||||
QLabel *m_maskLabel;
|
||||
QLabel *m_gateWayLabel;
|
||||
QLabel *m_dnsLabel;
|
||||
QLabel *m_secDnsLabel;
|
||||
private:
|
||||
void initUI();
|
||||
void initComponent();
|
||||
void setLineEnabled(bool check);
|
||||
void configSave();
|
||||
bool getTextEditState(QString text);
|
||||
bool netMaskIsValide(QString text);
|
||||
QString getNetMaskText(QString text);
|
||||
bool checkConnectBtnIsEnabled();
|
||||
|
||||
|
||||
private Q_SLOTS:
|
||||
void setEnableOfSaveBtn();
|
||||
void configChanged(int index);
|
||||
Q_SIGNALS:
|
||||
void setIpv4PageState(bool);
|
||||
|
||||
};
|
||||
|
||||
#endif // IPV4PAGE_H
|
|
@ -0,0 +1,257 @@
|
|||
#include "ipv6page.h"
|
||||
#include "netdetail.h"
|
||||
|
||||
Ipv6Page::Ipv6Page(QWidget *parent):QFrame(parent)
|
||||
{
|
||||
initUI();
|
||||
initComponent();
|
||||
}
|
||||
|
||||
void Ipv6Page::setIpv6Config(KyIpConfigType ipv6Config)
|
||||
{
|
||||
if (ipv6Config == CONFIG_IP_MANUAL) {
|
||||
ipv6ConfigCombox->setCurrentIndex(MANUAL_CONFIG);
|
||||
} else {
|
||||
ipv6ConfigCombox->setCurrentIndex(AUTO_CONFIG);
|
||||
}
|
||||
}
|
||||
|
||||
void Ipv6Page::setIpv6(const QString &ipv6)
|
||||
{
|
||||
ipv6AddressEdit->setText(ipv6);
|
||||
}
|
||||
|
||||
void Ipv6Page::setIpv6Perfix(const int &ipv6Perfix)
|
||||
{
|
||||
lengthEdit->setText(QString::number(ipv6Perfix));
|
||||
}
|
||||
|
||||
void Ipv6Page::setIpv6FirDns(const QString &ipv6FirDns)
|
||||
{
|
||||
firstDnsEdit->setText(ipv6FirDns);
|
||||
}
|
||||
|
||||
void Ipv6Page::setIpv6SecDns(const QString &ipv6SecDns)
|
||||
{
|
||||
secondDnsEdit->setText(ipv6SecDns);
|
||||
}
|
||||
|
||||
void Ipv6Page::setGateWay(const QString &gateWay)
|
||||
{
|
||||
gateWayEdit->setText(gateWay);
|
||||
}
|
||||
|
||||
bool Ipv6Page::checkIsChanged(const ConInfo info, KyConnectSetting &setting)
|
||||
{
|
||||
bool isChanged = false;
|
||||
if (ipv6ConfigCombox->currentIndex() == AUTO_CONFIG) {
|
||||
if (info.ipv6ConfigType != CONFIG_IP_DHCP) {
|
||||
qDebug() << "ipv6ConfigType change to Auto";
|
||||
setting.setIpConfigType(IPADDRESS_V6, CONFIG_IP_DHCP);
|
||||
QString ipv6address("");
|
||||
QString prefix("");
|
||||
QString gateWay("");
|
||||
QStringList dnsList;
|
||||
dnsList.empty();
|
||||
setting.ipv6AddressConstruct(ipv6address, prefix, gateWay, dnsList);
|
||||
isChanged = true;
|
||||
}
|
||||
} else {
|
||||
if (info.ipv6ConfigType != CONFIG_IP_MANUAL) {
|
||||
qDebug() << "ipv6ConfigType change to Manual";
|
||||
setting.setIpConfigType(IPADDRESS_V6, CONFIG_IP_MANUAL);
|
||||
isChanged = true;
|
||||
}
|
||||
if(info.strIPV6Address != ipv6AddressEdit->text()
|
||||
|| info.iIPV6Prefix != lengthEdit->text().toInt()
|
||||
|| info.strIPV6GateWay != gateWayEdit->text()
|
||||
|| info.strIPV6FirDns != firstDnsEdit->text()
|
||||
|| info.strIPV6SecDns != secondDnsEdit->text()) {
|
||||
|
||||
qDebug() << "ipv6 info changed";
|
||||
QStringList dnsList;
|
||||
dnsList.empty();
|
||||
if (!firstDnsEdit->text().isEmpty()) {
|
||||
dnsList << firstDnsEdit->text();
|
||||
if (!secondDnsEdit->text().isEmpty()) {
|
||||
dnsList << secondDnsEdit->text();
|
||||
}
|
||||
}
|
||||
|
||||
QString ipv6address =ipv6AddressEdit->text();
|
||||
QString prefix = lengthEdit->text();
|
||||
QString gateWay = gateWayEdit->text();
|
||||
setting.ipv6AddressConstruct(ipv6address, prefix, gateWay, dnsList);
|
||||
setting.dumpInfo();
|
||||
isChanged = true;
|
||||
}
|
||||
}
|
||||
return isChanged;
|
||||
}
|
||||
|
||||
void Ipv6Page::initUI() {
|
||||
ipv6ConfigCombox = new QComboBox(this);
|
||||
ipv6AddressEdit = new LineEdit(this);
|
||||
lengthEdit = new LineEdit(this);
|
||||
gateWayEdit = new LineEdit(this);
|
||||
firstDnsEdit = new LineEdit(this);
|
||||
secondDnsEdit = new LineEdit(this);
|
||||
|
||||
m_configLabel = new QLabel(this);
|
||||
m_addressLabel = new QLabel(this);
|
||||
m_subnetLabel = new QLabel(this);
|
||||
m_gateWayLabel = new QLabel(this);
|
||||
m_dnsLabel = new QLabel(this);
|
||||
m_secDnsLabel = new QLabel(this);
|
||||
|
||||
|
||||
m_configLabel->setText(tr("Ipv6Config"));
|
||||
m_addressLabel->setText(tr("Address"));
|
||||
m_subnetLabel->setText(tr("Subnet prefix Length"));
|
||||
m_gateWayLabel->setText(tr("Default Gateway"));
|
||||
m_dnsLabel->setText(tr("Prefs DNS"));
|
||||
m_secDnsLabel->setText(tr("Alternative DNS"));
|
||||
|
||||
|
||||
m_detailLayout = new QFormLayout(this);
|
||||
m_detailLayout->addRow(m_configLabel,ipv6ConfigCombox);
|
||||
m_detailLayout->addRow(m_addressLabel,ipv6AddressEdit);
|
||||
m_detailLayout->addRow(m_subnetLabel,lengthEdit);
|
||||
m_detailLayout->addRow(m_gateWayLabel,gateWayEdit);
|
||||
m_detailLayout->addRow(m_dnsLabel,firstDnsEdit);
|
||||
m_detailLayout->addRow(m_secDnsLabel,secondDnsEdit);
|
||||
|
||||
ipv6ConfigCombox->addItem(tr("Auto(DHCP)")); //"自动(DHCP)"
|
||||
ipv6ConfigCombox->addItem(tr("Manual")); //"手动"
|
||||
|
||||
QRegExp ipv6_rx("^\\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(%.+)?\\s*$");
|
||||
ipv6AddressEdit->setValidator(new QRegExpValidator(ipv6_rx, this));
|
||||
gateWayEdit->setValidator(new QRegExpValidator(ipv6_rx, this));
|
||||
firstDnsEdit->setValidator(new QRegExpValidator(ipv6_rx, this));
|
||||
secondDnsEdit->setValidator(new QRegExpValidator(ipv6_rx, this));
|
||||
|
||||
QRegExp prefix_rx("\\b(?:(?:12[0-8]|1[0-1][0-9]|^[1-9][0-9]?$)\\.){3}(?:12[0-8]|1[0-1][0-9]|^[1-9][0-9]?$)\\b");
|
||||
lengthEdit->setValidator(new QRegExpValidator(prefix_rx,this));
|
||||
}
|
||||
|
||||
void Ipv6Page::initComponent() {
|
||||
if (ipv6ConfigCombox->currentIndex() == AUTO_CONFIG) {
|
||||
setControlEnabled(false);
|
||||
} else if (ipv6ConfigCombox->currentIndex() == MANUAL_CONFIG) {
|
||||
setControlEnabled(true);
|
||||
}
|
||||
connect(ipv6ConfigCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(configChanged(int)));
|
||||
|
||||
connect(ipv6ConfigCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEnableOfSaveBtn()));
|
||||
connect(ipv6AddressEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||
connect(lengthEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||
connect(gateWayEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||
connect(firstDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||
connect(secondDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||
}
|
||||
|
||||
void Ipv6Page::configChanged(int index) {
|
||||
if (index == AUTO_CONFIG) {
|
||||
setControlEnabled(false);
|
||||
}
|
||||
if (index == MANUAL_CONFIG) {
|
||||
setControlEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void Ipv6Page::setControlEnabled(bool check)
|
||||
{
|
||||
ipv6AddressEdit->setEnabled(check);
|
||||
lengthEdit->setEnabled(check);
|
||||
gateWayEdit->setEnabled(check);
|
||||
firstDnsEdit->setEnabled(check);
|
||||
secondDnsEdit->setEnabled(check);
|
||||
|
||||
if (!check) {
|
||||
ipv6AddressEdit->clear();
|
||||
lengthEdit->clear();
|
||||
gateWayEdit->clear();
|
||||
firstDnsEdit->clear();
|
||||
secondDnsEdit->clear();
|
||||
}
|
||||
}
|
||||
|
||||
void Ipv6Page::setEnableOfSaveBtn()
|
||||
{
|
||||
Q_EMIT setIpv6PageState(checkConnectBtnIsEnabled());
|
||||
}
|
||||
|
||||
bool Ipv6Page::checkConnectBtnIsEnabled()
|
||||
{
|
||||
if (ipv6ConfigCombox->currentIndex() == AUTO_CONFIG) {
|
||||
return true;
|
||||
} else {
|
||||
if (ipv6AddressEdit->text().isEmpty() || !getIpv6EditState(ipv6AddressEdit->text())) {
|
||||
qDebug() << "ipv6address empty or invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (lengthEdit->text().isEmpty()) {
|
||||
qDebug() << "ipv6 prefix length empty";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (gateWayEdit->text().isEmpty() || !getIpv6EditState(gateWayEdit->text())) {
|
||||
qDebug() << "ipv6 gateway empty or invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (firstDnsEdit->text().isEmpty() && !secondDnsEdit->text().isEmpty()) {
|
||||
qDebug() << "ipv6 dns sort invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!getIpv6EditState(firstDnsEdit->text())) {
|
||||
qDebug() << "ipv6 first dns invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!getIpv6EditState(secondDnsEdit->text())) {
|
||||
qDebug() << "ipv6 second dns invalid";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Ipv6Page::getIpv6EditState(QString text)
|
||||
{
|
||||
if (text.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
QRegExp rx("^\\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(%.+)?\\s*$");
|
||||
|
||||
bool match = false;
|
||||
match = rx.exactMatch(text);
|
||||
|
||||
return match;
|
||||
}
|
||||
|
||||
int Ipv6Page::getPerfixLength(QString text)
|
||||
{
|
||||
qDebug() << "getPerfixLength" << text;
|
||||
int length = 0;
|
||||
QStringList list= text.split(":");
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
QString temp = list.at(i);
|
||||
if (temp.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
bool ok;
|
||||
unsigned int val = temp.toUInt(&ok, 16);
|
||||
temp = temp.setNum(val,2);
|
||||
for(int j = 0; j < temp.length(); ++j) {
|
||||
if (temp.at(j) == "1") {
|
||||
length++;
|
||||
}
|
||||
}
|
||||
}
|
||||
qDebug() << "getPerfixLength" << length;
|
||||
return length;
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
#ifndef IPV6PAGE_H
|
||||
#define IPV6PAGE_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QLayout>
|
||||
#include <QFormLayout>
|
||||
#include <QLabel>
|
||||
#include <QPainter>
|
||||
#include <QCheckBox>
|
||||
#include <QScrollArea>
|
||||
#include <QSpacerItem>
|
||||
#include <QComboBox>
|
||||
#include <QLineEdit>
|
||||
|
||||
//#include "kylinconnectsetting.h"
|
||||
#include "coninfo.h"
|
||||
|
||||
class Ipv6Page : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Ipv6Page(QWidget *parent = nullptr);
|
||||
void setIpv6Config(KyIpConfigType ipv6Config);
|
||||
void setIpv6(const QString &ipv6);
|
||||
void setIpv6Perfix(const int &ipv6Perfix);
|
||||
void setIpv6FirDns(const QString &ipv6FirDns);
|
||||
void setIpv6SecDns(const QString &ipv6SecDns);
|
||||
void setGateWay(const QString &gateWay);
|
||||
|
||||
bool checkIsChanged(const ConInfo info, KyConnectSetting &setting);
|
||||
|
||||
int getPerfixLength(QString text);
|
||||
|
||||
public:
|
||||
QComboBox *ipv6ConfigCombox;
|
||||
LineEdit *ipv6AddressEdit;
|
||||
LineEdit *lengthEdit;
|
||||
LineEdit *gateWayEdit;
|
||||
LineEdit *firstDnsEdit;
|
||||
LineEdit *secondDnsEdit;
|
||||
private:
|
||||
QFormLayout *m_detailLayout;
|
||||
QLabel *m_configLabel;
|
||||
QLabel *m_addressLabel;
|
||||
QLabel *m_subnetLabel;
|
||||
QLabel *m_gateWayLabel;
|
||||
QLabel *m_dnsLabel;
|
||||
QLabel *m_secDnsLabel;
|
||||
private:
|
||||
void initUI();
|
||||
void initComponent();
|
||||
void setControlEnabled(bool check);
|
||||
|
||||
bool getIpv6EditState(QString text);
|
||||
|
||||
bool checkConnectBtnIsEnabled();
|
||||
|
||||
private Q_SLOTS:
|
||||
void configChanged(int index);
|
||||
void setEnableOfSaveBtn();
|
||||
|
||||
Q_SIGNALS:
|
||||
void setIpv6PageState(bool);
|
||||
};
|
||||
|
||||
#endif // IPV6PAGE_H
|
|
@ -0,0 +1,950 @@
|
|||
#include <QGSettings>
|
||||
|
||||
#include "netdetail.h"
|
||||
#include "kylin-tool/kylinipv4arping.h"
|
||||
#include "kylin-tool/kylinipv6arping.h"
|
||||
//#include "xatom/xatom-helper.h"
|
||||
|
||||
|
||||
#define THEME_SCHAME "org.ukui.style"
|
||||
#define COLOR_THEME "styleName"
|
||||
|
||||
#include <QEvent>
|
||||
#include <QMenu>
|
||||
|
||||
#define WINDOW_WIDTH 520
|
||||
#define WINDOW_HEIGHT 590
|
||||
#define BUTTON_SIZE 30
|
||||
#define ICON_SIZE 22,22
|
||||
#define TITLE_LAYOUT_MARGINS 9,9,0,0
|
||||
#define LAYOUT_MARGINS 24,0,24,0
|
||||
#define BOTTOM_LAYOUT_SPACING 16
|
||||
#define PAGE_LAYOUT_SPACING 1
|
||||
#define DETAIL_PAGE_NUM 0
|
||||
#define IPV4_PAGE_NUM 1
|
||||
#define IPV6_PAGE_NUM 2
|
||||
#define SECURITY_PAGE_NUM 3
|
||||
#define CREATE_NET_PAGE_NUM 4
|
||||
#define PAGE_MIN_HEIGHT 40
|
||||
|
||||
//extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed);
|
||||
|
||||
void NetDetail::showDesktopNotify(const QString &message)
|
||||
{
|
||||
QDBusInterface iface("org.freedesktop.Notifications",
|
||||
"/org/freedesktop/Notifications",
|
||||
"org.freedesktop.Notifications",
|
||||
QDBusConnection::sessionBus());
|
||||
QList<QVariant> args;
|
||||
args<<(tr("Kylin NM"))
|
||||
<<((unsigned int) 0)
|
||||
<<QString("/usr/share/icons/ukui-icon-theme-default/24x24/devices/gnome-dev-ethernet.png")
|
||||
<<tr("kylin network desktop message") //显示的是什么类型的信息
|
||||
<<message //显示的具体信息
|
||||
<<QStringList()
|
||||
<<QVariantMap()
|
||||
<<(int)-1;
|
||||
iface.callWithArgumentList(QDBus::AutoDetect,"Notify",args);
|
||||
}
|
||||
|
||||
void NetDetail::setNetdetailSomeEnable(bool on)
|
||||
{
|
||||
detailPage->setEnabled(on);
|
||||
ipv4Page->setEnabled(on);
|
||||
ipv6Page->setEnabled(on);
|
||||
securityPage->setEnabled(on);
|
||||
createNetPage->setEnabled(on);
|
||||
cancelBtn->setEnabled(on);
|
||||
forgetBtn->setEnabled(on);
|
||||
confimBtn->setEnabled(on);
|
||||
}
|
||||
|
||||
NetDetail::NetDetail(QString interface, QString name, QString uuid, bool isActive, bool isWlan, bool isCreateNet, QWidget *parent)
|
||||
:m_deviceName(interface),
|
||||
m_name(name),
|
||||
m_uuid(uuid),
|
||||
isActive(isActive),
|
||||
isWlan(isWlan),
|
||||
m_isCreateNet(isCreateNet),
|
||||
QWidget(parent)
|
||||
{
|
||||
//设置窗口无边框,阴影
|
||||
//#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
||||
// MotifWmHints window_hints;
|
||||
// window_hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
|
||||
// window_hints.functions = MWM_FUNC_ALL;
|
||||
// window_hints.decorations = MWM_DECOR_BORDER;
|
||||
// XAtomHelper::getInstance()->setWindowMotifHint(this->winId(), window_hints);
|
||||
//#else
|
||||
// this->setWindowFlags(Qt::Dialog /*| Qt::FramelessWindowHint*/);
|
||||
this->setWindowFlag(Qt::Window);
|
||||
//#endif
|
||||
// this->setProperty("useStyleWindowManager", false); //禁用拖动
|
||||
// setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint );
|
||||
// setAttribute(Qt::WA_TranslucentBackground);
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
setFixedSize(WINDOW_WIDTH,WINDOW_HEIGHT);
|
||||
centerToScreen();
|
||||
|
||||
qDebug() << m_isCreateNet << name;
|
||||
if (!m_isCreateNet && name.isEmpty()) {
|
||||
m_isCreateNet = true;
|
||||
}
|
||||
qDebug() << m_isCreateNet;
|
||||
m_netDeviceResource = new KyNetworkDeviceResourse(this);
|
||||
m_wirelessConnOpration = new KyWirelessConnectOperation(this);
|
||||
m_resource = new KyWirelessNetResource(this);
|
||||
m_connectOperation = new KyConnectOperation(this);
|
||||
m_wiredConnOperation = new KyWiredConnectOperation(this);
|
||||
initUI();
|
||||
loadPage();
|
||||
initComponent();
|
||||
getConInfo(m_info);
|
||||
pagePadding(name,isWlan);
|
||||
|
||||
connect(qApp, &QApplication::paletteChanged, this, &NetDetail::onPaletteChanged);
|
||||
|
||||
isCreateOk = !(m_isCreateNet && !isWlan);
|
||||
isDetailOk = !(m_name.isEmpty());
|
||||
isIpv4Ok = true;
|
||||
isIpv6Ok = true;
|
||||
isSecuOk = true;
|
||||
|
||||
qDebug() << interface << name << uuid << "isWlan" << isWlan << "isCreateNet" <<m_isCreateNet;
|
||||
|
||||
setConfirmEnable();
|
||||
}
|
||||
|
||||
NetDetail::~NetDetail()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void NetDetail::onPaletteChanged()
|
||||
{
|
||||
QPalette pal = qApp->palette();
|
||||
|
||||
QGSettings * styleGsettings = nullptr;
|
||||
const QByteArray style_id(THEME_SCHAME);
|
||||
if (QGSettings::isSchemaInstalled(style_id)) {
|
||||
styleGsettings = new QGSettings(style_id);
|
||||
QString currentTheme = styleGsettings->get(COLOR_THEME).toString();
|
||||
if(currentTheme == "ukui-default"){
|
||||
pal = lightPalette(this);
|
||||
}
|
||||
}
|
||||
|
||||
this->setPalette(pal);
|
||||
|
||||
setFramePalette(detailPage, pal);
|
||||
setFramePalette(ipv4Page, pal);
|
||||
setFramePalette(ipv6Page, pal);
|
||||
setFramePalette(securityPage, pal);
|
||||
setFramePalette(createNetPage, pal);
|
||||
|
||||
QPalette listwidget_pal(detailPage->m_listWidget->palette());
|
||||
listwidget_pal.setColor(QPalette::Base, this->palette().base().color());
|
||||
listwidget_pal.setColor(QPalette::AlternateBase, this->palette().alternateBase().color());
|
||||
detailPage->m_listWidget->setAlternatingRowColors(true);
|
||||
detailPage->m_listWidget->setPalette(listwidget_pal);
|
||||
|
||||
}
|
||||
|
||||
void NetDetail::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
return QWidget::paintEvent(event);
|
||||
}
|
||||
|
||||
void NetDetail::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
Q_EMIT this->detailPageClose(false);
|
||||
Q_EMIT this->createPageClose(m_deviceName);
|
||||
return QWidget::closeEvent(event);
|
||||
|
||||
}
|
||||
|
||||
void NetDetail::centerToScreen()
|
||||
{
|
||||
QDesktopWidget* m = QApplication::desktop();
|
||||
QRect desk_rect = m->screenGeometry(m->screenNumber(QCursor::pos()));
|
||||
int desk_x = desk_rect.width();
|
||||
int desk_y = desk_rect.height();
|
||||
int x = this->width();
|
||||
int y = this->height();
|
||||
this->move(desk_x / 2 - x / 2 + desk_rect.left(), desk_y / 2 - y / 2 + desk_rect.top());
|
||||
}
|
||||
|
||||
void NetDetail::initUI()
|
||||
{
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
||||
mainLayout->setContentsMargins(9,9,14,24);
|
||||
|
||||
detailPage = new DetailPage(isWlan, m_name.isEmpty(), this);
|
||||
ipv4Page = new Ipv4Page(this);
|
||||
ipv6Page = new Ipv6Page(this);
|
||||
securityPage = new SecurityPage(this);
|
||||
createNetPage = new CreatNetPage(this);
|
||||
|
||||
this->installEventFilter(this);
|
||||
|
||||
centerWidget = new QWidget(this);
|
||||
bottomWidget = new QWidget(this);
|
||||
|
||||
stackWidget = new QStackedWidget(centerWidget);
|
||||
stackWidget->addWidget(detailPage);
|
||||
stackWidget->addWidget(ipv4Page);
|
||||
stackWidget->addWidget(ipv6Page);
|
||||
stackWidget->addWidget(securityPage);
|
||||
stackWidget->addWidget(createNetPage);
|
||||
|
||||
mainLayout->addWidget(centerWidget);
|
||||
mainLayout->addWidget(bottomWidget);
|
||||
|
||||
bottomWidget->setMinimumHeight(PAGE_MIN_HEIGHT);
|
||||
|
||||
pageFrame = new QFrame(this);
|
||||
|
||||
QHBoxLayout *pageLayout = new QHBoxLayout(pageFrame);
|
||||
pageLayout->setSpacing(PAGE_LAYOUT_SPACING);
|
||||
|
||||
detailBtn = new QPushButton(this);
|
||||
detailBtn->setText(tr("Detail"));
|
||||
detailBtn->setCheckable(true);
|
||||
detailBtn->setChecked(true);
|
||||
|
||||
ipv4Btn = new QPushButton(this);
|
||||
ipv4Btn->setText(tr("Ipv4"));
|
||||
ipv4Btn->setCheckable(true);
|
||||
|
||||
ipv6Btn = new QPushButton(this);
|
||||
ipv6Btn->setText(tr("Ipv6"));
|
||||
ipv6Btn->setCheckable(true);
|
||||
|
||||
securityBtn = new QPushButton(this);
|
||||
securityBtn->setText(tr("Security"));
|
||||
securityBtn->setCheckable(true);
|
||||
|
||||
m_group = new QButtonGroup(this);
|
||||
m_group->addButton(detailBtn);
|
||||
m_group->addButton(ipv4Btn);
|
||||
m_group->addButton(ipv6Btn);
|
||||
if (isWlan) {
|
||||
m_group->addButton(securityBtn);
|
||||
}
|
||||
|
||||
pageLayout->addStretch();
|
||||
pageLayout->addWidget(detailBtn);
|
||||
pageLayout->addWidget(ipv4Btn);
|
||||
pageLayout->addWidget(ipv6Btn);
|
||||
pageLayout->addWidget(securityBtn);
|
||||
pageLayout->addStretch();
|
||||
|
||||
confimBtn = new QPushButton(this);
|
||||
confimBtn->setText(tr("Confirm"));
|
||||
|
||||
cancelBtn = new QPushButton(this);
|
||||
cancelBtn->setText(tr("Cancel"));
|
||||
|
||||
forgetBtn = new QPushButton(this);
|
||||
forgetBtn->setText(tr("Forget this network"));
|
||||
|
||||
this->setWindowIcon(QIcon::fromTheme("kylin-network"));
|
||||
|
||||
QVBoxLayout *centerlayout = new QVBoxLayout(centerWidget);
|
||||
centerlayout->setContentsMargins(LAYOUT_MARGINS);
|
||||
centerlayout->addWidget(pageFrame);
|
||||
centerlayout->addWidget(stackWidget);
|
||||
|
||||
QHBoxLayout *bottomLayout = new QHBoxLayout(bottomWidget);
|
||||
bottomLayout->setContentsMargins(LAYOUT_MARGINS);
|
||||
bottomLayout->setSpacing(BOTTOM_LAYOUT_SPACING);
|
||||
bottomLayout->addWidget(forgetBtn);
|
||||
bottomLayout->addStretch();
|
||||
bottomLayout->addWidget(cancelBtn);
|
||||
bottomLayout->addWidget(confimBtn);
|
||||
|
||||
// QPalette pal(this->palette());
|
||||
// pal.setColor(QPalette::Background, qApp->palette().base().color());
|
||||
this->setAutoFillBackground(true);
|
||||
// this->setPalette(pal);
|
||||
onPaletteChanged();
|
||||
}
|
||||
|
||||
void NetDetail::loadPage()
|
||||
{
|
||||
//判断是否创建网络页面
|
||||
if (m_isCreateNet && !isWlan) {
|
||||
pageFrame->hide();
|
||||
stackWidget->setCurrentIndex(CREATE_NET_PAGE_NUM);
|
||||
this->setWindowTitle(tr("Add Lan Connect"));
|
||||
} else {
|
||||
stackWidget->setCurrentIndex(DETAIL_PAGE_NUM);
|
||||
this->setWindowTitle(m_name);
|
||||
if (!isWlan) {
|
||||
securityBtn->hide();
|
||||
} else {
|
||||
securityBtn->show();
|
||||
if (m_name.isEmpty()) {
|
||||
this->setWindowTitle(tr("connect hiddin wlan"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NetDetail::initComponent()
|
||||
{
|
||||
connect(cancelBtn, &QPushButton::clicked, this, [=] {
|
||||
close();
|
||||
});
|
||||
connect(detailBtn, &QPushButton::clicked, this, [=] {
|
||||
stackWidget->setCurrentIndex(DETAIL_PAGE_NUM);
|
||||
});
|
||||
connect(ipv4Btn, &QPushButton::clicked, this, [=] {
|
||||
stackWidget->setCurrentIndex(IPV4_PAGE_NUM);
|
||||
});
|
||||
connect(ipv6Btn, &QPushButton::clicked, this, [=] {
|
||||
stackWidget->setCurrentIndex(IPV6_PAGE_NUM);
|
||||
});
|
||||
connect(securityBtn, &QPushButton::clicked, this, [=] {
|
||||
stackWidget->setCurrentIndex(SECURITY_PAGE_NUM);
|
||||
});
|
||||
connect(confimBtn, SIGNAL(clicked()), this, SLOT(on_btnConfirm_clicked()));
|
||||
if (isWlan && !m_uuid.isEmpty()) {
|
||||
forgetBtn->show();
|
||||
connect(forgetBtn, SIGNAL(clicked()), this, SLOT(on_btnForget_clicked()));
|
||||
} else {
|
||||
forgetBtn->hide();
|
||||
}
|
||||
|
||||
connect(createNetPage, &CreatNetPage::setCreatePageState, this, [=](bool status) {
|
||||
isCreateOk = status;
|
||||
setConfirmEnable();
|
||||
});
|
||||
|
||||
connect(detailPage, &DetailPage::setDetailPageState, this, [=](bool status) {
|
||||
isDetailOk = status;
|
||||
setConfirmEnable();
|
||||
});
|
||||
|
||||
connect(ipv4Page, &Ipv4Page::setIpv4PageState, this, [=](bool status) {
|
||||
isIpv4Ok = status;
|
||||
setConfirmEnable();
|
||||
});
|
||||
|
||||
connect(ipv6Page, &Ipv6Page::setIpv6PageState, this, [=](bool status) {
|
||||
isIpv6Ok = status;
|
||||
setConfirmEnable();
|
||||
});
|
||||
|
||||
connect(securityPage, &SecurityPage::setSecuPageState, this, [=](bool status) {
|
||||
isSecuOk = status;
|
||||
setConfirmEnable();
|
||||
});
|
||||
}
|
||||
|
||||
void NetDetail::pagePadding(QString netName, bool isWlan)
|
||||
{
|
||||
//网络详情页填充
|
||||
if(m_isCreateNet && !isWlan) {
|
||||
return;
|
||||
}
|
||||
|
||||
detailPage->setSSID(netName);
|
||||
detailPage->setProtocol(m_info.strConType);
|
||||
detailPage->setSecType(m_info.strSecType);
|
||||
detailPage->setHz(m_info.strHz);
|
||||
detailPage->setChan(m_info.strChan);
|
||||
detailPage->setIpv4(m_info.strDynamicIpv4);
|
||||
detailPage->setIpv4Dns(m_info.strDynamicIpv4Dns);
|
||||
detailPage->setIpv6(m_info.strDynamicIpv6);
|
||||
detailPage->setMac(m_info.strMac);
|
||||
detailPage->setBandWidth(m_info.strBandWidth);
|
||||
detailPage->setAutoConnect(m_info.isAutoConnect);
|
||||
|
||||
//ipv4页面填充
|
||||
if (m_info.ipv4ConfigType == CONFIG_IP_MANUAL) {
|
||||
ipv4Page->setIpv4Config(m_info.ipv4ConfigType);
|
||||
ipv4Page->setIpv4(m_info.strIPV4Address);
|
||||
ipv4Page->setNetMask(m_info.strIPV4NetMask);
|
||||
ipv4Page->setIpv4FirDns(m_info.strIPV4FirDns);
|
||||
ipv4Page->setIpv4SecDns(m_info.strIPV4SecDns);
|
||||
ipv4Page->setGateWay(m_info.strIPV4GateWay);
|
||||
} else {
|
||||
ipv4Page->setIpv4Config(m_info.ipv4ConfigType);
|
||||
}
|
||||
//ipv6页面填充
|
||||
if (m_info.ipv6ConfigType == CONFIG_IP_MANUAL) {
|
||||
ipv6Page->setIpv6Config(m_info.ipv6ConfigType);
|
||||
ipv6Page->setIpv6(m_info.strIPV6Address);
|
||||
ipv6Page->setIpv6Perfix(m_info.iIPV6Prefix);
|
||||
ipv6Page->setIpv6FirDns(m_info.strIPV6FirDns);
|
||||
ipv6Page->setIpv6SecDns(m_info.strIPV6SecDns);
|
||||
ipv6Page->setGateWay(m_info.strIPV6GateWay);
|
||||
} else {
|
||||
ipv6Page->setIpv6Config(m_info.ipv6ConfigType);
|
||||
}
|
||||
|
||||
//安全页面
|
||||
if (isWlan) {
|
||||
securityPage->setSecurity(m_info.secType);
|
||||
qDebug() << "setSecurity" << m_info.secType;
|
||||
if (m_info.secType == WPA_AND_WPA2_ENTERPRISE) {
|
||||
if (m_info.enterpriseType == TLS) {
|
||||
securityPage->setTlsInfo(m_info.tlsInfo);
|
||||
} else if (m_info.enterpriseType == PEAP) {
|
||||
securityPage->setPeapInfo(m_info.peapInfo);
|
||||
} else if (m_info.enterpriseType == TTLS) {
|
||||
securityPage->setTtlsInfo(m_info.ttlsInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//获取网路详情信息
|
||||
void NetDetail::getConInfo(ConInfo &conInfo)
|
||||
{
|
||||
if (m_isCreateNet && !isWlan) {
|
||||
return;
|
||||
}
|
||||
getBaseInfo(conInfo);
|
||||
getDynamicIpInfo(conInfo, isActive);
|
||||
getStaticIpInfo(conInfo,isActive);
|
||||
}
|
||||
|
||||
|
||||
//详情ssid 带宽 物理地址 无线额外(安全性 频带 通道)
|
||||
void NetDetail::getBaseInfo(ConInfo &conInfo)
|
||||
{
|
||||
//有线无线公有
|
||||
conInfo.strConName = m_name;
|
||||
|
||||
QString hardAddress;
|
||||
int bandWith;
|
||||
m_netDeviceResource->getHardwareInfo(m_deviceName, hardAddress, bandWith);
|
||||
|
||||
if (!hardAddress.isEmpty()) {
|
||||
conInfo.strBandWidth = QString("%1").arg(bandWith/1000) + "Mbps";
|
||||
conInfo.strMac = hardAddress;
|
||||
}
|
||||
|
||||
if (!isWlan) {
|
||||
conInfo.strConType = "802-3-ethernet";
|
||||
} else {
|
||||
conInfo.strConType = "802-11-wireless";
|
||||
if (!isActive) {
|
||||
KyWirelessNetItem item;
|
||||
if (!m_resource->getWifiNetwork(m_deviceName, m_name, item)) {
|
||||
qDebug() << "getWifiNetWork failed device:" << m_deviceName << " name:" << m_name;
|
||||
return;
|
||||
} else {
|
||||
conInfo.strHz = QString::number(item.m_frequency);
|
||||
conInfo.strChan = QString::number(item.m_channel);
|
||||
//无线特有
|
||||
conInfo.strSecType = item.m_secuType;
|
||||
if (conInfo.strSecType.isEmpty()) {
|
||||
conInfo.strSecType = tr("None");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
uint iHz,iChan;
|
||||
QString strMac;
|
||||
m_netDeviceResource->getDeviceActiveAPInfo(m_deviceName, strMac, iHz, iChan, conInfo.strSecType);
|
||||
if (conInfo.strSecType.isEmpty()) {
|
||||
conInfo.strSecType = tr("None");
|
||||
}
|
||||
conInfo.strHz = QString::number(iHz);
|
||||
conInfo.strChan = QString::number(iChan);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
KyKeyMgmt type = m_wirelessConnOpration->getConnectKeyMgmt(m_uuid);
|
||||
if (type == WpaNone || type == Unknown) {
|
||||
conInfo.secType = NONE;
|
||||
} else if (type == WpaPsk) {
|
||||
conInfo.secType = WPA_AND_WPA2_PERSONAL;
|
||||
} else if (type == SAE) {
|
||||
conInfo.secType = WPA3_PERSONAL;
|
||||
} else if (type == WpaEap) {
|
||||
conInfo.secType = WPA_AND_WPA2_ENTERPRISE;
|
||||
} else {
|
||||
qDebug() << "KeyMgmt not support now " << type;
|
||||
}
|
||||
|
||||
initSecuData();
|
||||
}
|
||||
}
|
||||
|
||||
//详情ipv4 ipv6 ipv4Dns
|
||||
void NetDetail::getDynamicIpInfo(ConInfo &conInfo, bool bActived)
|
||||
{
|
||||
if (!bActived) {
|
||||
return;
|
||||
}
|
||||
//已激活的网络 详情页显示动态ipv4 ipv6 dns
|
||||
QString ipv4,ipv6;
|
||||
QList<QHostAddress> ipv4Dns,ipv6Dns;
|
||||
KyActiveConnectResourse *activeResourse = new KyActiveConnectResourse(this);
|
||||
activeResourse->getActiveConnectIpInfo(m_uuid,ipv4,ipv6);
|
||||
activeResourse->getActiveConnectDnsInfo(m_uuid,ipv4Dns,ipv6Dns);
|
||||
|
||||
//Ipv6
|
||||
if (!ipv6.isEmpty()) {
|
||||
conInfo.strDynamicIpv6 = ipv6;
|
||||
}
|
||||
|
||||
//IPv4
|
||||
if (!ipv4.isEmpty()) {
|
||||
conInfo.strDynamicIpv4 = ipv4;
|
||||
}
|
||||
|
||||
if (!ipv4Dns.isEmpty()) {
|
||||
conInfo.strDynamicIpv4Dns = ipv4Dns.at(0).toString();
|
||||
}
|
||||
}
|
||||
|
||||
//ipv4+ipv6页面
|
||||
void NetDetail::getStaticIpInfo(ConInfo &conInfo, bool bActived)
|
||||
{
|
||||
KyConnectResourse *kyConnectResourse = new KyConnectResourse(this);
|
||||
KyConnectSetting connetSetting;
|
||||
kyConnectResourse->getConnectionSetting(m_uuid,connetSetting);
|
||||
connetSetting.dumpInfo();
|
||||
|
||||
conInfo.ipv4ConfigType = connetSetting.m_ipv4ConfigIpType;
|
||||
conInfo.ipv6ConfigType = connetSetting.m_ipv6ConfigIpType;
|
||||
conInfo.isAutoConnect = connetSetting.m_isAutoConnect;
|
||||
|
||||
if (connetSetting.m_ipv4ConfigIpType == CONFIG_IP_MANUAL) {
|
||||
if (connetSetting.m_ipv4Address.size() > 0) {
|
||||
conInfo.strIPV4Address = connetSetting.m_ipv4Address.at(0).ip().toString();
|
||||
conInfo.strIPV4NetMask = connetSetting.m_ipv4Address.at(0).netmask().toString();
|
||||
conInfo.strIPV4GateWay = connetSetting.m_ipv4Address.at(0).gateway().toString();
|
||||
}
|
||||
if (connetSetting.m_ipv4Dns.size() == 1) {
|
||||
conInfo.strIPV4FirDns = connetSetting.m_ipv4Dns.at(0).toString();
|
||||
} else if (connetSetting.m_ipv4Dns.size() > 1) {
|
||||
conInfo.strIPV4FirDns = connetSetting.m_ipv4Dns.at(0).toString();
|
||||
conInfo.strIPV4SecDns = connetSetting.m_ipv4Dns.at(1).toString();
|
||||
}
|
||||
}
|
||||
|
||||
if (connetSetting.m_ipv6ConfigIpType == CONFIG_IP_MANUAL) {
|
||||
if (connetSetting.m_ipv6Address.size() > 0) {
|
||||
conInfo.strIPV6Address = connetSetting.m_ipv6Address.at(0).ip().toString();
|
||||
conInfo.iIPV6Prefix = ipv6Page->getPerfixLength(connetSetting.m_ipv6Address.at(0).netmask().toString());
|
||||
conInfo.strIPV6GateWay = connetSetting.m_ipv6Address.at(0).gateway().toString();
|
||||
}
|
||||
|
||||
if (connetSetting.m_ipv6Dns.size() == 1) {
|
||||
conInfo.strIPV6FirDns = connetSetting.m_ipv6Dns.at(0).toString();
|
||||
} else if (connetSetting.m_ipv4Dns.size() > 1) {
|
||||
conInfo.strIPV6FirDns = connetSetting.m_ipv6Dns.at(0).toString();
|
||||
conInfo.strIPV6SecDns = connetSetting.m_ipv6Dns.at(1).toString();
|
||||
}
|
||||
}
|
||||
|
||||
if (!bActived) {
|
||||
conInfo.strDynamicIpv4 = conInfo.strIPV4Address.isEmpty() ? tr("Auto") : conInfo.strIPV4Address;
|
||||
conInfo.strDynamicIpv6 = conInfo.strIPV6Address.isEmpty() ? tr("Auto") : conInfo.strIPV6Address;
|
||||
conInfo.strDynamicIpv4Dns = conInfo.strIPV4FirDns.isEmpty() ? tr("Auto") : conInfo.strIPV4FirDns;
|
||||
}
|
||||
}
|
||||
|
||||
void NetDetail::initSecuData()
|
||||
{
|
||||
QString password("");
|
||||
int type = m_info.secType;
|
||||
switch (type) {
|
||||
case NONE:
|
||||
break;
|
||||
case WPA_AND_WPA2_PERSONAL:
|
||||
case WPA3_PERSONAL:
|
||||
if (!m_uuid.isEmpty()) {
|
||||
NetworkManager::Setting::SecretFlags flag;
|
||||
if (m_wirelessConnOpration->getConnSecretFlags(m_uuid, flag)) {
|
||||
if (!flag) {
|
||||
password = m_wirelessConnOpration->getPsk(m_uuid);
|
||||
}
|
||||
}
|
||||
}
|
||||
m_info.strPassword = password;
|
||||
securityPage->setPsk(password);
|
||||
break;
|
||||
case WPA_AND_WPA2_ENTERPRISE:
|
||||
if (!m_wirelessConnOpration->getEnterpiseEapMethod(m_uuid, m_info.enterpriseType)) {
|
||||
qDebug() << m_name << "not enterprise wifi";
|
||||
} else if (m_info.enterpriseType == TLS){
|
||||
initTlsInfo(m_info);
|
||||
} else if (m_info.enterpriseType == PEAP){
|
||||
initPeapInfo(m_info);
|
||||
} else {
|
||||
initTtlsInfo(m_info);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void NetDetail::initTlsInfo(ConInfo &conInfo)
|
||||
{
|
||||
m_resource->getEnterPriseInfoTls(m_uuid, conInfo.tlsInfo);
|
||||
}
|
||||
|
||||
void NetDetail::initPeapInfo(ConInfo &conInfo)
|
||||
{
|
||||
m_resource->getEnterPriseInfoPeap(m_uuid, conInfo.peapInfo);
|
||||
}
|
||||
|
||||
void NetDetail::initTtlsInfo(ConInfo &conInfo)
|
||||
{
|
||||
m_resource->getEnterPriseInfoTtls(m_uuid, conInfo.ttlsInfo);
|
||||
}
|
||||
|
||||
//点击了保存更改网络设置的按钮
|
||||
void NetDetail::on_btnConfirm_clicked()
|
||||
{
|
||||
qDebug() << "on_btnConfirm_clicked";
|
||||
setNetdetailSomeEnable(false);
|
||||
if (m_isCreateNet) {
|
||||
if (!isWlan) {
|
||||
//新建有线连接
|
||||
qDebug() << "Confirm create wired connect";
|
||||
if (!createWiredConnect()) {
|
||||
setNetdetailSomeEnable(true);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
//新建无线连接
|
||||
qDebug() << "Confirm create wireless connect";
|
||||
if (!createWirelessConnect()) {
|
||||
setNetdetailSomeEnable(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//更新连接
|
||||
qDebug() << "Confirm update connect";
|
||||
if (!updateConnect()) {
|
||||
setNetdetailSomeEnable(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
close();
|
||||
}
|
||||
|
||||
//点击忘记网络
|
||||
void NetDetail::on_btnForget_clicked()
|
||||
{
|
||||
qDebug() << "user choose forget connection uuid = " << m_uuid;
|
||||
m_connectOperation->deleteConnect(m_uuid);
|
||||
close();
|
||||
}
|
||||
|
||||
void NetDetail::setConfirmEnable()
|
||||
{
|
||||
if (m_isCreateNet && !isWlan) {
|
||||
isConfirmBtnEnable = isCreateOk;
|
||||
} else {
|
||||
if (isDetailOk && isIpv4Ok && isIpv6Ok) {
|
||||
if (isWlan && !isSecuOk) {
|
||||
isConfirmBtnEnable = false;
|
||||
} else {
|
||||
isConfirmBtnEnable = true;
|
||||
}
|
||||
} else {
|
||||
isConfirmBtnEnable = false;
|
||||
}
|
||||
}
|
||||
qDebug() << "setConfirmEnable "<< isConfirmBtnEnable;
|
||||
confimBtn->setEnabled(isConfirmBtnEnable);
|
||||
}
|
||||
|
||||
bool NetDetail::checkIpv4Conflict(QString ipv4Address)
|
||||
{
|
||||
showDesktopNotify(tr("start check ipv4 address conflict"));
|
||||
bool isConflict = false;
|
||||
KyIpv4Arping* ipv4Arping = new KyIpv4Arping(m_deviceName, ipv4Address);
|
||||
|
||||
if (ipv4Arping->ipv4ConflictCheck() >= 0) {
|
||||
isConflict = ipv4Arping->ipv4IsConflict();
|
||||
} else {
|
||||
qWarning() << "checkIpv4Conflict internal error";
|
||||
}
|
||||
|
||||
delete ipv4Arping;
|
||||
ipv4Arping = nullptr;
|
||||
return isConflict;
|
||||
}
|
||||
|
||||
bool NetDetail::checkIpv6Conflict(QString ipv6address)
|
||||
{
|
||||
showDesktopNotify(tr("start check ipv6 address conflict"));
|
||||
bool isConflict = false;
|
||||
KyIpv6Arping* ipv46rping = new KyIpv6Arping(m_deviceName, ipv6address);
|
||||
|
||||
if (ipv46rping->ipv6ConflictCheck() >= 0) {
|
||||
isConflict = ipv46rping->ipv6IsConflict();
|
||||
} else {
|
||||
qWarning() << "checkIpv6Conflict internal error";
|
||||
}
|
||||
|
||||
delete ipv46rping;
|
||||
ipv46rping = nullptr;
|
||||
return isConflict;
|
||||
}
|
||||
|
||||
void NetDetail::updateWirelessPersonalConnect()
|
||||
{
|
||||
KyWirelessConnectSetting setting;
|
||||
securityPage->updateSecurityChange(setting);
|
||||
bool isPwdChanged = !(m_info.strPassword == setting.m_psk);
|
||||
m_wirelessConnOpration->updateWirelessPersonalConnect(m_uuid, setting, isPwdChanged);
|
||||
}
|
||||
|
||||
void NetDetail::updateWirelessEnterPriseConnect(KyEapMethodType enterpriseType)
|
||||
{
|
||||
if (enterpriseType == TLS) {
|
||||
m_info.tlsInfo.devIfaceName = m_deviceName;
|
||||
securityPage->updateTlsChange(m_info.tlsInfo);
|
||||
m_wirelessConnOpration->updateWirelessEnterPriseTlsConnect(m_uuid, m_info.tlsInfo);
|
||||
} else if (enterpriseType == PEAP) {
|
||||
securityPage->updatePeapChange(m_info.peapInfo);
|
||||
m_wirelessConnOpration->updateWirelessEnterPrisePeapConnect(m_uuid, m_info.peapInfo);
|
||||
} else if (enterpriseType == TTLS) {
|
||||
securityPage->updateTtlsChange(m_info.ttlsInfo);
|
||||
m_wirelessConnOpration->updateWirelessEnterPriseTtlsConnect(m_uuid, m_info.ttlsInfo);
|
||||
}
|
||||
}
|
||||
|
||||
bool NetDetail::createWiredConnect()
|
||||
{
|
||||
KyWirelessConnectSetting connetSetting;
|
||||
connetSetting.setIfaceName(m_deviceName);
|
||||
createNetPage->constructIpv4Info(connetSetting);
|
||||
if (connetSetting.m_ipv4ConfigIpType != CONFIG_IP_DHCP) {
|
||||
if (checkIpv4Conflict(connetSetting.m_ipv4Address.at(0).ip().toString())) {
|
||||
qDebug() << "ipv4 conflict";
|
||||
showDesktopNotify(tr("ipv4 address conflict!"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
m_wiredConnOperation->createWiredConnect(connetSetting);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool NetDetail::createWirelessConnect()
|
||||
{
|
||||
KyWirelessConnectSetting connetSetting;
|
||||
KySecuType secuType;
|
||||
KyEapMethodType enterpriseType;
|
||||
securityPage->getSecuType(secuType, enterpriseType);
|
||||
//类型判断
|
||||
if (!m_name.isEmpty()) {
|
||||
if (!checkWirelessSecurity(secuType)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//基本信息
|
||||
QString ssid;
|
||||
if (m_name.isEmpty()) {
|
||||
detailPage->getSsid(ssid);
|
||||
} else {
|
||||
ssid = m_name;
|
||||
}
|
||||
connetSetting.setConnectName(ssid);
|
||||
connetSetting.setIfaceName(m_deviceName);
|
||||
if (detailPage->checkIsChanged(m_info)) {
|
||||
connetSetting.isAutoConnect = !m_info.isAutoConnect;
|
||||
} else {
|
||||
connetSetting.isAutoConnect = m_info.isAutoConnect;
|
||||
}
|
||||
qDebug() << "isAutoConnect" << connetSetting.isAutoConnect;
|
||||
connetSetting.m_ssid = ssid;
|
||||
// connetSetting.m_secretFlag = NetworkManager::Setting::None;
|
||||
//由于X.h的None与此处的None有歧义,此处直接使用值
|
||||
connetSetting.m_secretFlag = 0;
|
||||
|
||||
//ipv4 & ipv6
|
||||
bool ipv4Change = ipv4Page->checkIsChanged(m_info, connetSetting);
|
||||
bool ipv6Change = ipv6Page->checkIsChanged(m_info, connetSetting);
|
||||
|
||||
connetSetting.dumpInfo();
|
||||
|
||||
qDebug() << "ipv4Changed" << ipv4Change << "ipv6Change" << ipv6Change;
|
||||
if (ipv4Change && connetSetting.m_ipv4ConfigIpType == CONFIG_IP_MANUAL) {
|
||||
if (checkIpv4Conflict(connetSetting.m_ipv4Address.at(0).ip().toString())) {
|
||||
qDebug() << "ipv4 conflict";
|
||||
showDesktopNotify(tr("ipv4 address conflict!"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (ipv6Change && connetSetting.m_ipv6ConfigIpType == CONFIG_IP_MANUAL) {
|
||||
if (checkIpv6Conflict(connetSetting.m_ipv6Address.at(0).ip().toString())) {
|
||||
qDebug() << "ipv6 conflict";
|
||||
showDesktopNotify(tr("ipv6 address conflict!"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//wifi安全性
|
||||
if (secuType == WPA_AND_WPA2_ENTERPRISE) {
|
||||
connetSetting.m_type = WpaEap;
|
||||
if (enterpriseType == TLS) {
|
||||
m_info.tlsInfo.devIfaceName = m_deviceName;
|
||||
securityPage->updateTlsChange(m_info.tlsInfo);
|
||||
if (!m_name.isEmpty()) {
|
||||
qDebug() << "add new TLS connect";
|
||||
m_wirelessConnOpration->addTlsConnect(connetSetting, m_info.tlsInfo);
|
||||
} else {
|
||||
qDebug() << "addAndConnect TLS connect";
|
||||
m_wirelessConnOpration->addAndActiveWirelessEnterPriseTlsConnect(m_info.tlsInfo, connetSetting, m_deviceName, true);
|
||||
}
|
||||
} else if (enterpriseType == PEAP) {
|
||||
securityPage->updatePeapChange(m_info.peapInfo);
|
||||
if (!m_name.isEmpty()) {
|
||||
qDebug() << "add new PEAP connect";
|
||||
m_wirelessConnOpration->addPeapConnect(connetSetting, m_info.peapInfo);
|
||||
} else {
|
||||
qDebug() << "addAndConnect PEAP connect";
|
||||
m_wirelessConnOpration->addAndActiveWirelessEnterPrisePeapConnect(m_info.peapInfo, connetSetting, m_deviceName, true);
|
||||
}
|
||||
} else if (enterpriseType == TTLS) {
|
||||
securityPage->updateTtlsChange(m_info.ttlsInfo);
|
||||
if (!m_name.isEmpty()) {
|
||||
qDebug() << "add new TTLS connect";
|
||||
m_wirelessConnOpration->addTtlsConnect(connetSetting, m_info.ttlsInfo);
|
||||
} else {
|
||||
qDebug() << "addAndConnect TTLS connect";
|
||||
m_wirelessConnOpration->addAndActiveWirelessEnterPriseTtlsConnect(m_info.ttlsInfo, connetSetting, m_deviceName, true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
securityPage->updateSecurityChange(connetSetting);
|
||||
if (!m_name.isEmpty()) {
|
||||
qDebug() << "add new personal connect";
|
||||
m_wirelessConnOpration->addConnect(connetSetting);
|
||||
} else {
|
||||
qDebug() << "addAndConnect personal connect" << m_deviceName;
|
||||
m_wirelessConnOpration->addAndActiveWirelessConnect(m_deviceName, connetSetting, true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool NetDetail::updateConnect()
|
||||
{
|
||||
KyConnectResourse *kyConnectResourse = new KyConnectResourse(this);
|
||||
KyConnectSetting connetSetting;
|
||||
KySecuType secuType;
|
||||
KyEapMethodType enterpriseType;
|
||||
kyConnectResourse->getConnectionSetting(m_uuid,connetSetting);
|
||||
|
||||
bool securityChange = false;
|
||||
if (isWlan) {
|
||||
securityChange = securityPage->checkIsChanged(m_info);
|
||||
if(securityChange) {
|
||||
securityPage->getSecuType(secuType, enterpriseType);
|
||||
if (!checkWirelessSecurity(secuType)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!m_uuid.isEmpty() && detailPage->checkIsChanged(m_info)) {
|
||||
m_wirelessConnOpration->setWirelessAutoConnect(m_uuid, !m_info.isAutoConnect);
|
||||
}
|
||||
|
||||
bool ipv4Change = ipv4Page->checkIsChanged(m_info, connetSetting);
|
||||
bool ipv6Change = ipv6Page->checkIsChanged(m_info, connetSetting);
|
||||
|
||||
qDebug() << "ipv4Changed" << ipv4Change << "ipv6Change" << ipv6Change;
|
||||
|
||||
if (ipv4Change && connetSetting.m_ipv4ConfigIpType == CONFIG_IP_MANUAL) {
|
||||
if (checkIpv4Conflict(connetSetting.m_ipv4Address.at(0).ip().toString())) {
|
||||
qDebug() << "ipv4 conflict";
|
||||
showDesktopNotify(tr("ipv4 address conflict!"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (ipv6Change && connetSetting.m_ipv6ConfigIpType == CONFIG_IP_MANUAL) {
|
||||
if (checkIpv6Conflict(connetSetting.m_ipv6Address.at(0).ip().toString())) {
|
||||
qDebug() << "ipv6 conflict";
|
||||
showDesktopNotify(tr("ipv6 address conflict!"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (ipv4Change || ipv6Change) {
|
||||
connetSetting.dumpInfo();
|
||||
m_wiredConnOperation->updateWiredConnect(m_uuid, connetSetting);
|
||||
}
|
||||
|
||||
qDebug() << "securityChange" << securityChange;
|
||||
if (securityChange) {
|
||||
if (secuType == WPA_AND_WPA2_ENTERPRISE) {
|
||||
updateWirelessEnterPriseConnect(enterpriseType);
|
||||
} else {
|
||||
updateWirelessPersonalConnect();
|
||||
}
|
||||
}
|
||||
|
||||
if (ipv4Change || ipv6Change || securityChange) {
|
||||
if (isActive) {
|
||||
//信息变化 断开-重连 更新需要時間 不可以立即重連
|
||||
// sleep(1);
|
||||
QEventLoop eventloop;
|
||||
QTimer::singleShot(1000, &eventloop, SLOT(quit()));
|
||||
eventloop.exec();
|
||||
m_wirelessConnOpration->activateConnection(m_uuid, m_deviceName);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool NetDetail::checkWirelessSecurity(KySecuType secuType)
|
||||
{
|
||||
if (secuType == WPA_AND_WPA2_ENTERPRISE) {
|
||||
if(m_info.strSecType.indexOf("802.1X") < 0) {
|
||||
showDesktopNotify(tr("this wifi no support enterprise type"));
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (secuType == NONE && m_info.strSecType != "None") {
|
||||
showDesktopNotify(tr("this wifi no support None type"));
|
||||
return false;
|
||||
} else if (secuType == WPA_AND_WPA2_PERSONAL
|
||||
&& (m_info.strSecType.indexOf("WPA1") < 0 &&
|
||||
m_info.strSecType.indexOf("WPA2") < 0)) {
|
||||
showDesktopNotify(tr("this wifi no support WPA2 type"));
|
||||
return false;
|
||||
} else if (secuType == WPA3_PERSONAL && m_info.strSecType.indexOf("WPA3") < 0) {
|
||||
showDesktopNotify(tr("this wifi no support WPA3 type"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool NetDetail::eventFilter(QObject *w, QEvent *event)
|
||||
{
|
||||
// 回车键触发确定按钮点击事件
|
||||
if (event->type() == QEvent::KeyPress) {
|
||||
QKeyEvent *mEvent = static_cast<QKeyEvent *>(event);
|
||||
if (mEvent->key() == Qt::Key_Enter || mEvent->key() == Qt::Key_Return) {
|
||||
if (confimBtn->isEnabled()) {
|
||||
Q_EMIT confimBtn->clicked();
|
||||
}
|
||||
return true;
|
||||
} else if (mEvent->key() == Qt::Key_Escape) {
|
||||
close();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return QWidget::eventFilter(w, event);
|
||||
}
|
|
@ -0,0 +1,141 @@
|
|||
#ifndef NETDETAIL_H
|
||||
#define NETDETAIL_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QPainter>
|
||||
#include <QObject>
|
||||
#include <QStackedWidget>
|
||||
#include <QLayout>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QVariantMap>
|
||||
#include <QDesktopWidget>
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QSettings>
|
||||
#include <QButtonGroup>
|
||||
|
||||
#include <QDBusMessage>
|
||||
#include <QDBusObjectPath>
|
||||
#include <QDBusInterface>
|
||||
#include <QDBusReply>
|
||||
#include <QCloseEvent>
|
||||
|
||||
#include "detailpage.h"
|
||||
#include "ipv4page.h"
|
||||
#include "ipv6page.h"
|
||||
#include "securitypage.h"
|
||||
#include "creatnetpage.h"
|
||||
#include "coninfo.h"
|
||||
#include "tab-pages/tabpage.h"
|
||||
|
||||
class NetDetail : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
NetDetail(QString interface, QString name, QString uuid, bool isActive, bool isWlan, bool isCreateNet, QWidget *parent = nullptr);
|
||||
~NetDetail();
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void closeEvent(QCloseEvent *event);
|
||||
bool eventFilter(QObject *w, QEvent *event);
|
||||
|
||||
private:
|
||||
void initUI();
|
||||
void centerToScreen();
|
||||
void initComponent();
|
||||
void getConInfo(ConInfo &conInfo);
|
||||
void loadPage();
|
||||
void pagePadding(QString netName, bool isWlan);
|
||||
void initSecuData();
|
||||
|
||||
void initTlsInfo(ConInfo &conInfo);
|
||||
void initPeapInfo(ConInfo &conInfo);
|
||||
void initTtlsInfo(ConInfo &conInfo);
|
||||
|
||||
void updateWirelessPersonalConnect();
|
||||
void updateWirelessEnterPriseConnect(KyEapMethodType enterpriseType);
|
||||
|
||||
//详情ssid 带宽 物理地址 无线额外(安全性 频带 通道)
|
||||
void getBaseInfo(ConInfo &conInfo);
|
||||
//详情ipv4 ipv6 ipv4Dns
|
||||
void getDynamicIpInfo(ConInfo &conInfo, bool bActived);
|
||||
//ipv4+ipv6页面
|
||||
void getStaticIpInfo(ConInfo &conInfo, bool bActived);
|
||||
|
||||
void setConfirmEnable();
|
||||
|
||||
bool checkIpv4Conflict(QString ipv4Address);
|
||||
bool checkIpv6Conflict(QString ipv6Address);
|
||||
|
||||
bool createWiredConnect();
|
||||
bool createWirelessConnect();
|
||||
bool updateConnect();
|
||||
|
||||
bool checkWirelessSecurity(KySecuType secuType);
|
||||
|
||||
void showDesktopNotify(const QString &message);
|
||||
|
||||
void setNetdetailSomeEnable(bool on);
|
||||
private:
|
||||
KyNetworkDeviceResourse *m_netDeviceResource = nullptr;
|
||||
KyConnectOperation* m_connectOperation = nullptr;
|
||||
KyWirelessConnectOperation *m_wirelessConnOpration = nullptr;
|
||||
KyWiredConnectOperation *m_wiredConnOperation = nullptr;
|
||||
KyWirelessNetResource *m_resource = nullptr;
|
||||
|
||||
QStackedWidget * stackWidget;
|
||||
|
||||
DetailPage * detailPage;
|
||||
Ipv4Page * ipv4Page;
|
||||
Ipv6Page * ipv6Page;
|
||||
SecurityPage * securityPage;
|
||||
CreatNetPage * createNetPage;
|
||||
|
||||
QWidget * centerWidget;
|
||||
QWidget * bottomWidget;
|
||||
|
||||
QPushButton * cancelBtn;
|
||||
QPushButton * forgetBtn;
|
||||
QPushButton * confimBtn;
|
||||
|
||||
QPushButton * detailBtn;
|
||||
QPushButton * ipv4Btn;
|
||||
QPushButton * ipv6Btn;
|
||||
QPushButton * securityBtn;
|
||||
QFrame * pageFrame;
|
||||
|
||||
QString m_name;
|
||||
QString m_uuid;
|
||||
QString m_deviceName;
|
||||
|
||||
bool isWlan;
|
||||
bool m_isCreateNet;
|
||||
bool isActive;
|
||||
bool isHideWlan;
|
||||
|
||||
bool isCreateOk;
|
||||
bool isDetailOk;
|
||||
bool isIpv4Ok;
|
||||
bool isIpv6Ok;
|
||||
bool isSecuOk;
|
||||
bool isConfirmBtnEnable;
|
||||
|
||||
ConInfo m_info;
|
||||
|
||||
QButtonGroup *m_group;
|
||||
|
||||
private Q_SLOTS:
|
||||
void on_btnConfirm_clicked();
|
||||
void on_btnForget_clicked();
|
||||
void onPaletteChanged();
|
||||
|
||||
Q_SIGNALS:
|
||||
void detailPageClose(bool on);
|
||||
void createPageClose(QString);
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // NETDETAIL_H
|
|
@ -0,0 +1,22 @@
|
|||
INCLUDEPATH += $$PWD
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/coninfo.h \
|
||||
$$PWD/creatnetpage.h \
|
||||
$$PWD/customtabstyle.h \
|
||||
$$PWD/detailpage.h \
|
||||
$$PWD/detailwidget.h \
|
||||
$$PWD/ipv4page.h \
|
||||
$$PWD/ipv6page.h \
|
||||
$$PWD/netdetail.h \
|
||||
$$PWD/securitypage.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/creatnetpage.cpp \
|
||||
$$PWD/customtabstyle.cpp \
|
||||
$$PWD/detailpage.cpp \
|
||||
$$PWD/detailwidget.cpp \
|
||||
$$PWD/ipv4page.cpp \
|
||||
$$PWD/ipv6page.cpp \
|
||||
$$PWD/netdetail.cpp \
|
||||
$$PWD/securitypage.cpp
|
|
@ -0,0 +1,831 @@
|
|||
#include "securitypage.h"
|
||||
#include "netdetail.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
|
||||
SecurityPage::SecurityPage(QWidget *parent) : QFrame(parent)
|
||||
{
|
||||
initUI();
|
||||
initConnect();
|
||||
}
|
||||
|
||||
void SecurityPage::initUI()
|
||||
{
|
||||
secuTypeLabel = new QLabel(this);
|
||||
pwdLabel = new QLabel(this);
|
||||
secuTypeLabel = new QLabel(this);
|
||||
pwdLabel = new QLabel(this);
|
||||
//企业wifi共有
|
||||
eapTypeLabel = new QLabel(this);
|
||||
//TLS
|
||||
identityLable = new QLabel(this);
|
||||
domainLable = new QLabel(this);
|
||||
caCertPathLabel = new QLabel(this);
|
||||
caNeedFlagLabel = new QLabel(this);
|
||||
clientCertPathLabel = new QLabel(this);
|
||||
clientPrivateKeyLabel = new QLabel(this);
|
||||
clientPrivateKeyPwdLabel = new QLabel(this);
|
||||
|
||||
//PEAP TTLS共有
|
||||
eapMethodLabel = new QLabel(this);
|
||||
userNameLabel = new QLabel(this);
|
||||
userPwdLabel = new QLabel(this);
|
||||
userPwdFlagLabel = new QLabel(this);
|
||||
|
||||
secuTypeCombox = new QComboBox(this);
|
||||
pwdEdit = new LineEdit(this);
|
||||
eapTypeCombox = new QComboBox(this);
|
||||
//TLS
|
||||
identityEdit = new LineEdit(this);
|
||||
domainEdit = new LineEdit(this);
|
||||
caCertPathCombox = new QComboBox(this);
|
||||
caNeedBox = new QCheckBox(this);
|
||||
clientCertPathCombox = new QComboBox(this);
|
||||
clientPrivateKeyCombox = new QComboBox(this);
|
||||
clientPrivateKeyPwdEdit = new LineEdit(this);
|
||||
|
||||
//PEAP && TTLS
|
||||
eapMethodCombox = new QComboBox(this);
|
||||
userNameEdit = new LineEdit(this);
|
||||
userPwdEdit = new LineEdit(this);
|
||||
userPwdFlagBox = new QCheckBox(this);
|
||||
|
||||
|
||||
mSecuLayout = new QFormLayout(this);
|
||||
mSecuLayout->addRow(secuTypeLabel, secuTypeCombox);
|
||||
mSecuLayout->addRow(pwdLabel, pwdEdit);
|
||||
mSecuLayout->addRow(eapTypeLabel, eapTypeCombox);
|
||||
mSecuLayout->addRow(identityLable, identityEdit);
|
||||
mSecuLayout->addRow(domainLable, domainEdit);
|
||||
mSecuLayout->addRow(caCertPathLabel, caCertPathCombox);
|
||||
mSecuLayout->addRow(caNeedBox, caNeedFlagLabel);
|
||||
mSecuLayout->addRow(clientCertPathLabel, clientCertPathCombox);
|
||||
mSecuLayout->addRow(clientPrivateKeyLabel, clientPrivateKeyCombox);
|
||||
mSecuLayout->addRow(clientPrivateKeyPwdLabel,clientPrivateKeyPwdEdit);
|
||||
mSecuLayout->addRow(eapMethodLabel, eapMethodCombox);
|
||||
mSecuLayout->addRow(userNameLabel, userNameEdit);
|
||||
mSecuLayout->addRow(userPwdLabel, userPwdEdit);
|
||||
mSecuLayout->addRow(userPwdFlagBox, userPwdFlagLabel);
|
||||
|
||||
|
||||
secuTypeLabel->setText(tr("Security"));
|
||||
pwdLabel->setText(tr("Password"));
|
||||
//企业wifi共有
|
||||
eapTypeLabel->setText(tr("EAP type"));
|
||||
//TLS
|
||||
identityLable->setText(tr("Identity"));
|
||||
domainLable->setText(tr("Domain"));
|
||||
caCertPathLabel->setText(tr("CA certficate"));
|
||||
caNeedFlagLabel->setText(tr("no need for CA certificate"));
|
||||
clientCertPathLabel->setText(tr("User certificate"));
|
||||
clientPrivateKeyLabel->setText(tr("User private key"));
|
||||
clientPrivateKeyPwdLabel->setText(tr("User key password"));
|
||||
|
||||
//PEAP TTLS共有
|
||||
eapMethodLabel->setText(tr("Ineer authentication"));
|
||||
userNameLabel->setText(tr("Usename"));
|
||||
userPwdLabel->setText(tr("Password"));
|
||||
userPwdFlagLabel->setText(tr("Ask pwd each query"));
|
||||
|
||||
secuTypeCombox->addItem(tr("None"),NONE);
|
||||
secuTypeCombox->addItem(tr("WPA&WPA2 Personal"),WPA_AND_WPA2_PERSONAL);
|
||||
secuTypeCombox->addItem(tr("WPA&WPA2 Enterprise"), WPA_AND_WPA2_ENTERPRISE);
|
||||
secuTypeCombox->addItem(tr("WPA3 Personal"), WPA3_PERSONAL);
|
||||
|
||||
eapTypeCombox->addItem("TLS", TLS);
|
||||
eapTypeCombox->addItem("PEAP", PEAP);
|
||||
eapTypeCombox->addItem("TTLS", TTLS);
|
||||
eapTypeCombox->setCurrentIndex(TLS);
|
||||
//TLS
|
||||
caCertPathCombox->addItem(tr("None"), QString(tr("None"))); //无
|
||||
caCertPathCombox->addItem(tr("Choose from file..."), QString(tr("Choose from file..."))); //从文件中选择...
|
||||
|
||||
clientCertPathCombox->addItem(tr("None"), QString(tr("None"))); //无
|
||||
clientCertPathCombox->addItem(tr("Choose from file..."), QString(tr("Choose from file..."))); //从文件中选择...
|
||||
|
||||
clientPrivateKeyCombox->addItem(tr("None"), QString(tr("None"))); //无
|
||||
clientPrivateKeyCombox->addItem(tr("Choose from file..."), QString(tr("Choose from file..."))); //从文件中选择...
|
||||
|
||||
pwdBox = new QCheckBox(this);
|
||||
pwdBox->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}"
|
||||
"QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}"
|
||||
"QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}");
|
||||
pwdBox->setCursor(Qt::PointingHandCursor);
|
||||
pwdBox->setFixedSize(30, pwdEdit->height());
|
||||
//防止文本框输入内容位于按钮之下
|
||||
QMargins margins = pwdEdit->textMargins();
|
||||
pwdEdit->setTextMargins(margins.left(), margins.top(), pwdBox->width(), margins.bottom());
|
||||
QHBoxLayout *pPwdLayout = new QHBoxLayout();
|
||||
pPwdLayout->addStretch();
|
||||
pPwdLayout->addWidget(pwdBox);
|
||||
pPwdLayout->setSpacing(0);
|
||||
pPwdLayout->setContentsMargins(0, 0, 0, 0);
|
||||
pwdEdit->setLayout(pPwdLayout);
|
||||
pwdEdit->setEchoMode(QLineEdit::Password);
|
||||
|
||||
userPwdBox = new QCheckBox(this);
|
||||
userPwdBox->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}"
|
||||
"QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}"
|
||||
"QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}");
|
||||
userPwdBox->setCursor(Qt::PointingHandCursor);
|
||||
userPwdBox->setFixedSize(30, userPwdEdit->height());
|
||||
userPwdBox->setFocusPolicy(Qt::NoFocus);
|
||||
//防止文本框输入内容位于按钮之下
|
||||
userPwdEdit->setTextMargins(margins.left(), margins.top(), userPwdBox->width(), margins.bottom());
|
||||
QHBoxLayout *puserPwdLayout = new QHBoxLayout();
|
||||
puserPwdLayout->addStretch();
|
||||
puserPwdLayout->addWidget(userPwdBox);
|
||||
puserPwdLayout->setSpacing(0);
|
||||
puserPwdLayout->setContentsMargins(0, 0, 0, 0);
|
||||
userPwdEdit->setLayout(puserPwdLayout);
|
||||
userPwdEdit->setEchoMode(QLineEdit::Password);
|
||||
|
||||
privateKeyBox = new QCheckBox(this);
|
||||
privateKeyBox->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}"
|
||||
"QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}"
|
||||
"QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}");
|
||||
privateKeyBox->setCursor(Qt::PointingHandCursor);
|
||||
privateKeyBox->setFixedSize(30, clientPrivateKeyPwdEdit->height());
|
||||
//防止文本框输入内容位于按钮之下
|
||||
clientPrivateKeyPwdEdit->setTextMargins(margins.left(), margins.top(), privateKeyBox->width(), margins.bottom());
|
||||
QHBoxLayout *pPrivateKeyPwdLayout = new QHBoxLayout();
|
||||
pPrivateKeyPwdLayout->addStretch();
|
||||
pPrivateKeyPwdLayout->addWidget(privateKeyBox);
|
||||
pPrivateKeyPwdLayout->setSpacing(0);
|
||||
pPrivateKeyPwdLayout->setContentsMargins(0, 0, 0, 0);
|
||||
clientPrivateKeyPwdEdit->setLayout(pPrivateKeyPwdLayout);
|
||||
clientPrivateKeyPwdEdit->setEchoMode(QLineEdit::Password);
|
||||
|
||||
pwdEdit->setContextMenuPolicy(Qt::NoContextMenu);
|
||||
clientPrivateKeyPwdEdit->setContextMenuPolicy(Qt::NoContextMenu);
|
||||
userPwdEdit->setContextMenuPolicy(Qt::NoContextMenu);
|
||||
|
||||
QRegExp rx("^[A-Za-z0-9`~!@#$%^&*()_-+=<>,.\\\/]+$");
|
||||
QRegExpValidator *latitude = new QRegExpValidator(rx, this);
|
||||
pwdEdit->setValidator(latitude);
|
||||
clientPrivateKeyPwdEdit->setValidator(latitude);
|
||||
userPwdEdit->setValidator(latitude);
|
||||
|
||||
showNone();
|
||||
}
|
||||
|
||||
void SecurityPage::initConnect()
|
||||
{
|
||||
//安全类型变化
|
||||
// connect(secuTypeCombox, &QComboBox::currentTextChanged, this, &SecurityPage::onSecuTypeComboxIndexChanged);
|
||||
connect(secuTypeCombox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SecurityPage::onSecuTypeComboxIndexChanged);
|
||||
//EAP方式变化
|
||||
// connect(eapTypeCombox, &QComboBox::currentTextChanged, this, &SecurityPage::onEapTypeComboxIndexChanged);
|
||||
connect(eapTypeCombox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SecurityPage::onEapTypeComboxIndexChanged);
|
||||
|
||||
connect(caNeedBox, &QCheckBox::clicked, this, &SecurityPage::onCaNeedBoxClicked);
|
||||
|
||||
connect(pwdBox, &QCheckBox::clicked, this, &SecurityPage::onPwdBoxClicked);
|
||||
connect(userPwdBox, &QCheckBox::clicked, this, &SecurityPage::onUserPwdBox);
|
||||
connect(privateKeyBox, &QCheckBox::clicked, this, &SecurityPage::onPrivateKeyBoxClicked);
|
||||
|
||||
connect(caCertPathCombox, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
||||
this, &SecurityPage::onCaCertPathComboxIndexChanged);
|
||||
|
||||
connect(clientCertPathCombox, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
||||
this, &SecurityPage::onClientCertPathComboxIndexChanged);
|
||||
|
||||
connect(clientPrivateKeyCombox, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
||||
this, &SecurityPage::onClientPrivateKeyComboxIndexChanged);
|
||||
|
||||
connect(secuTypeCombox, SIGNAL(currentIndexChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||
connect(pwdEdit, &LineEdit::textChanged, this, &SecurityPage::setEnableOfSaveBtn);
|
||||
connect(eapTypeCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEnableOfSaveBtn()));
|
||||
connect(identityEdit, &LineEdit::textChanged, this, &SecurityPage::setEnableOfSaveBtn);
|
||||
connect(caCertPathCombox, SIGNAL(currentTextChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||
connect(caNeedBox, &QCheckBox::stateChanged, this, &SecurityPage::setEnableOfSaveBtn);
|
||||
connect(clientCertPathCombox, SIGNAL(currentTextChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||
connect(clientPrivateKeyCombox, SIGNAL(currentTextChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||
connect(clientPrivateKeyPwdEdit, &LineEdit::textChanged, this, &SecurityPage::setEnableOfSaveBtn);
|
||||
connect(eapMethodCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEnableOfSaveBtn()));
|
||||
connect(userNameEdit, &LineEdit::textChanged, this, &SecurityPage::setEnableOfSaveBtn);
|
||||
connect(userPwdEdit, &LineEdit::textChanged, this, &SecurityPage::setEnableOfSaveBtn);
|
||||
|
||||
}
|
||||
|
||||
void SecurityPage::setSecurity(KySecuType index)
|
||||
{
|
||||
secuTypeCombox->setCurrentIndex(index);
|
||||
onSecuTypeComboxIndexChanged();
|
||||
}
|
||||
|
||||
void SecurityPage::setPsk(const QString &psk)
|
||||
{
|
||||
pwdEdit->setText(psk);
|
||||
}
|
||||
|
||||
void SecurityPage::setTlsInfo(KyEapMethodTlsInfo &info)
|
||||
{
|
||||
showTls();
|
||||
identityEdit->setText(info.identity);
|
||||
domainEdit->setText(info.domain);
|
||||
if (info.caCertPath.isEmpty()) {
|
||||
caCertPathCombox->setItemText(0, "");
|
||||
caNeedBox->setChecked(true);
|
||||
} else {
|
||||
caCertPathCombox->setItemText(0, info.caCertPath);
|
||||
caNeedBox->setChecked(false);
|
||||
}
|
||||
|
||||
if (info.clientCertPath.isEmpty()) {
|
||||
clientCertPathCombox->setItemText(0, "");
|
||||
} else {
|
||||
clientCertPathCombox->setItemText(0, info.clientCertPath);
|
||||
}
|
||||
|
||||
if (info.clientPrivateKey.isEmpty()) {
|
||||
clientPrivateKeyCombox->setItemText(0, "");
|
||||
} else {
|
||||
clientPrivateKeyCombox->setItemText(0, info.clientPrivateKey);
|
||||
}
|
||||
|
||||
clientPrivateKeyPwdEdit->setText(info.clientPrivateKeyPWD);
|
||||
|
||||
}
|
||||
|
||||
void SecurityPage::setPeapInfo(KyEapMethodPeapInfo &info)
|
||||
{
|
||||
showPeapOrTtls();
|
||||
eapTypeCombox->setCurrentIndex(PEAP);
|
||||
onEapTypeComboxIndexChanged();
|
||||
if (info.phase2AuthMethod == KyAuthMethodMschapv2) {
|
||||
eapMethodCombox->setCurrentIndex(MSCHAPV2_PEAP);
|
||||
} else if (info.phase2AuthMethod == KyAuthMethodMd5){
|
||||
eapMethodCombox->setCurrentIndex(MD5_PEAP);
|
||||
} else if (info.phase2AuthMethod == KyAuthMethodGtc) {
|
||||
eapMethodCombox->setCurrentIndex(GTC_PEAP);
|
||||
}
|
||||
userNameEdit->setText(info.userName);
|
||||
userPwdEdit->setText(info.userPWD);
|
||||
if (info.m_passwdFlag) {
|
||||
userPwdFlagBox->setChecked(true);
|
||||
} else {
|
||||
userPwdFlagBox->setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
void SecurityPage::setTtlsInfo(KyEapMethodTtlsInfo &info)
|
||||
{
|
||||
showPeapOrTtls();
|
||||
eapTypeCombox->setCurrentIndex(TTLS);
|
||||
onEapTypeComboxIndexChanged();
|
||||
|
||||
if (info.authType == AUTH_EAP) {
|
||||
if (info.authEapMethod = KyAuthEapMethodMschapv2) {
|
||||
eapMethodCombox->setCurrentIndex(MSCHAPV2_EAP);
|
||||
} else if (info.authEapMethod = KyAuthEapMethodMd5) {
|
||||
eapMethodCombox->setCurrentIndex(MD5_EAP);
|
||||
} else if (info.authEapMethod = KyAuthEapMethodMd5) {
|
||||
eapMethodCombox->setCurrentIndex(MD5_EAP);
|
||||
} else {
|
||||
qDebug() << "not support yet. AUTH_EAP method" << info.authEapMethod;
|
||||
}
|
||||
} else {
|
||||
if (info.authNoEapMethod == KyAuthMethodPap) {
|
||||
eapMethodCombox->setCurrentIndex(PAP);
|
||||
} else if (info.authNoEapMethod == KyAuthMethodMschap) {
|
||||
eapMethodCombox->setCurrentIndex(MSCHAP);
|
||||
} else if (info.authNoEapMethod == KyAuthMethodMschapv2) {
|
||||
eapMethodCombox->setCurrentIndex(MSCHAPV2);
|
||||
} else if (info.authNoEapMethod == KyAuthMethodChap) {
|
||||
eapMethodCombox->setCurrentIndex(CHAP);
|
||||
} else {
|
||||
qDebug() << "not support yet. AUTH_NO_EAP method" << info.authNoEapMethod;
|
||||
}
|
||||
}
|
||||
userNameEdit->setText(info.userName);
|
||||
userPwdEdit->setText(info.userPWD);
|
||||
if (info.m_passwdFlag) {
|
||||
userPwdFlagBox->setChecked(true);
|
||||
} else {
|
||||
userPwdFlagBox->setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
void SecurityPage::setSecurityVisible(const bool &visible)
|
||||
{
|
||||
if (secuTypeLabel) {
|
||||
secuTypeLabel->setVisible(visible);
|
||||
} else {
|
||||
qWarning() << "Set visible of secuTypeLabel failed because of null pointer" << Q_FUNC_INFO << __LINE__;
|
||||
}
|
||||
if (secuTypeCombox) {
|
||||
secuTypeCombox->setVisible(visible);
|
||||
} else {
|
||||
qWarning() << "Set visible of secuTypeCombox failed because of null pointer" << Q_FUNC_INFO << __LINE__;
|
||||
}
|
||||
}
|
||||
|
||||
void SecurityPage::updateTlsChange(KyEapMethodTlsInfo &info)
|
||||
{
|
||||
KyEapMethodTlsInfo tlsInfo = assembleTlsInfo();
|
||||
if (tlsInfo.clientPrivateKeyPWD != info.clientPrivateKeyPWD) {
|
||||
tlsInfo.bChanged = true;
|
||||
}
|
||||
tlsInfo.devIfaceName = info.devIfaceName;
|
||||
info = tlsInfo;
|
||||
}
|
||||
|
||||
void SecurityPage::updatePeapChange(KyEapMethodPeapInfo &info)
|
||||
{
|
||||
KyEapMethodPeapInfo peapInfo = assemblePeapInfo();
|
||||
if (peapInfo.userPWD != info.userPWD) {
|
||||
peapInfo.bChanged = true;
|
||||
}
|
||||
info = peapInfo;
|
||||
}
|
||||
|
||||
void SecurityPage::updateTtlsChange(KyEapMethodTtlsInfo &info)
|
||||
{
|
||||
KyEapMethodTtlsInfo ttlsInfo = assembleTtlsInfo();
|
||||
if (ttlsInfo.userPWD != info.userPWD) {
|
||||
ttlsInfo.bChanged = true;
|
||||
}
|
||||
info = ttlsInfo;
|
||||
}
|
||||
|
||||
void SecurityPage::getSecuType(KySecuType &secuType, KyEapMethodType &enterpriseType)
|
||||
{
|
||||
secuType = (KySecuType)secuTypeCombox->currentData().toInt();
|
||||
enterpriseType = (KyEapMethodType)eapTypeCombox->currentData().toInt();
|
||||
}
|
||||
|
||||
bool SecurityPage::checkIsChanged(const ConInfo info)
|
||||
{
|
||||
if (info.secType != secuTypeCombox->currentData().toInt()) {
|
||||
return true;
|
||||
} else {
|
||||
if (info.secType == NONE) {
|
||||
return false;
|
||||
} else if (info.secType == WPA_AND_WPA2_PERSONAL || info.secType == WPA3_PERSONAL) {
|
||||
return !(info.strPassword == pwdEdit->text());
|
||||
} else {
|
||||
if (info.enterpriseType != eapTypeCombox->currentData().toInt()) {
|
||||
return true;
|
||||
} else {
|
||||
if (info.enterpriseType == TLS) {
|
||||
return !(info.tlsInfo == assembleTlsInfo());
|
||||
} else if (info.enterpriseType == PEAP) {
|
||||
return !(info.peapInfo == assemblePeapInfo());
|
||||
} else if (info.enterpriseType == TTLS) {
|
||||
return !(info.ttlsInfo == assembleTtlsInfo());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SecurityPage::showNone()
|
||||
{
|
||||
pwdEdit->hide();
|
||||
eapTypeCombox->hide();
|
||||
|
||||
identityEdit->hide();
|
||||
domainEdit->hide();
|
||||
caCertPathCombox->hide();
|
||||
caNeedBox->hide();
|
||||
clientCertPathCombox->hide();
|
||||
clientPrivateKeyCombox->hide();
|
||||
clientPrivateKeyPwdEdit->hide();
|
||||
|
||||
eapMethodCombox->hide();
|
||||
userNameEdit->hide();
|
||||
userPwdEdit->hide();
|
||||
userPwdFlagBox->hide();
|
||||
|
||||
pwdLabel->hide();
|
||||
//企业wifi共有
|
||||
eapTypeLabel->hide();
|
||||
//TLS
|
||||
identityLable->hide();
|
||||
domainLable->hide();
|
||||
caCertPathLabel->hide();
|
||||
caNeedFlagLabel->hide();
|
||||
clientCertPathLabel->hide();
|
||||
clientPrivateKeyLabel->hide();
|
||||
clientPrivateKeyPwdLabel->hide();
|
||||
|
||||
//PEAP TTLS共有
|
||||
eapMethodLabel->hide();
|
||||
userNameLabel->hide();
|
||||
userPwdLabel->hide();
|
||||
userPwdFlagLabel->hide();
|
||||
}
|
||||
|
||||
void SecurityPage::showPsk()
|
||||
{
|
||||
pwdEdit->show();
|
||||
eapTypeCombox->hide();
|
||||
|
||||
identityEdit->hide();
|
||||
domainEdit->hide();
|
||||
caCertPathCombox->hide();
|
||||
caNeedBox->hide();
|
||||
clientCertPathCombox->hide();
|
||||
clientPrivateKeyCombox->hide();
|
||||
clientPrivateKeyPwdEdit->hide();
|
||||
|
||||
eapMethodCombox->hide();
|
||||
userNameEdit->hide();
|
||||
userPwdEdit->hide();
|
||||
userPwdFlagBox->hide();
|
||||
|
||||
pwdLabel->show();
|
||||
//企业wifi共有
|
||||
eapTypeLabel->hide();
|
||||
//TLS
|
||||
identityLable->hide();
|
||||
domainLable->hide();
|
||||
caCertPathLabel->hide();
|
||||
caNeedFlagLabel->hide();
|
||||
clientCertPathLabel->hide();
|
||||
clientPrivateKeyLabel->hide();
|
||||
clientPrivateKeyPwdLabel->hide();
|
||||
|
||||
//PEAP TTLS共有
|
||||
eapMethodLabel->hide();
|
||||
userNameLabel->hide();
|
||||
userPwdLabel->hide();
|
||||
userPwdFlagLabel->hide();
|
||||
}
|
||||
|
||||
void SecurityPage::showTls()
|
||||
{
|
||||
pwdEdit->hide();
|
||||
eapTypeCombox->show();
|
||||
|
||||
identityEdit->show();
|
||||
domainEdit->show();
|
||||
caCertPathCombox->show();
|
||||
caNeedBox->show();
|
||||
clientCertPathCombox->show();
|
||||
clientPrivateKeyCombox->show();
|
||||
clientPrivateKeyPwdEdit->show();
|
||||
|
||||
eapMethodCombox->hide();
|
||||
userNameEdit->hide();
|
||||
userPwdEdit->hide();
|
||||
userPwdFlagBox->hide();
|
||||
|
||||
pwdLabel->hide();
|
||||
//企业wifi共有
|
||||
eapTypeLabel->show();
|
||||
//TLS
|
||||
identityLable->show();
|
||||
domainLable->show();
|
||||
caCertPathLabel->show();
|
||||
caNeedFlagLabel->show();
|
||||
clientCertPathLabel->show();
|
||||
clientPrivateKeyLabel->show();
|
||||
clientPrivateKeyPwdLabel->show();
|
||||
|
||||
//PEAP TTLS共有
|
||||
eapMethodLabel->hide();
|
||||
userNameLabel->hide();
|
||||
userPwdLabel->hide();
|
||||
userPwdFlagLabel->hide();
|
||||
}
|
||||
|
||||
void SecurityPage::showPeapOrTtls()
|
||||
{
|
||||
pwdEdit->hide();
|
||||
eapTypeCombox->show();
|
||||
|
||||
identityEdit->hide();
|
||||
domainEdit->hide();
|
||||
caCertPathCombox->hide();
|
||||
caNeedBox->hide();
|
||||
clientCertPathCombox->hide();
|
||||
clientPrivateKeyCombox->hide();
|
||||
clientPrivateKeyPwdEdit->hide();
|
||||
|
||||
eapMethodCombox->show();
|
||||
userNameEdit->show();
|
||||
userPwdEdit->show();
|
||||
userPwdFlagBox->show();
|
||||
|
||||
pwdLabel->hide();
|
||||
//企业wifi共有
|
||||
eapTypeLabel->show();
|
||||
//TLS
|
||||
identityLable->hide();
|
||||
domainLable->hide();
|
||||
caCertPathLabel->hide();
|
||||
caNeedFlagLabel->hide();
|
||||
clientCertPathLabel->hide();
|
||||
clientPrivateKeyLabel->hide();
|
||||
clientPrivateKeyPwdLabel->hide();
|
||||
|
||||
//PEAP TTLS共有
|
||||
eapMethodLabel->show();
|
||||
userNameLabel->show();
|
||||
userPwdLabel->show();
|
||||
userPwdFlagLabel->show();
|
||||
}
|
||||
|
||||
KyEapMethodTlsInfo SecurityPage::assembleTlsInfo()
|
||||
{
|
||||
KyEapMethodTlsInfo info;
|
||||
info.identity = identityEdit->text();
|
||||
info.domain = domainEdit->text();
|
||||
info.caCertPath = caCertPathCombox->currentText();
|
||||
info.bNeedCa = !caNeedBox->isChecked();
|
||||
info.clientCertPath = clientCertPathCombox->currentText();
|
||||
info.clientPrivateKey = clientPrivateKeyCombox->currentText();
|
||||
info.clientPrivateKeyPWD = clientPrivateKeyPwdEdit->text();
|
||||
info.m_privateKeyPWDFlag = NetworkManager::Setting::None;
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
KyEapMethodPeapInfo SecurityPage::assemblePeapInfo()
|
||||
{
|
||||
KyEapMethodPeapInfo info;
|
||||
// info.phase2AuthMethod = (KyNoEapMethodAuth)eapMethodCombox->currentData().toInt();
|
||||
switch (eapMethodCombox->currentIndex()) {
|
||||
case 0:
|
||||
info.phase2AuthMethod = KyAuthMethodMschapv2;
|
||||
break;
|
||||
case 1:
|
||||
info.phase2AuthMethod = KyAuthMethodMd5;
|
||||
break;
|
||||
case 2:
|
||||
info.phase2AuthMethod = KyAuthMethodGtc;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
info.userName = userNameEdit->text();
|
||||
info.userPWD = userPwdEdit->text();
|
||||
info.m_passwdFlag = (userPwdFlagBox->isChecked() ? NetworkManager::Setting::NotSaved : NetworkManager::Setting::None);
|
||||
|
||||
return info;
|
||||
}
|
||||
KyEapMethodTtlsInfo SecurityPage::assembleTtlsInfo()
|
||||
{
|
||||
KyEapMethodTtlsInfo info;
|
||||
switch (eapMethodCombox->currentIndex()) {
|
||||
case PAP:
|
||||
info.authType = AUTH_NO_EAP;
|
||||
info.authNoEapMethod = KyAuthMethodPap;
|
||||
break;
|
||||
case MSCHAP:
|
||||
info.authType = AUTH_NO_EAP;
|
||||
info.authNoEapMethod = KyAuthMethodChap;
|
||||
break;
|
||||
case MSCHAPV2_EAP:
|
||||
info.authType = AUTH_EAP;
|
||||
info.authEapMethod = KyAuthEapMethodMschapv2;
|
||||
break;
|
||||
case MSCHAPV2:
|
||||
info.authType = AUTH_NO_EAP;
|
||||
info.authNoEapMethod = KyAuthMethodMschapv2;
|
||||
break;
|
||||
case CHAP:
|
||||
info.authType = AUTH_NO_EAP;
|
||||
info.authNoEapMethod = KyAuthMethodChap;
|
||||
break;
|
||||
case MD5_EAP:
|
||||
info.authType = AUTH_EAP;
|
||||
info.authEapMethod = KyAuthEapMethodMd5;
|
||||
break;
|
||||
case GTC_EAP:
|
||||
info.authType = AUTH_EAP;
|
||||
info.authEapMethod = KyAuthEapMethodGtc;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
info.userName = userNameEdit->text();
|
||||
info.userPWD = userPwdEdit->text();
|
||||
info.m_passwdFlag = (userPwdFlagBox->isChecked() ? NetworkManager::Setting::NotSaved : NetworkManager::Setting::None);
|
||||
return info;
|
||||
}
|
||||
|
||||
void SecurityPage::updateSecurityChange(KyWirelessConnectSetting &setting)
|
||||
{
|
||||
qDebug() << "secuTypeCombox->currentData()" << secuTypeCombox->currentData().toInt() << pwdEdit->text();
|
||||
if (secuTypeCombox->currentData().toInt() == NONE) {
|
||||
setting.m_psk = "";
|
||||
} else {
|
||||
setting.m_psk = pwdEdit->text();
|
||||
}
|
||||
|
||||
if (secuTypeCombox->currentData().toInt() == NONE) {
|
||||
setting.m_type = WpaNone;
|
||||
} else if (secuTypeCombox->currentData().toInt() == WPA_AND_WPA2_PERSONAL) {
|
||||
setting.m_type = WpaPsk;
|
||||
} else if (secuTypeCombox->currentData().toInt() == WPA3_PERSONAL) {
|
||||
setting.m_type = SAE;
|
||||
}
|
||||
}
|
||||
|
||||
bool SecurityPage::checkConnectBtnIsEnabled()
|
||||
{
|
||||
int index = secuTypeCombox->currentData().toInt();
|
||||
if (index == NONE) {
|
||||
|
||||
} else if (index == WPA_AND_WPA2_PERSONAL || index == WPA3_PERSONAL) {
|
||||
if (pwdEdit->text().isEmpty() || pwdEdit->text().length() < 8 ) {
|
||||
qDebug() << "password is empty or length < 8";
|
||||
return false;
|
||||
}
|
||||
} else if (index == WPA_AND_WPA2_ENTERPRISE) {
|
||||
int type = eapTypeCombox->currentData().toInt();
|
||||
if (type == TLS) {
|
||||
if (identityEdit->text().isEmpty()) {
|
||||
qDebug() << "tls identity is empty";
|
||||
return false;
|
||||
}
|
||||
QFile cafile(caCertPathCombox->currentText());
|
||||
if(!caNeedBox->isChecked() && !cafile.exists()) {
|
||||
qDebug() << "ca cert filepath " << caCertPathCombox->currentText() << " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
QFile cliCafile(clientCertPathCombox->currentText());
|
||||
if(!cliCafile.exists()) {
|
||||
qDebug() << "client cert filepath " << clientCertPathCombox->currentText() << " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
QFile cliKeyfile(clientPrivateKeyCombox->currentText());
|
||||
if(!cliKeyfile.exists()) {
|
||||
qDebug() << "client private key filepath " << clientPrivateKeyCombox->currentText() << " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
if(clientPrivateKeyPwdEdit->text().isEmpty()) {
|
||||
qDebug() << "client Private Key password is empty";
|
||||
return false;
|
||||
}
|
||||
} else if (type == PEAP || type == TTLS) {
|
||||
if(userNameEdit->text().isEmpty() || userPwdEdit->text().isEmpty()) {
|
||||
qDebug() << "user name or user password is empty";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void SecurityPage::setEnableOfSaveBtn()
|
||||
{
|
||||
Q_EMIT setSecuPageState(checkConnectBtnIsEnabled());
|
||||
}
|
||||
|
||||
void SecurityPage::onSecuTypeComboxIndexChanged()
|
||||
{
|
||||
int index = secuTypeCombox->currentData().toInt();
|
||||
if (index == WPA_AND_WPA2_PERSONAL || index == WPA3_PERSONAL) {
|
||||
showPsk();
|
||||
} else if (index == WPA_AND_WPA2_ENTERPRISE) {
|
||||
onEapTypeComboxIndexChanged();
|
||||
} else if (index == NONE) {
|
||||
showNone();
|
||||
}
|
||||
}
|
||||
|
||||
void SecurityPage::onEapTypeComboxIndexChanged()
|
||||
{
|
||||
qDebug() << "onEapTypeComboxIndexChanged";
|
||||
int index = eapTypeCombox->currentData().toInt();
|
||||
if (index == TLS) {
|
||||
showTls();
|
||||
Q_EMIT this->eapTypeChanged(TLS);
|
||||
} else if (index == PEAP) {
|
||||
showPeapOrTtls();
|
||||
eapMethodCombox->clear();
|
||||
eapMethodCombox->addItem("MSCHAPv2", MSCHAPV2_PEAP);
|
||||
eapMethodCombox->addItem("MD5", MD5_PEAP);
|
||||
eapMethodCombox->addItem("GTC", GTC_PEAP);
|
||||
Q_EMIT this->eapTypeChanged(PEAP);
|
||||
} else if (index == TTLS) {
|
||||
showPeapOrTtls();
|
||||
eapMethodCombox->clear();
|
||||
eapMethodCombox->addItem("pap", PAP);
|
||||
eapMethodCombox->addItem("mschap", MSCHAP);
|
||||
eapMethodCombox->addItem("mschapv2(eap)", MSCHAPV2_EAP);
|
||||
eapMethodCombox->addItem("mschapv2", MSCHAPV2);
|
||||
eapMethodCombox->addItem("chap", CHAP);
|
||||
eapMethodCombox->addItem("md5(eap)", MD5_EAP);
|
||||
eapMethodCombox->addItem("gtc(eap)", GTC_EAP);
|
||||
Q_EMIT this->eapTypeChanged(TTLS);
|
||||
}
|
||||
}
|
||||
|
||||
void SecurityPage::onCaNeedBoxClicked()
|
||||
{
|
||||
if (caNeedBox->isChecked()) {
|
||||
caCertPathCombox->setEnabled(false);
|
||||
} else {
|
||||
caCertPathCombox->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void SecurityPage::onPwdBoxClicked()
|
||||
{
|
||||
if (pwdEdit->echoMode() == QLineEdit::Password) {
|
||||
pwdBox->setChecked(true);
|
||||
pwdEdit->setEchoMode(QLineEdit::Normal);
|
||||
} else {
|
||||
pwdBox->setChecked(false);
|
||||
pwdEdit->setEchoMode(QLineEdit::Password);
|
||||
}
|
||||
}
|
||||
|
||||
void SecurityPage::onUserPwdBox()
|
||||
{
|
||||
if (userPwdEdit->echoMode() == QLineEdit::Password) {
|
||||
userPwdBox->setChecked(true);
|
||||
userPwdEdit->setEchoMode(QLineEdit::Normal);
|
||||
} else {
|
||||
userPwdBox->setChecked(false);
|
||||
userPwdEdit->setEchoMode(QLineEdit::Password);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SecurityPage::onPrivateKeyBoxClicked()
|
||||
{
|
||||
if (clientPrivateKeyPwdEdit->echoMode() == QLineEdit::Password) {
|
||||
privateKeyBox->setChecked(true);
|
||||
clientPrivateKeyPwdEdit->setEchoMode(QLineEdit::Normal);
|
||||
} else {
|
||||
privateKeyBox->setChecked(false);
|
||||
clientPrivateKeyPwdEdit->setEchoMode(QLineEdit::Password);
|
||||
}
|
||||
}
|
||||
|
||||
void SecurityPage::onCaCertPathComboxIndexChanged(QString str)
|
||||
{
|
||||
if (str.contains("Choose from file...") || str.contains("从文件选择..."))
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Choose a CA certificate"), "recent:///",
|
||||
tr("CA Files (*.pem *.der *.p12 *.crt *.cer *.pfx)"));
|
||||
if (!fileName.isNull()) {
|
||||
QStringList nameList = fileName.split("/");
|
||||
caCertPathCombox->blockSignals(true);
|
||||
caCertPathCombox->setItemText(0, fileName);
|
||||
caCertPathCombox->setCurrentIndex(0);
|
||||
caCertPathCombox->blockSignals(false);
|
||||
} else {
|
||||
caCertPathCombox->blockSignals(true);
|
||||
caCertPathCombox->setItemText(0, tr("None"));
|
||||
caCertPathCombox->setCurrentIndex(0);
|
||||
caCertPathCombox->blockSignals(false);
|
||||
}
|
||||
} else {
|
||||
qWarning() << "Choose file is null or unvalible";
|
||||
}
|
||||
}
|
||||
|
||||
void SecurityPage::onClientCertPathComboxIndexChanged(QString str)
|
||||
{
|
||||
if (str.contains("Choose from file...") || str.contains("从文件选择..."))
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Choose a CA certificate"), "recent:///",
|
||||
tr("CA Files (*.pem *.der *.p12 *.crt *.cer *.pfx)"));
|
||||
if (!fileName.isNull()) {
|
||||
clientCertPathCombox->blockSignals(true);
|
||||
clientCertPathCombox->setItemText(0, fileName);
|
||||
clientCertPathCombox->setCurrentIndex(0);
|
||||
clientCertPathCombox->blockSignals(false);
|
||||
} else {
|
||||
clientCertPathCombox->blockSignals(true);
|
||||
clientCertPathCombox->setItemText(0, tr("None"));
|
||||
clientCertPathCombox->setCurrentIndex(0);
|
||||
clientCertPathCombox->blockSignals(false);
|
||||
}
|
||||
} else {
|
||||
qWarning() << "Choose file is null or unvalible";
|
||||
}
|
||||
}
|
||||
|
||||
void SecurityPage::onClientPrivateKeyComboxIndexChanged(QString str)
|
||||
{
|
||||
if (str.contains("Choose from file...") || str.contains("从文件选择..."))
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Choose a CA certificate"), "recent:///",
|
||||
tr("CA Files (*.pem *.der *.p12 *.crt *.cer *.pfx)"));
|
||||
if (!fileName.isNull()) {
|
||||
QStringList nameList = fileName.split("/");
|
||||
clientPrivateKeyCombox->blockSignals(true);
|
||||
clientPrivateKeyCombox->setItemText(0, fileName);
|
||||
clientPrivateKeyCombox->setCurrentIndex(0);
|
||||
clientPrivateKeyCombox->blockSignals(false);
|
||||
} else {
|
||||
clientPrivateKeyCombox->blockSignals(true);
|
||||
clientPrivateKeyCombox->setItemText(0, tr("None"));
|
||||
clientPrivateKeyCombox->setCurrentIndex(0);
|
||||
clientPrivateKeyCombox->blockSignals(false);
|
||||
}
|
||||
} else {
|
||||
qWarning() << "Choose file is null or unvalible";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
#ifndef SECURITYWIDGET_H
|
||||
#define SECURITYWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QFormLayout>
|
||||
#include <QComboBox>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QCheckBox>
|
||||
|
||||
#include "coninfo.h"
|
||||
|
||||
class SecurityPage : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SecurityPage(QWidget *parent = nullptr);
|
||||
|
||||
void setSecurity(KySecuType index);
|
||||
void setPsk(const QString &psk);
|
||||
void setTlsInfo(KyEapMethodTlsInfo &info);
|
||||
void setPeapInfo(KyEapMethodPeapInfo &info);
|
||||
void setTtlsInfo(KyEapMethodTtlsInfo &info);
|
||||
void setSecurityVisible(const bool &visible);
|
||||
|
||||
bool checkIsChanged(const ConInfo info);
|
||||
void updateSecurityChange(KyWirelessConnectSetting &setting);
|
||||
void updateTlsChange(KyEapMethodTlsInfo &info);
|
||||
void updatePeapChange(KyEapMethodPeapInfo &info);
|
||||
void updateTtlsChange(KyEapMethodTtlsInfo &info);
|
||||
|
||||
void getSecuType(KySecuType &secuType, KyEapMethodType &enterpriseType);
|
||||
|
||||
private:
|
||||
QFormLayout *mSecuLayout;
|
||||
|
||||
private:
|
||||
|
||||
QLabel *secuTypeLabel;
|
||||
QLabel *pwdLabel;
|
||||
//企业wifi共有
|
||||
QLabel *eapTypeLabel;
|
||||
//TLS
|
||||
QLabel *identityLable;
|
||||
QLabel *domainLable;
|
||||
QLabel *caCertPathLabel;
|
||||
QLabel *caNeedFlagLabel;
|
||||
QLabel *clientCertPathLabel;
|
||||
QLabel *clientPrivateKeyLabel;
|
||||
QLabel *clientPrivateKeyPwdLabel;
|
||||
|
||||
//PEAP TTLS共有
|
||||
QLabel *eapMethodLabel;
|
||||
QLabel *userNameLabel;
|
||||
QLabel *userPwdLabel;
|
||||
QLabel *userPwdFlagLabel;
|
||||
|
||||
QComboBox *secuTypeCombox;
|
||||
LineEdit *pwdEdit;
|
||||
QComboBox *eapTypeCombox;
|
||||
//TLS
|
||||
LineEdit *identityEdit;
|
||||
LineEdit *domainEdit;
|
||||
QComboBox *caCertPathCombox;
|
||||
QCheckBox *caNeedBox;
|
||||
QComboBox *clientCertPathCombox;
|
||||
QComboBox *clientPrivateKeyCombox;
|
||||
LineEdit *clientPrivateKeyPwdEdit;
|
||||
|
||||
//PEAP && TTLS
|
||||
QComboBox *eapMethodCombox;
|
||||
LineEdit *userNameEdit;
|
||||
LineEdit *userPwdEdit;
|
||||
QCheckBox *userPwdFlagBox;
|
||||
|
||||
QCheckBox *pwdBox;
|
||||
QCheckBox *userPwdBox;
|
||||
QCheckBox *privateKeyBox;
|
||||
|
||||
void showNone();
|
||||
void showPsk();
|
||||
void showTls();
|
||||
void showPeapOrTtls();
|
||||
void initUI();
|
||||
void initConnect();
|
||||
|
||||
KyEapMethodTlsInfo assembleTlsInfo();
|
||||
KyEapMethodPeapInfo assemblePeapInfo();
|
||||
KyEapMethodTtlsInfo assembleTtlsInfo();
|
||||
|
||||
bool checkConnectBtnIsEnabled();
|
||||
|
||||
|
||||
private Q_SLOTS:
|
||||
void onSecuTypeComboxIndexChanged();
|
||||
void onEapTypeComboxIndexChanged();
|
||||
void setEnableOfSaveBtn();
|
||||
|
||||
void onCaNeedBoxClicked();
|
||||
void onPwdBoxClicked();
|
||||
void onUserPwdBox();
|
||||
void onPrivateKeyBoxClicked();
|
||||
|
||||
void onCaCertPathComboxIndexChanged(QString str);
|
||||
void onClientCertPathComboxIndexChanged(QString str);
|
||||
void onClientPrivateKeyComboxIndexChanged(QString str);
|
||||
|
||||
Q_SIGNALS:
|
||||
void setSecuPageState(bool);
|
||||
void eapTypeChanged(const KyEapMethodType &type);
|
||||
};
|
||||
|
||||
#endif // SECURITYWIDGET_H
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,135 @@
|
|||
#ifndef LANPAGE_H
|
||||
#define LANPAGE_H
|
||||
|
||||
#include "divider.h"
|
||||
#include "switchbutton.h"
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QScrollArea>
|
||||
#include <QListWidget>
|
||||
#include <QMap>
|
||||
#include <QGSettings>
|
||||
|
||||
#include "list-items/listitem.h"
|
||||
#include "list-items/lanlistitem.h"
|
||||
#include "tab-pages/tabpage.h"
|
||||
|
||||
class LanListItem;
|
||||
|
||||
class LanPage : public TabPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit LanPage(QWidget *parent = nullptr);
|
||||
~LanPage();
|
||||
|
||||
//for dbus
|
||||
// void getWiredList(QMap<QString, QVector<QStringList> > &map);
|
||||
// void activateWired(const QString& devName, const QString& connUuid);
|
||||
// void deactivateWired(const QString& devName, const QString& connUuid);
|
||||
|
||||
void showDetailPage(QString devName, QString uuid);
|
||||
void setWiredDeviceEnable(const QString& devName, bool enable);
|
||||
|
||||
bool lanIsConnected();
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
|
||||
private:
|
||||
void initLanDevice();
|
||||
void initUI();
|
||||
void initLanArea();
|
||||
void initNetSwitch();
|
||||
void initLanDeviceState();
|
||||
|
||||
void initDeviceCombox();
|
||||
void updateDeviceCombox(QString oldDeviceName, QString newDeviceName);
|
||||
void deleteDeviceFromCombox(QString deviceName);
|
||||
void addDeviceForCombox(QString deviceName);
|
||||
|
||||
QListWidgetItem *insertNewItem(KyConnectItem *itemData, QListWidget *listWidget);
|
||||
QListWidgetItem *addNewItem(KyConnectItem *itemData, QListWidget *listWidget);
|
||||
bool removeConnectionItem(QMap<QString, QListWidgetItem *> &connectMap,
|
||||
QListWidget *lanListWidget, QString path);
|
||||
|
||||
void getEnabledDevice(QStringList &enableDeviceList);
|
||||
void getDisabledDevices(QStringList &disableDeviceList);
|
||||
|
||||
void constructConnectionArea();
|
||||
void constructActiveConnectionArea();
|
||||
|
||||
void updateConnectionArea(KyConnectItem *p_newItem);
|
||||
void updateActivatedConnectionArea(KyConnectItem *p_newItem);
|
||||
void updateConnectionState(QMap<QString, QListWidgetItem *> &connectMap,
|
||||
QListWidget *lanListWidget, QString uuid, KyConnectState state);
|
||||
QString getConnectionDevice(QString uuid);
|
||||
|
||||
void updateActiveConnectionProperty(KyConnectItem *p_connectItem);
|
||||
void updateConnectionProperty(KyConnectItem *p_connectItem);
|
||||
|
||||
// void sendLanUpdateSignal(KyConnectItem *p_connectItem);
|
||||
// void sendLanAddSignal(KyConnectItem *p_connectItem);
|
||||
void sendLanStateChangeSignal(QString uuid, KyConnectState state);
|
||||
|
||||
void addEmptyConnectItem(QMap<QString, QListWidgetItem *> &connectMap,
|
||||
QListWidget *lanListWidget);
|
||||
void clearConnectionMap(QMap<QString, QListWidgetItem *> &connectMap,
|
||||
QListWidget *lanListWidget);
|
||||
void deleteConnectionMapItem(QMap<QString, QListWidgetItem *> &connectMap,
|
||||
QListWidget *lanListWidget, QString uuid);
|
||||
|
||||
void updateCurrentDevice(QString deviceName);
|
||||
|
||||
Q_SIGNALS:
|
||||
// void lanAdd(QString devName, QStringList info);
|
||||
// void lanRemove(QString dbusPath);
|
||||
// void lanUpdate(QString devName, QStringList info);
|
||||
|
||||
// void lanActiveConnectionStateChanged(QString interface, QString uuid, int status);
|
||||
void lanConnectChanged(int state);
|
||||
|
||||
private Q_SLOTS:
|
||||
void onConnectionStateChange(QString deviceName, QString uuid, KyConnectState state);
|
||||
|
||||
void onAddConnection(QString connectUuid, QString connectName, QString connectPath);
|
||||
void onRemoveConnection(QString path);
|
||||
void onUpdateConnection(QString connectUuid, QString connectName, QString connectPath);
|
||||
|
||||
void onSwithGsettingsChanged(const QString &key);
|
||||
void onLanSwitchClicked();
|
||||
|
||||
void onDeviceAdd(QString deviceName);
|
||||
void onDeviceRemove(QString deviceName);
|
||||
void onDeviceNameUpdate(QString oldName, QString newName);
|
||||
|
||||
void onDeviceCarriered(QString deviceName, bool pluged);
|
||||
void onDeviceActiveChanage(QString deviceName, bool deviceActive);
|
||||
|
||||
void onDeviceComboxIndexChanged(int currentIndex);
|
||||
|
||||
void onShowControlCenter();
|
||||
|
||||
private:
|
||||
QListWidget * m_activatedLanListWidget = nullptr;
|
||||
QListWidget * m_inactivatedLanListWidget = nullptr;
|
||||
|
||||
KyNetworkDeviceResourse *m_deviceResource = nullptr;
|
||||
KyWiredConnectOperation *m_wiredConnectOperation = nullptr;
|
||||
KyActiveConnectResourse *m_activeResourse = nullptr; //激活的连接
|
||||
KyConnectResourse *m_connectResourse = nullptr; //未激活的连接
|
||||
|
||||
QMap<QString, QListWidgetItem *> m_inactiveConnectionMap;
|
||||
QMap<QString, QListWidgetItem *> m_activeConnectionMap;
|
||||
|
||||
QString m_currentDeviceName;
|
||||
QStringList m_devList;
|
||||
QStringList m_enableDeviceList;
|
||||
|
||||
QGSettings *m_switchGsettings = nullptr;
|
||||
|
||||
bool m_wiredSwitch = true;
|
||||
};
|
||||
|
||||
#endif // LANPAGE_H
|
|
@ -0,0 +1,12 @@
|
|||
INCLUDEPATH += $$PWD
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/lanpage.h \
|
||||
$$PWD/wlanpage.h \
|
||||
$$PWD/tabpage.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/lanpage.cpp \
|
||||
$$PWD/wlanpage.cpp \
|
||||
$$PWD/tabpage.cpp
|
||||
|
|
@ -0,0 +1,294 @@
|
|||
#include "tabpage.h"
|
||||
#include <qsettings.h>
|
||||
#include <QDBusInterface>
|
||||
#include <QLabel>
|
||||
#include <QApplication>
|
||||
|
||||
TabPage::TabPage(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
initUI();
|
||||
connect(qApp, &QApplication::paletteChanged, this, &TabPage::onPaletteChanged);
|
||||
}
|
||||
|
||||
TabPage::~TabPage()
|
||||
{
|
||||
delete m_titleDivider;
|
||||
delete m_activatedNetDivider;
|
||||
delete m_inactivatedNetDivider;
|
||||
}
|
||||
|
||||
void TabPage::initUI()
|
||||
{
|
||||
m_mainLayout = new QVBoxLayout(this);
|
||||
m_mainLayout->setContentsMargins(MAIN_LAYOUT_MARGINS);
|
||||
m_mainLayout->setSpacing(MAIN_LAYOUT_SPACING);
|
||||
this->setLayout(m_mainLayout);
|
||||
|
||||
m_titleFrame = new QFrame(this);
|
||||
m_titleFrame->setFixedHeight(TITLE_FRAME_HEIGHT);
|
||||
m_titleLayout = new QHBoxLayout(m_titleFrame);
|
||||
m_titleLayout->setContentsMargins(TITLE_LAYOUT_MARGINS);
|
||||
m_titleLabel = new QLabel(m_titleFrame);
|
||||
m_netSwitch = new SwitchButton(m_titleFrame);
|
||||
m_titleLayout->addWidget(m_titleLabel);
|
||||
m_titleLayout->addStretch();
|
||||
m_titleLayout->addWidget(m_netSwitch);
|
||||
m_titleDivider = new Divider(this);
|
||||
|
||||
//临时增加的下拉框选择网卡区域
|
||||
m_deviceFrame = new QFrame(this);
|
||||
m_deviceFrame->setFixedHeight(TITLE_FRAME_HEIGHT);
|
||||
m_deviceLayout = new QHBoxLayout(m_deviceFrame);
|
||||
m_deviceLayout->setContentsMargins(DEVICE_LAYOUT_MARGINS);
|
||||
m_deviceFrame->setLayout(m_deviceLayout);
|
||||
m_deviceLabel = new QLabel(m_deviceFrame);
|
||||
m_deviceLabel->setText(tr("Current Device"));
|
||||
m_deviceComboBox = new QComboBox(m_deviceFrame);
|
||||
m_deviceComboBox->setFixedWidth(DEVICE_COMBOBOX_WIDTH);
|
||||
|
||||
m_tipsLabel = new QLabel(m_deviceFrame);
|
||||
m_tipsLabel->setText(tr("Devices Closed!"));
|
||||
m_deviceLayout->addWidget(m_deviceLabel);
|
||||
m_deviceLayout->addStretch();
|
||||
m_deviceLayout->addWidget(m_deviceComboBox);
|
||||
m_deviceLayout->addWidget(m_tipsLabel);
|
||||
connect(m_deviceComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &TabPage::onDeviceComboxIndexChanged);
|
||||
|
||||
m_activatedNetFrame = new QFrame(this);
|
||||
m_activatedNetFrame->setMaximumHeight(ACTIVE_AREA_MAX_HEIGHT);
|
||||
m_activatedNetLayout = new QVBoxLayout(m_activatedNetFrame);
|
||||
m_activatedNetLayout->setContentsMargins(ACTIVE_NET_LAYOUT_MARGINS);
|
||||
// m_activatedNetLayout->setSpacing(NET_LAYOUT_SPACING);
|
||||
m_activatedNetLabel = new QLabel(m_activatedNetFrame);
|
||||
m_activatedNetLabel->setContentsMargins(TEXT_MARGINS);
|
||||
m_activatedNetLayout->addWidget(m_activatedNetLabel);
|
||||
m_activatedNetDivider = new Divider(this);
|
||||
|
||||
m_inactivatedNetFrame = new QFrame(this);
|
||||
m_inactivatedNetFrame->setMinimumHeight(INACTIVE_AREA_MIN_HEIGHT);
|
||||
m_inactivatedNetLayout = new QVBoxLayout(m_inactivatedNetFrame);
|
||||
m_inactivatedNetLayout->setContentsMargins(NET_LAYOUT_MARGINS);
|
||||
// m_inactivatedNetLayout->setSpacing(NET_LAYOUT_SPACING);
|
||||
m_inactivatedNetFrame->setLayout(m_inactivatedNetLayout);
|
||||
|
||||
m_inactivatedNetLabel = new QLabel(m_inactivatedNetFrame);
|
||||
m_inactivatedNetLabel->setContentsMargins(TEXT_MARGINS);
|
||||
|
||||
m_inactivatedNetListArea = new QScrollArea(m_inactivatedNetFrame);
|
||||
m_inactivatedNetListArea->setFrameShape(QFrame::Shape::NoFrame);
|
||||
m_inactivatedNetListArea->setWidgetResizable(true);
|
||||
m_inactivatedNetListArea->setBackgroundRole(QPalette::Base);
|
||||
m_inactivatedNetListArea->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
m_inactivatedNetListArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
m_inactivatedAreaLayout = new QVBoxLayout(m_inactivatedNetListArea);
|
||||
m_inactivatedAreaLayout->setSpacing(MAIN_LAYOUT_SPACING);
|
||||
m_inactivatedAreaLayout->setContentsMargins(MAIN_LAYOUT_MARGINS);
|
||||
m_inactivatedNetListArea->setLayout(m_inactivatedAreaLayout);
|
||||
|
||||
m_inactivatedNetLayout->addWidget(m_inactivatedNetLabel);
|
||||
m_inactivatedNetLayout->addWidget(m_inactivatedNetListArea);
|
||||
|
||||
m_inactivatedNetDivider = new Divider(this);
|
||||
m_settingsFrame = new QFrame(this);
|
||||
m_settingsFrame->setFixedHeight(TITLE_FRAME_HEIGHT);
|
||||
|
||||
m_settingsLayout = new QHBoxLayout(m_settingsFrame);
|
||||
m_settingsLayout->setContentsMargins(SETTINGS_LAYOUT_MARGINS);
|
||||
m_settingsLabel = new KyLable(m_settingsFrame);
|
||||
m_settingsLabel->setCursor(Qt::PointingHandCursor);
|
||||
m_settingsLabel->setText(tr("Settings"));
|
||||
m_settingsLabel->setScaledContents(true);
|
||||
|
||||
m_settingsLayout->addWidget(m_settingsLabel);
|
||||
m_settingsLayout->addStretch();
|
||||
m_settingsFrame->setLayout(m_settingsLayout);
|
||||
|
||||
m_mainLayout->addWidget(m_titleFrame);
|
||||
//临时增加的设备选择区域
|
||||
m_mainLayout->addWidget(m_deviceFrame);
|
||||
m_mainLayout->addWidget(m_titleDivider);
|
||||
m_mainLayout->addWidget(m_activatedNetFrame);
|
||||
m_mainLayout->addWidget(m_activatedNetDivider);
|
||||
m_mainLayout->addWidget(m_inactivatedNetFrame);
|
||||
m_mainLayout->addStretch();
|
||||
m_mainLayout->addWidget(m_inactivatedNetDivider);
|
||||
m_mainLayout->addWidget(m_settingsFrame);
|
||||
|
||||
QPalette pal = m_inactivatedNetListArea->palette();
|
||||
pal.setBrush(QPalette::Base, QColor(0,0,0,0)); //背景透明
|
||||
m_inactivatedNetListArea->setPalette(pal);
|
||||
|
||||
onPaletteChanged();
|
||||
}
|
||||
|
||||
void TabPage::onPaletteChanged()
|
||||
{
|
||||
QPalette labPal = m_activatedNetLabel->palette();
|
||||
QColor color = qApp->palette().color(QPalette::PlaceholderText);
|
||||
labPal.setColor(QPalette::WindowText, color);
|
||||
m_activatedNetLabel->setPalette(labPal);
|
||||
m_inactivatedNetLabel->setPalette(labPal);
|
||||
|
||||
if (m_deviceComboBox->view()) {
|
||||
QPalette view_pal = m_deviceComboBox->view()->palette();
|
||||
QColor view_color = qApp->palette().color(QPalette::Active, QPalette::Button);
|
||||
view_pal.setColor(QPalette::Base, view_color);
|
||||
m_deviceComboBox->setPalette(view_pal);
|
||||
m_deviceComboBox->view()->setPalette(view_pal);
|
||||
}
|
||||
}
|
||||
|
||||
void TabPage::showDesktopNotify(const QString &message)
|
||||
{
|
||||
QDBusInterface iface("org.freedesktop.Notifications",
|
||||
"/org/freedesktop/Notifications",
|
||||
"org.freedesktop.Notifications",
|
||||
QDBusConnection::sessionBus());
|
||||
QList<QVariant> args;
|
||||
args<<(tr("Kylin NM"))
|
||||
<<((unsigned int) 0)
|
||||
<<QString("/usr/share/icons/ukui-icon-theme-default/24x24/devices/gnome-dev-ethernet.png")
|
||||
<<tr("kylin network applet desktop message") //显示的是什么类型的信息
|
||||
<<message //显示的具体信息
|
||||
<<QStringList()
|
||||
<<QVariantMap()
|
||||
<<(int)-1;
|
||||
iface.callWithArgumentList(QDBus::AutoDetect,"Notify",args);
|
||||
}
|
||||
|
||||
QString getDefaultDeviceName(KyDeviceType deviceType)
|
||||
{
|
||||
QString defaultDevice = "";
|
||||
|
||||
QString key;
|
||||
switch (deviceType) {
|
||||
case DEVICE_TYPE_ETHERNET:
|
||||
key = "wired";
|
||||
break;
|
||||
case DEVICE_TYPE_WIFI:
|
||||
key = "wireless";
|
||||
break;
|
||||
default:
|
||||
return defaultDevice;
|
||||
}
|
||||
|
||||
QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat);
|
||||
m_settings->beginGroup("DEFAULTCARD");
|
||||
defaultDevice = m_settings->value(key).toString();
|
||||
m_settings->endGroup();
|
||||
|
||||
delete m_settings;
|
||||
m_settings = nullptr;
|
||||
|
||||
return defaultDevice;
|
||||
}
|
||||
|
||||
void setDefaultDevice(KyDeviceType deviceType, QString deviceName)
|
||||
{
|
||||
QString key;
|
||||
switch (deviceType) {
|
||||
case DEVICE_TYPE_ETHERNET:
|
||||
key = "wired";
|
||||
break;
|
||||
case DEVICE_TYPE_WIFI:
|
||||
key = "wireless";
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat);
|
||||
m_settings->beginGroup("DEFAULTCARD");
|
||||
m_settings->setValue(key, deviceName);
|
||||
m_settings->endGroup();
|
||||
m_settings->sync();
|
||||
|
||||
delete m_settings;
|
||||
m_settings = nullptr;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
bool checkDeviceExist(KyDeviceType deviceType, QString deviceName)
|
||||
{
|
||||
KyNetworkDeviceResourse *kdr = new KyNetworkDeviceResourse();
|
||||
QStringList devList;
|
||||
devList.clear();
|
||||
|
||||
kdr->getNetworkDeviceList(deviceType, devList);
|
||||
delete kdr;
|
||||
return devList.contains(deviceName);
|
||||
}
|
||||
|
||||
void saveDeviceEnableState(QString deviceName, bool enable)
|
||||
{
|
||||
QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat);
|
||||
m_settings->beginGroup("CARDEABLE");
|
||||
m_settings->setValue(deviceName, enable);
|
||||
m_settings->endGroup();
|
||||
m_settings->sync();
|
||||
delete m_settings;
|
||||
m_settings = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
void deleteDeviceEnableState(QString deviceName)
|
||||
{
|
||||
QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat);
|
||||
m_settings->beginGroup("CARDEABLE");
|
||||
m_settings->remove(deviceName);
|
||||
m_settings->endGroup();
|
||||
m_settings->sync();
|
||||
delete m_settings;
|
||||
m_settings = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
void getDeviceEnableState(KyDeviceType type, QMap<QString, bool> &map)
|
||||
{
|
||||
map.clear();
|
||||
if (!QFile::exists(CONFIG_FILE_PATH)) {
|
||||
qDebug() << "CONFIG_FILE_PATH not exist";
|
||||
return;
|
||||
}
|
||||
if (type != DEVICE_TYPE_ETHERNET && type != DEVICE_TYPE_WIFI) {
|
||||
qDebug() << "getDeviceEnableState but wrong type";
|
||||
return;
|
||||
}
|
||||
|
||||
KyNetworkDeviceResourse * kdr = new KyNetworkDeviceResourse();
|
||||
QStringList wiredDevList,wirelessDevList;
|
||||
wiredDevList.clear();
|
||||
wirelessDevList.clear();
|
||||
|
||||
QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat);
|
||||
m_settings->beginGroup("CARDEABLE");
|
||||
|
||||
if (type == DEVICE_TYPE_ETHERNET) {
|
||||
kdr->getNetworkDeviceList(type, wiredDevList);
|
||||
if (!wiredDevList.isEmpty()) {
|
||||
for (int i = 0; i < wiredDevList.size(); ++i) {
|
||||
if (!m_settings->contains(wiredDevList.at(i))) {
|
||||
saveDeviceEnableState(wiredDevList.at(i),true);
|
||||
}
|
||||
bool enable = m_settings->value(wiredDevList.at(i), true).toBool();
|
||||
map.insert(wiredDevList.at(i), enable);
|
||||
}
|
||||
}
|
||||
} else if (type == DEVICE_TYPE_WIFI) {
|
||||
kdr->getNetworkDeviceList(type, wirelessDevList);
|
||||
if (!wirelessDevList.isEmpty()) {
|
||||
for (int i = 0; i < wirelessDevList.size(); ++i) {
|
||||
bool enable = m_settings->value(wirelessDevList.at(i), true).toBool();
|
||||
map.insert(wirelessDevList.at(i), enable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_settings->endGroup();
|
||||
delete m_settings;
|
||||
m_settings = nullptr;
|
||||
delete kdr;
|
||||
kdr = nullptr;
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,109 @@
|
|||
#ifndef TABPAGE_H
|
||||
#define TABPAGE_H
|
||||
|
||||
#include "divider.h"
|
||||
#include "switchbutton.h"
|
||||
#include "kylable.h"
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QScrollArea>
|
||||
#include <QListWidget>
|
||||
#include <QDir>
|
||||
#include <QComboBox>
|
||||
#include <QEvent>
|
||||
#include <QProcess>
|
||||
#include <QDebug>
|
||||
#include "kylinnetworkdeviceresource.h"
|
||||
#include <kylinnetworkmanager.h>
|
||||
|
||||
#define MAIN_LAYOUT_MARGINS 0,0,0,0
|
||||
#define MAIN_LAYOUT_SPACING 0
|
||||
#define TITLE_FRAME_HEIGHT 50 //TabWidget的tab和widget有间隙,和设计稿看起来一致就不能设为设计稿里的高度
|
||||
#define TITLE_LAYOUT_MARGINS 24,0,24,0
|
||||
#define DEVICE_LAYOUT_MARGINS 24,0,24,8
|
||||
#define DEVICE_COMBOBOX_WIDTH 180
|
||||
#define ACTIVE_NET_LAYOUT_MARGINS 8,8,8,8
|
||||
#define NET_LAYOUT_MARGINS 8,8,0,3
|
||||
#define NET_LAYOUT_SPACING 8
|
||||
#define NET_LIST_SPACING 0
|
||||
#define TEXT_MARGINS 16,0,0,0
|
||||
//#define SCROLL_AREA_HEIGHT 200
|
||||
#define SETTINGS_LAYOUT_MARGINS 24,0,24,0
|
||||
#define TRANSPARENT_COLOR QColor(0,0,0,0)
|
||||
#define INACTIVE_AREA_MIN_HEIGHT 170
|
||||
#define ACTIVE_AREA_MAX_HEIGHT 92
|
||||
|
||||
#define MAX_ITEMS 4
|
||||
#define MAX_WIDTH 400
|
||||
#define MIN_WIDTH 383
|
||||
|
||||
#define SCROLL_STEP 4
|
||||
|
||||
const QString CONFIG_FILE_PATH = QDir::homePath() + "/.config/ukui/kylin-nm.conf";
|
||||
bool checkDeviceExist(KyDeviceType deviceType, QString deviceName);
|
||||
QString getDefaultDeviceName(KyDeviceType deviceType);
|
||||
void setDefaultDevice(KyDeviceType deviceType, QString deviceName);
|
||||
void saveDeviceEnableState(QString deviceName, bool enable);
|
||||
void deleteDeviceEnableState(QString deviceName);
|
||||
void getDeviceEnableState(KyDeviceType type, QMap<QString, bool> &map);
|
||||
|
||||
class TabPage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TabPage(QWidget *parent = nullptr);
|
||||
~TabPage();
|
||||
|
||||
// void updateDefaultDevice(QString &deviceName);
|
||||
// QString getDefaultDevice();
|
||||
static void showDesktopNotify(const QString &message);
|
||||
|
||||
Q_SIGNALS:
|
||||
void deviceStatusChanged();
|
||||
void deviceNameChanged(QString oldName, QString newName, int type);
|
||||
void activateFailed(QString errorMessage);
|
||||
void deactivateFailed(QString errorMessage);
|
||||
|
||||
protected:
|
||||
void initUI();
|
||||
// virtual void initDevice() = 0;//初始化默认设备
|
||||
virtual void initDeviceCombox() = 0;//初始化设备选择下拉框
|
||||
QVBoxLayout * m_mainLayout = nullptr;
|
||||
QFrame * m_titleFrame = nullptr;
|
||||
QHBoxLayout * m_titleLayout = nullptr;
|
||||
QLabel * m_titleLabel = nullptr;
|
||||
SwitchButton * m_netSwitch = nullptr;
|
||||
Divider * m_titleDivider = nullptr;
|
||||
|
||||
QFrame * m_activatedNetFrame = nullptr;
|
||||
QVBoxLayout * m_activatedNetLayout = nullptr;
|
||||
QLabel * m_activatedNetLabel = nullptr;
|
||||
Divider * m_activatedNetDivider = nullptr;
|
||||
|
||||
QFrame * m_inactivatedNetFrame = nullptr;
|
||||
QVBoxLayout * m_inactivatedNetLayout = nullptr;
|
||||
QLabel * m_inactivatedNetLabel = nullptr;
|
||||
QScrollArea * m_inactivatedNetListArea = nullptr;
|
||||
QVBoxLayout * m_inactivatedAreaLayout = nullptr;
|
||||
|
||||
Divider * m_inactivatedNetDivider = nullptr;
|
||||
|
||||
QFrame * m_settingsFrame = nullptr;
|
||||
QHBoxLayout * m_settingsLayout = nullptr;
|
||||
KyLable * m_settingsLabel = nullptr;
|
||||
|
||||
//临时增加的下拉框选择网卡区域
|
||||
QFrame * m_deviceFrame = nullptr;
|
||||
QHBoxLayout * m_deviceLayout = nullptr;
|
||||
QLabel * m_deviceLabel = nullptr;
|
||||
QComboBox * m_deviceComboBox = nullptr;
|
||||
QLabel * m_tipsLabel = nullptr;
|
||||
|
||||
public Q_SLOTS:
|
||||
virtual void onDeviceComboxIndexChanged(int currentIndex) = 0;
|
||||
void onPaletteChanged();
|
||||
|
||||
};
|
||||
|
||||
#endif // TABPAGE_H
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,177 @@
|
|||
#ifndef WLANPAGE_H
|
||||
#define WLANPAGE_H
|
||||
|
||||
#include "tabpage.h"
|
||||
#include "kywirelessnetresource.h"
|
||||
#include "kylinactiveconnectresource.h"
|
||||
#include "kylinnetworkdeviceresource.h"
|
||||
#include "kywirelessconnectoperation.h"
|
||||
#include "wlanlistitem.h"
|
||||
#include "wlanmoreitem.h"
|
||||
#include "kylinconnectoperation.h"
|
||||
#include <QGSettings>
|
||||
#include "netdetails/netdetail.h"
|
||||
#include <QProcess>
|
||||
#include "kylinactiveconnectresource.h"
|
||||
#include "kywirelessnetresource.h"
|
||||
|
||||
//#define SCROLLAREA_HEIGHT 150
|
||||
#define MORE_TEXT_MARGINS 16,0,0,0
|
||||
#define SCROLLAREA_HEIGHT 200
|
||||
|
||||
class WlanListItem;
|
||||
|
||||
class WlanPage : public TabPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit WlanPage(QWidget *parent = nullptr);
|
||||
~WlanPage() = default;
|
||||
|
||||
// //for dbus
|
||||
// void getWirelessList(QMap<QString, QVector<QStringList> > &map);
|
||||
// //开启热点
|
||||
// void activeWirelessAp(const QString apName, const QString apPassword, const QString wirelessBand, const QString apDevice);
|
||||
// //断开热点
|
||||
// void deactiveWirelessAp(const QString apName, const QString uuid);
|
||||
// //获取热点
|
||||
// void getStoredApInfo(QStringList &list);
|
||||
|
||||
// void activateWirelessConnection(const QString& devName, const QString& ssid);
|
||||
// void deactivateWirelessConnection(const QString& devName, const QString& ssid);
|
||||
|
||||
// void getApInfoBySsid(QString devName, QString ssid, QStringList &list);
|
||||
// //无线总开关
|
||||
// void setWirelessSwitchEnable(bool enable);
|
||||
// void getWirelessDeviceCap(QMap<QString, int> &map);
|
||||
|
||||
void getConnectivity(KyConnectivity &connectivity);
|
||||
bool wlanIsConnected();
|
||||
void showDetailPage(QString devName, QString uuid);
|
||||
|
||||
Q_SIGNALS:
|
||||
void oneItemExpanded(const QString &ssid);
|
||||
// void wlanAdd(QString devName, QStringList info);
|
||||
// void wlanRemove(QString devName,QString ssid);
|
||||
// void wlanActiveConnectionStateChanged(QString interface, QString ssid, QString uuid, int status);
|
||||
// void hotspotDeactivated(QString devName, QString ssid);
|
||||
// void hotspotActivated(QString devName, QString ssid, QString uuid);
|
||||
// void signalStrengthChange(QString devName, QString ssid, int strength);
|
||||
// void secuTypeChange(QString devName, QString ssid, QString secuType);
|
||||
void hiddenWlanClicked();
|
||||
// void wlanConnectChanged(int state);
|
||||
void timeToUpdate();
|
||||
|
||||
void showMainWindow();
|
||||
|
||||
void connectivityChanged(KyConnectivity connectivity);
|
||||
|
||||
public Q_SLOTS:
|
||||
void onMainWindowVisibleChanged(const bool &visible);
|
||||
void onSecurityTypeChange(QString devName, QString ssid, QString secuType);
|
||||
void requestScan();
|
||||
void onWlanPageVisibleChanged(int index);
|
||||
|
||||
private Q_SLOTS:
|
||||
void onWlanAdded(QString interface, KyWirelessNetItem &item);
|
||||
void onWlanRemoved(QString interface, QString ssid);
|
||||
|
||||
void onConnectionAdd(QString deviceName, QString ssid);
|
||||
void onConnectionRemove(QString deviceName, QString ssid);
|
||||
|
||||
void onDeviceAdd(QString deviceName);
|
||||
void onDeviceRemove(QString deviceName);
|
||||
void onDeviceNameUpdate(QString oldName, QString newName);
|
||||
|
||||
void onConnectionStateChanged(QString deviceName, QString ssid, QString uuid, KyConnectState state);
|
||||
void onItemHeightChanged(const bool isExpanded, const QString &ssid);
|
||||
|
||||
void onWlanSwitchClicked();
|
||||
void onWlanSwithGsettingsChanged(const QString &key);
|
||||
|
||||
void onDeviceComboxIndexChanged(int currentIndex);
|
||||
void onHiddenWlanClicked();
|
||||
void showControlCenter();
|
||||
void onWifiEnabledChanged(bool isWifiOn);
|
||||
void onRefreshIconTimer();
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
|
||||
private:
|
||||
//定时触发扫描的定时器
|
||||
void initTimer();
|
||||
void initWlanUI();
|
||||
void initDevice();//初始化默认设备
|
||||
void initDeviceCombox();
|
||||
void initWlanSwitchState();
|
||||
void initWlanArea();
|
||||
void addWlanMoreItem();
|
||||
|
||||
void showNonePwd();
|
||||
|
||||
QListWidgetItem *addEmptyItem(QListWidget *wirelessListWidget);
|
||||
QListWidgetItem *addNewItem(KyWirelessNetItem &wirelessNetItem,
|
||||
QListWidget *wirelessListWidget);
|
||||
QListWidgetItem *insertNewItem(KyWirelessNetItem &wirelessNetItem,
|
||||
QListWidget *wirelessListWidget,
|
||||
int row);
|
||||
QListWidgetItem *insertNewItemWithSort(KyWirelessNetItem &wirelessNetItem,
|
||||
QListWidget *p_ListWidget);
|
||||
|
||||
void clearWirelessNetItemMap(QMap<QString, QListWidgetItem*> &wirelessNetItem,
|
||||
QListWidget *wirelessListWidget);
|
||||
void deleteWirelessItemFormMap(QMap<QString, QListWidgetItem*> &wirelessNetItemMap,
|
||||
QListWidget *wirelessListWidget, QString ssid);
|
||||
|
||||
void updateWlanItemState(QListWidget *p_wirelessListWidget,
|
||||
QListWidgetItem *p_listWidgetItem,
|
||||
KyConnectState state);
|
||||
void updateWlanListItem(QString ssid);
|
||||
void refreshActiveConnectionIcon(QString ssid, const int &signal);
|
||||
|
||||
void constructWirelessNetArea();
|
||||
void constructActivateConnectionArea();
|
||||
|
||||
void updateActivatedArea(QString uuid, QString ssid, QString devName);
|
||||
void updateWirelessNetArea(QString uuid, QString ssid, QString devName);
|
||||
|
||||
void addDeviceToCombox(QString deviceName);
|
||||
void deleteDeviceFromCombox(QString deviceName);
|
||||
void updateDeviceForCombox(QString oldDeviceName, QString newDeviceName);
|
||||
|
||||
// void sendApStateChangeSignal(QString uuid, QString ssid, QString deviceName,
|
||||
// NetworkManager::ActiveConnection::State state);
|
||||
void wlanShowNotify(QString ssid, KyConnectState state);
|
||||
|
||||
private:
|
||||
QMap<QString, QListWidgetItem*> m_wirelessNetItemMap;
|
||||
QMap<QString, QListWidgetItem*> m_activateConnectionItemMap;
|
||||
|
||||
QListWidgetItem *m_expandedItem = nullptr;
|
||||
|
||||
WlanMoreItem *m_hiddenWlanWidget = nullptr;
|
||||
QListWidgetItem *m_hiddenItem = nullptr;
|
||||
|
||||
QListWidget *m_activatedNetListWidget = nullptr;
|
||||
QListWidget *m_inactivatedNetListWidget = nullptr;
|
||||
|
||||
QStringList m_devList;
|
||||
QString m_currentDevice;
|
||||
|
||||
KyWirelessNetResource *m_wirelessNetResource = nullptr;
|
||||
KyActiveConnectResourse *m_activatedConnectResource = nullptr;
|
||||
KyNetworkDeviceResourse *m_netDeviceResource = nullptr;
|
||||
KyWirelessConnectOperation * m_wirelessConnectOpreation = nullptr;
|
||||
KyConnectResourse *m_connectResource = nullptr;
|
||||
|
||||
QGSettings *m_switchGsettings = nullptr;
|
||||
bool m_wlanSwitchEnable = true;
|
||||
|
||||
bool m_updateStrength = true;
|
||||
|
||||
QTimer *m_scanTimer = nullptr;
|
||||
QTimer *m_refreshIconTimer = nullptr;
|
||||
};
|
||||
|
||||
#endif // WLANPAGE_H
|
|
@ -0,0 +1,23 @@
|
|||
#include "divider.h"
|
||||
#include <QPainter>
|
||||
#include <QApplication>
|
||||
|
||||
Divider::Divider(QWidget * parent) : QFrame(parent)
|
||||
{
|
||||
this->setFixedHeight(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Divider::paintEvent(QPaintEvent * e)
|
||||
{
|
||||
QPainter p(this);
|
||||
QColor color = qApp->palette().color(QPalette::BrightText);
|
||||
color.setAlphaF(0.08);
|
||||
p.save();
|
||||
p.setBrush(color);
|
||||
p.setPen(Qt::transparent);
|
||||
p.drawRoundedRect(this->rect(), 6, 6);
|
||||
p.restore();
|
||||
return QFrame::paintEvent(e);
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef DIVIDER_H
|
||||
#define DIVIDER_H
|
||||
#include <QFrame>
|
||||
|
||||
class Divider : public QFrame
|
||||
{
|
||||
public:
|
||||
Divider(QWidget * parent = nullptr);
|
||||
~Divider() = default;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
};
|
||||
|
||||
#endif // DIVIDER_H
|
|
@ -0,0 +1,93 @@
|
|||
#include "infobutton.h"
|
||||
#include <QEvent>
|
||||
#include <QPainter>
|
||||
#include <QApplication>
|
||||
|
||||
#define BUTTON_SIZE 36,36
|
||||
#define ICON_SIZE 16,16
|
||||
#define BACKGROUND_COLOR QColor(0,0,0,0)
|
||||
#define FOREGROUND_COLOR_NORMAL qApp->palette().text().color()
|
||||
#define FOREGROUND_COLOR_HOVER QColor(55,144,250,255)
|
||||
#define FOREGROUND_COLOR_PRESS QColor(36,109,212,255)
|
||||
#define OUTER_PATH 8,8,16,16
|
||||
#define INNER_PATH 9,9,14,14
|
||||
#define TEXT_POS 14,5,16,16,0
|
||||
|
||||
#define BUTTON_SIZE 36,36
|
||||
|
||||
InfoButton::InfoButton(QWidget *parent) : QPushButton(parent)
|
||||
{
|
||||
this->setFixedSize(BUTTON_SIZE);
|
||||
initUI();
|
||||
connect(qApp, &QApplication::paletteChanged, this, &InfoButton::onPaletteChanged);
|
||||
}
|
||||
|
||||
void InfoButton::initUI()
|
||||
{
|
||||
this->setFixedSize(BUTTON_SIZE);
|
||||
m_backgroundColor = BACKGROUND_COLOR;
|
||||
m_foregroundColor = FOREGROUND_COLOR_NORMAL;
|
||||
}
|
||||
|
||||
void InfoButton::onPaletteChanged()
|
||||
{
|
||||
m_foregroundColor = FOREGROUND_COLOR_NORMAL;
|
||||
this->repaint();
|
||||
}
|
||||
|
||||
void InfoButton::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QPalette pal = this->palette();
|
||||
pal.setColor(QPalette::Base, m_backgroundColor);
|
||||
pal.setColor(QPalette::Text, m_foregroundColor);
|
||||
|
||||
QPainterPath cPath;
|
||||
cPath.addRect(0, 0, ICON_SIZE);
|
||||
cPath.addEllipse(0, 0, ICON_SIZE);
|
||||
|
||||
QPainterPath outerPath;
|
||||
outerPath.addEllipse(OUTER_PATH);
|
||||
|
||||
QPainterPath innerPath;
|
||||
innerPath.addEllipse(INNER_PATH);
|
||||
outerPath -= innerPath;
|
||||
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter:: Antialiasing, true); //设置渲染,启动反锯齿
|
||||
painter.setPen(Qt::NoPen);
|
||||
|
||||
painter.setBrush(pal.color(QPalette::Base));
|
||||
painter.drawPath(cPath);
|
||||
|
||||
painter.fillPath(outerPath, pal.color(QPalette::Text));
|
||||
painter.setPen(m_foregroundColor);
|
||||
QFont font("Noto Sans CJK SC", 11, QFont::Normal, false);
|
||||
painter.setFont(font);
|
||||
painter.drawText(TEXT_POS, "i");
|
||||
}
|
||||
|
||||
void InfoButton::enterEvent(QEvent *event)
|
||||
{
|
||||
m_foregroundColor = FOREGROUND_COLOR_HOVER;
|
||||
this->update();
|
||||
}
|
||||
|
||||
void InfoButton::leaveEvent(QEvent *event)
|
||||
{
|
||||
m_foregroundColor = FOREGROUND_COLOR_NORMAL;
|
||||
this->update();
|
||||
}
|
||||
|
||||
void InfoButton::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
m_foregroundColor = FOREGROUND_COLOR_PRESS;
|
||||
this->update();
|
||||
return QPushButton::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void InfoButton::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
m_foregroundColor = FOREGROUND_COLOR_HOVER;
|
||||
this->update();
|
||||
return QPushButton::mouseReleaseEvent(event);
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
#ifndef INFOBUTTON_H
|
||||
#define INFOBUTTON_H
|
||||
#include <QPushButton>
|
||||
#include <QIcon>
|
||||
|
||||
class InfoButton : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit InfoButton(QWidget * parent = nullptr);
|
||||
~InfoButton() = default;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void enterEvent(QEvent *event);
|
||||
void leaveEvent(QEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
|
||||
private:
|
||||
void initUI();
|
||||
|
||||
private:
|
||||
QColor m_backgroundColor;
|
||||
QColor m_foregroundColor;
|
||||
|
||||
private Q_SLOTS:
|
||||
void onPaletteChanged();
|
||||
};
|
||||
|
||||
#endif // INFOBUTTON_H
|
|
@ -0,0 +1,97 @@
|
|||
#include "kylable.h"
|
||||
#include <QEvent>
|
||||
#include <QPainter>
|
||||
#include <QApplication>
|
||||
|
||||
#define FOREGROUND_COLOR_NORMAL qApp->palette().text().color()
|
||||
|
||||
static inline qreal mixQreal(qreal a, qreal b, qreal bias)
|
||||
{
|
||||
return a + (b - a) * bias;
|
||||
}
|
||||
|
||||
|
||||
QColor mixColor(const QColor &c1, const QColor &c2, qreal bias)
|
||||
{
|
||||
if (bias <= 0.0) {
|
||||
return c1;
|
||||
}
|
||||
if (bias >= 1.0) {
|
||||
return c2;
|
||||
}
|
||||
if (qIsNaN(bias)) {
|
||||
return c1;
|
||||
}
|
||||
|
||||
qreal r = mixQreal(c1.redF(), c2.redF(), bias);
|
||||
qreal g = mixQreal(c1.greenF(), c2.greenF(), bias);
|
||||
qreal b = mixQreal(c1.blueF(), c2.blueF(), bias);
|
||||
qreal a = mixQreal(c1.alphaF(), c2.alphaF(), bias);
|
||||
|
||||
return QColor::fromRgbF(r, g, b, a);
|
||||
}
|
||||
|
||||
KyLable::KyLable(QWidget *parent) : QLabel(parent)
|
||||
{
|
||||
connect(qApp, &QApplication::paletteChanged, this, &KyLable::onPaletteChanged);
|
||||
onPaletteChanged();
|
||||
}
|
||||
|
||||
void KyLable::onPaletteChanged()
|
||||
{
|
||||
m_foregroundColor = FOREGROUND_COLOR_NORMAL;
|
||||
this->repaint();
|
||||
}
|
||||
|
||||
void KyLable::setPressColor()
|
||||
{
|
||||
QColor hightlight = this->palette().color(QPalette::Active,QPalette::Highlight);
|
||||
QColor mix = this->palette().color(QPalette::Active,QPalette::BrightText);
|
||||
m_foregroundColor = mixColor(hightlight, mix, 0.05);
|
||||
}
|
||||
|
||||
void KyLable::setHoverColor()
|
||||
{
|
||||
QColor hightlight = this->palette().color(QPalette::Active,QPalette::Highlight);
|
||||
QColor mix = this->palette().color(QPalette::Active,QPalette::BrightText);
|
||||
m_foregroundColor = mixColor(hightlight, mix, 0.2);
|
||||
}
|
||||
|
||||
void KyLable::setNormalColor()
|
||||
{
|
||||
m_foregroundColor = FOREGROUND_COLOR_NORMAL;
|
||||
}
|
||||
|
||||
void KyLable::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QPalette pal = this->palette();
|
||||
pal.setColor(QPalette::WindowText, m_foregroundColor);
|
||||
this->setPalette(pal);
|
||||
return QLabel::paintEvent(event);
|
||||
}
|
||||
|
||||
void KyLable::enterEvent(QEvent *event)
|
||||
{
|
||||
setHoverColor();
|
||||
this->update();
|
||||
}
|
||||
|
||||
void KyLable::leaveEvent(QEvent *event)
|
||||
{
|
||||
setNormalColor();
|
||||
this->update();
|
||||
}
|
||||
|
||||
void KyLable::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
setPressColor();
|
||||
this->update();
|
||||
return QLabel::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void KyLable::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
setHoverColor();
|
||||
this->update();
|
||||
return QLabel::mouseReleaseEvent(event);
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
#ifndef KYLABLE_H
|
||||
#define KYLABLE_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QLabel>
|
||||
|
||||
class KyLable : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit KyLable(QWidget *parent = nullptr);
|
||||
~KyLable() = default;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void enterEvent(QEvent *event);
|
||||
void leaveEvent(QEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
|
||||
private:
|
||||
QColor m_foregroundColor;
|
||||
|
||||
void setPressColor();
|
||||
void setHoverColor();
|
||||
void setNormalColor();
|
||||
|
||||
private Q_SLOTS:
|
||||
void onPaletteChanged();
|
||||
|
||||
};
|
||||
|
||||
#endif // KYLABLE_H
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* 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, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "loadingdiv.h"
|
||||
#include <QIcon>
|
||||
|
||||
#define FRAMESPEED 60 //帧与帧之间的间隔时间(ms)
|
||||
#define ALLTIME 40*1000 //等待动画持续总时间
|
||||
|
||||
//加载动画控件'loadingGif'
|
||||
LoadingDiv::LoadingDiv(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
this->resize(480, 538);
|
||||
|
||||
this->loadingGif = new QLabel(this);
|
||||
this->loadingGif->resize(96, 96);
|
||||
this->loadingGif->move(this->width()/2 - 96/2 + 41/2 - 40, this->height()/2 + 20);
|
||||
this->loadingGif->show();
|
||||
|
||||
this->switchTimer = new QTimer(this); //QTimer对象,控制等待动画播放
|
||||
connect(switchTimer, SIGNAL(timeout()), this, SLOT(switchAnimStep()));
|
||||
|
||||
this->raise();
|
||||
this->hide();
|
||||
}
|
||||
|
||||
//加载动画控件'loadingGif'
|
||||
void LoadingDiv::switchAnimStep()
|
||||
{
|
||||
//另外一种加载方法
|
||||
QString qpmQss = ":/res/s/conning-b/";
|
||||
qpmQss.append(QString::number(this->currentPage));
|
||||
qpmQss.append(".png");
|
||||
loadingGif->setPixmap(QPixmap(qpmQss));
|
||||
loadingGif->setProperty("useIconHighlightEffect", true);
|
||||
loadingGif->setProperty("iconHighlightEffectMode", true);
|
||||
|
||||
this->currentPage --;
|
||||
|
||||
if (this->currentPage < 1) {
|
||||
this->currentPage = 12; //循环播放
|
||||
}
|
||||
this->countCurrentTime += FRAMESPEED;
|
||||
if (this->countCurrentTime >= ALLTIME) {
|
||||
Q_EMIT this->toStopLoading(); //发出信号停止主界面和托盘区的等待动画
|
||||
}
|
||||
}
|
||||
|
||||
//开始播放动画
|
||||
void LoadingDiv::startLoading()
|
||||
{
|
||||
this->currentPage = 12;
|
||||
this->countCurrentTime = 0;
|
||||
this->switchTimer->start(FRAMESPEED);
|
||||
this->show();
|
||||
}
|
||||
|
||||
//结束播放动画
|
||||
void LoadingDiv::stopLoading()
|
||||
{
|
||||
this->switchTimer->stop();
|
||||
this->hide();
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* 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, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LOADINGDIV_H
|
||||
#define LOADINGDIV_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPixmap>
|
||||
#include <QLabel>
|
||||
#include <QTimer>
|
||||
#include <QList>
|
||||
#include <QDebug>
|
||||
|
||||
class LoadingDiv : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit LoadingDiv(QWidget *parent = nullptr);
|
||||
|
||||
Q_SIGNALS:
|
||||
void toStopLoading();
|
||||
|
||||
public Q_SLOTS:
|
||||
void switchAnimStep();
|
||||
void startLoading();
|
||||
void stopLoading();
|
||||
|
||||
private:
|
||||
QLabel *loadingGif = nullptr;
|
||||
QTimer *switchTimer = nullptr;
|
||||
|
||||
int currentPage;
|
||||
int countCurrentTime;
|
||||
};
|
||||
|
||||
#endif // LOADINGDIV_H
|
|
@ -0,0 +1,246 @@
|
|||
#include "radioitembutton.h"
|
||||
#include <QPainter>
|
||||
#include <QSvgRenderer>
|
||||
#include <QApplication>
|
||||
#include <QStyle>
|
||||
#include <QDebug>
|
||||
#define FLASH_SPEED 100
|
||||
#define TIMEOUT_TIMER 90*1000
|
||||
#define BUTTON_SIZE 36,36
|
||||
#define ICON_SIZE 16,16
|
||||
#define BACKGROUND_COLOR QColor(0,0,0,0)
|
||||
#define FOREGROUND_COLOR_NORMAL_INACTIVE_LIGHT QColor(230,230,230,255)
|
||||
#define FOREGROUND_COLOR_NORMAL_INACTIVE_DARK QColor(55,55,55,255)
|
||||
#define FOREGROUND_COLOR_PRESS_INACTIVE_LIGHT QColor(217,217,217,255)
|
||||
#define FOREGROUND_COLOR_PRESS_INACTIVE_DARK QColor(70,70,70,255)
|
||||
#define FOREGROUND_COLOR_NORMAL_ACTIVE QColor(55,144,250,255)
|
||||
#define FOREGROUND_COLOR_PRESS_ACTIVE QColor(36,109,212,255)
|
||||
|
||||
RadioItemButton::RadioItemButton(QWidget *parent) : QPushButton(parent)
|
||||
{
|
||||
this->setAutoFillBackground(false);
|
||||
m_iconLabel = new QLabel(this);
|
||||
|
||||
this->setFixedSize(BUTTON_SIZE);
|
||||
m_iconLabel->setFixedSize(BUTTON_SIZE);
|
||||
m_iconLabel->setAlignment(Qt::AlignCenter);
|
||||
|
||||
setActive(false);
|
||||
//JXJ_TODO loading动画
|
||||
connect(this, &RadioItemButton::requestStartLoading, this, &RadioItemButton::onLoadingStarted);
|
||||
connect(this , &RadioItemButton::requestStopLoading, this, &RadioItemButton::onLoadingStopped);
|
||||
connect(qApp, &QApplication::paletteChanged, this, &RadioItemButton::onPaletteChanged);
|
||||
}
|
||||
|
||||
RadioItemButton::~RadioItemButton()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RadioItemButton::startLoading()
|
||||
{
|
||||
Q_EMIT this->requestStartLoading();
|
||||
}
|
||||
|
||||
void RadioItemButton::stopLoading()
|
||||
{
|
||||
Q_EMIT this->requestStopLoading();
|
||||
}
|
||||
//设置图标
|
||||
void RadioItemButton::setButtonIcon(const QIcon &icon)
|
||||
{
|
||||
if (icon.isNull()) {
|
||||
return;
|
||||
}
|
||||
m_pixmap = icon.pixmap(ICON_SIZE);
|
||||
// m_iconLabel->setPixmap(m_pixmap);
|
||||
}
|
||||
//显示默认图标
|
||||
void RadioItemButton::setDefaultPixmap()
|
||||
{
|
||||
m_iconLabel->setPixmap(m_pixmap);
|
||||
}
|
||||
//根据连接状态更改图标颜色
|
||||
void RadioItemButton::setActive(const bool &isActive)
|
||||
{
|
||||
m_isActivated = isActive;
|
||||
refreshButtonIcon();
|
||||
}
|
||||
void RadioItemButton::onLoadingStarted()
|
||||
{
|
||||
#define ANIMATION_SPEED 0.5*1000
|
||||
#define START_ROTATION 0
|
||||
#define END_ROTATION 360
|
||||
#define ANIMATION_LOOP -1 //无限旋转
|
||||
if (!m_iconLabel) {
|
||||
qWarning() << "Start loading failed, iconLabel is null pointer!" << Q_FUNC_INFO << __LINE__;
|
||||
}
|
||||
if (!m_animation) {
|
||||
m_animation = new QVariantAnimation(m_iconLabel);
|
||||
}
|
||||
m_animation->setDuration(ANIMATION_SPEED);
|
||||
m_animation->setStartValue(START_ROTATION);
|
||||
m_animation->setEndValue(END_ROTATION);
|
||||
m_animation->setLoopCount(ANIMATION_LOOP);
|
||||
connect(m_animation, &QVariantAnimation::valueChanged, this, &RadioItemButton::onAnimationValueChanged);
|
||||
m_animation->start();
|
||||
}
|
||||
|
||||
void RadioItemButton::onLoadingStopped()
|
||||
{
|
||||
if (!m_animation) {
|
||||
qWarning() << "Stop loading failed, m_animation is null pointer!" << Q_FUNC_INFO << __LINE__;
|
||||
return;
|
||||
} else {
|
||||
m_iconLabel->setPixmap(m_pixmap);
|
||||
m_animation->stop();
|
||||
Q_EMIT this->animationStoped();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void RadioItemButton::onPaletteChanged()
|
||||
{
|
||||
refreshButtonIcon();
|
||||
}
|
||||
|
||||
void RadioItemButton::onAnimationValueChanged(const QVariant& value)
|
||||
{
|
||||
if (!m_iconLabel) {
|
||||
return;
|
||||
}
|
||||
QTransform t;
|
||||
t.rotate(value.toReal());
|
||||
m_iconLabel->setPixmap(QIcon(":/res/s/conning-a/1.png").pixmap(ICON_SIZE).transformed(t));
|
||||
}
|
||||
|
||||
void RadioItemButton::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QPalette pal = this->palette();
|
||||
pal.setColor(QPalette::Base, BACKGROUND_COLOR);
|
||||
pal.setColor(QPalette::Text, m_backgroundColor);
|
||||
|
||||
QPainterPath cPath;
|
||||
cPath.addRect(0, 0, this->width(), this->height());
|
||||
cPath.addEllipse(0, 0, this->width(), this->width());
|
||||
|
||||
QPainterPath innerPath;
|
||||
innerPath.addEllipse(0, 0, this->width(), this->width());
|
||||
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter:: Antialiasing, true); //设置渲染,启动反锯齿
|
||||
painter.setPen(Qt::NoPen);
|
||||
|
||||
painter.setBrush(pal.color(QPalette::Base));
|
||||
painter.drawPath(cPath);
|
||||
|
||||
painter.fillPath(innerPath, pal.color(QPalette::Text));
|
||||
}
|
||||
|
||||
void RadioItemButton::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (m_isActivated) {
|
||||
m_backgroundColor = qApp->palette().highlight().color();
|
||||
} else {
|
||||
m_backgroundColor = qApp->palette().brightText().color();
|
||||
m_backgroundColor.setAlphaF(0.21);
|
||||
}
|
||||
this->update();
|
||||
return QPushButton::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void RadioItemButton::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
if (m_isActivated) {
|
||||
m_backgroundColor = qApp->palette().highlight().color();
|
||||
} else {
|
||||
m_backgroundColor = qApp->palette().brightText().color();
|
||||
m_backgroundColor.setAlphaF(0.18);
|
||||
}
|
||||
this->update();
|
||||
return QPushButton::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
void RadioItemButton::enterEvent(QEvent *event)
|
||||
{
|
||||
if (m_isActivated) {
|
||||
m_backgroundColor = qApp->palette().highlight().color();
|
||||
} else {
|
||||
m_backgroundColor = qApp->palette().brightText().color();
|
||||
m_backgroundColor.setAlphaF(0.32);
|
||||
}
|
||||
this->update();
|
||||
return QPushButton::enterEvent(event);
|
||||
}
|
||||
|
||||
void RadioItemButton::leaveEvent(QEvent *event)
|
||||
{
|
||||
if (m_isActivated) {
|
||||
m_backgroundColor = qApp->palette().highlight().color();
|
||||
} else {
|
||||
m_backgroundColor = qApp->palette().brightText().color();
|
||||
m_backgroundColor.setAlphaF(0.18);
|
||||
}
|
||||
this->update();
|
||||
return QPushButton::leaveEvent(event);
|
||||
}
|
||||
|
||||
void RadioItemButton::refreshButtonIcon()
|
||||
{
|
||||
if (m_isActivated) {
|
||||
m_backgroundColor = qApp->palette().highlight().color();
|
||||
m_iconLabel->setPixmap(loadSvg(m_pixmap, PixmapColor::WHITE));
|
||||
} else {
|
||||
m_backgroundColor = qApp->palette().brightText().color();
|
||||
m_backgroundColor.setAlphaF(0.18);
|
||||
if (qApp->palette().base().color().red() > MIDDLE_COLOR) {
|
||||
m_iconLabel->setPixmap(m_pixmap);
|
||||
} else {
|
||||
m_iconLabel->setPixmap(loadSvg(m_pixmap, PixmapColor::WHITE));
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const QPixmap RadioItemButton::loadSvg(const QPixmap &source, const PixmapColor &cgColor)
|
||||
{
|
||||
QImage img = source.toImage();
|
||||
for (int x = 0; x < img.width(); x++) {
|
||||
for (int y = 0; y < img.height(); y++) {
|
||||
auto color = img.pixelColor(x, y);
|
||||
if (color.alpha() > 0) {
|
||||
switch (cgColor) {
|
||||
case PixmapColor::WHITE:
|
||||
color.setRed(255);
|
||||
color.setGreen(255);
|
||||
color.setBlue(255);
|
||||
img.setPixelColor(x, y, color);
|
||||
break;
|
||||
case PixmapColor::BLACK:
|
||||
color.setRed(0);
|
||||
color.setGreen(0);
|
||||
color.setBlue(0);
|
||||
img.setPixelColor(x, y, color);
|
||||
break;
|
||||
case PixmapColor::GRAY:
|
||||
color.setRed(152);
|
||||
color.setGreen(163);
|
||||
color.setBlue(164);
|
||||
img.setPixelColor(x, y, color);
|
||||
break;
|
||||
case PixmapColor::BLUE:
|
||||
color.setRed(61);
|
||||
color.setGreen(107);
|
||||
color.setBlue(229);
|
||||
img.setPixelColor(x, y, color);
|
||||
break;
|
||||
default:
|
||||
return source;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return QPixmap::fromImage(img);
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
#ifndef NETBUTTON_H
|
||||
#define NETBUTTON_H
|
||||
#include <QPushButton>
|
||||
#include <QIcon>
|
||||
#include <QLabel>
|
||||
#include <QTimer>
|
||||
#include <QVariantAnimation>
|
||||
|
||||
#define MIDDLE_COLOR 178
|
||||
|
||||
class RadioItemButton : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RadioItemButton(QWidget * parent = nullptr);
|
||||
~RadioItemButton();
|
||||
void startLoading();
|
||||
void stopLoading();
|
||||
void setButtonIcon(const QIcon &icon);
|
||||
void setDefaultPixmap();
|
||||
void setActive(const bool &isActive);
|
||||
enum PixmapColor {
|
||||
WHITE = 0,
|
||||
BLACK,
|
||||
GRAY,
|
||||
BLUE,
|
||||
};
|
||||
const QPixmap loadSvg(const QPixmap &source, const PixmapColor &color);
|
||||
|
||||
Q_SIGNALS:
|
||||
void requestStartLoading();
|
||||
void requestStopLoading();
|
||||
void animationStoped();
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
void enterEvent(QEvent *event);
|
||||
void leaveEvent(QEvent *event);
|
||||
|
||||
private:
|
||||
bool m_isActivated = false;
|
||||
QLabel * m_iconLabel = nullptr;
|
||||
QColor m_backgroundColor;
|
||||
QVariantAnimation * m_animation = nullptr;
|
||||
|
||||
QPixmap m_pixmap;
|
||||
|
||||
void refreshButtonIcon();
|
||||
|
||||
private Q_SLOTS:
|
||||
void onLoadingStarted();
|
||||
void onLoadingStopped();
|
||||
void onPaletteChanged();
|
||||
void onAnimationValueChanged(const QVariant& value);
|
||||
};
|
||||
|
||||
#endif // NETBUTTON_H
|
||||
|
|
@ -0,0 +1,172 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* 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, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#include "switchbutton.h"
|
||||
#define SWITCH_WIDTH 48
|
||||
#define SWITCH_HEIGHT 24
|
||||
#define COLOR_ACTIVE QColor(55,144,250,255)
|
||||
#define COLOR_INACTIVE QColor(55,55,55,255)
|
||||
#define COLOR_ACTIVE_HOVER QColor(95,166,251,255)
|
||||
#define COLOR_INACTIVE_HOVER QColor(95,95,95,255)
|
||||
#define COLOR_ACTIVE_PRESS QColor(65,150,250,255)
|
||||
#define COLOR_INACTIVE_PRESS QColor(65,65,65,255)
|
||||
#define COLOR_UNABLE QColor(76,76,79,255)
|
||||
|
||||
SwitchButton::SwitchButton(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
m_colorActive = COLOR_ACTIVE;
|
||||
m_colorInactive = COLOR_INACTIVE;
|
||||
setFixedSize(SWITCH_WIDTH,SWITCH_HEIGHT);
|
||||
m_fWidth = (float)width();
|
||||
m_fHeight = (float)height();
|
||||
m_cTimer = new QTimer(this);
|
||||
m_cTimer->setInterval(5);
|
||||
|
||||
if(m_bIsOn == 1) {
|
||||
m_fCurrentValue = m_fWidth - 16 - 4;
|
||||
}
|
||||
else {
|
||||
m_fCurrentValue = 4;
|
||||
}
|
||||
connect(m_cTimer, SIGNAL(timeout()), this, SLOT(startAnimation()));
|
||||
|
||||
|
||||
}
|
||||
|
||||
void SwitchButton::setSwitchStatus(bool check) {
|
||||
if (!m_enabled)
|
||||
return;
|
||||
|
||||
if(check == true) {
|
||||
m_bIsOn = 1;
|
||||
} else {
|
||||
m_bIsOn = 0;
|
||||
}
|
||||
|
||||
Q_EMIT this->switchStatusChanged();
|
||||
|
||||
m_cTimer->start(); //开始播放动画
|
||||
}
|
||||
|
||||
bool SwitchButton::getSwitchStatus()
|
||||
{
|
||||
if (m_bIsOn == 1)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void SwitchButton::setEnabled(bool enabled)
|
||||
{
|
||||
m_enabled = enabled;
|
||||
update();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
bool SwitchButton::getEnabled()
|
||||
{
|
||||
return m_enabled;
|
||||
}
|
||||
/* 播放按钮开启关闭动画 */
|
||||
void SwitchButton::startAnimation() { //滑动按钮动作播放
|
||||
int pos = 4;
|
||||
int size = m_fWidth - 16;
|
||||
if(m_bIsOn) {
|
||||
m_fCurrentValue ++; //往右滑动
|
||||
if(m_fCurrentValue >= size - pos) { //到达边界停下来
|
||||
m_fCurrentValue = size - pos;
|
||||
m_cTimer->stop();
|
||||
}
|
||||
} else {
|
||||
m_fCurrentValue --;
|
||||
if(m_fCurrentValue <= pos) { //到达最小值,停止继续前进
|
||||
m_fCurrentValue = pos;
|
||||
m_cTimer->stop();
|
||||
}
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
/* 按钮按下处理 */
|
||||
void SwitchButton::mousePressEvent(QMouseEvent *event) {
|
||||
Q_UNUSED(event);
|
||||
|
||||
if (m_enabled) {
|
||||
m_bIsOn = !m_bIsOn;
|
||||
}
|
||||
Q_EMIT clicked();
|
||||
return QWidget::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void SwitchButton::enterEvent(QEvent *event)
|
||||
{
|
||||
if (m_enabled && m_bIsOn) {
|
||||
m_colorActive = COLOR_ACTIVE_HOVER;
|
||||
} else if (m_enabled && !m_bIsOn) {
|
||||
m_colorInactive = COLOR_INACTIVE_HOVER;
|
||||
}
|
||||
|
||||
this->update();
|
||||
|
||||
return QWidget::enterEvent(event);
|
||||
}
|
||||
|
||||
void SwitchButton::leaveEvent(QEvent *event)
|
||||
{
|
||||
if (m_enabled && m_bIsOn) {
|
||||
m_colorActive = COLOR_ACTIVE;
|
||||
} else if (m_enabled && !m_bIsOn) {
|
||||
m_colorInactive = COLOR_INACTIVE;
|
||||
}
|
||||
|
||||
this->update();
|
||||
|
||||
return QWidget::leaveEvent(event);
|
||||
}
|
||||
|
||||
/* 绘制滑动按钮主体 */
|
||||
void SwitchButton::paintEvent(QPaintEvent *event) {
|
||||
Q_UNUSED(event);
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||
painter.setRenderHint(QPainter::Antialiasing); //抗锯齿效果
|
||||
painter.setPen(Qt::NoPen);
|
||||
if(m_bIsOn && m_enabled) {
|
||||
painter.save();
|
||||
painter.setBrush(m_colorActive);
|
||||
QRectF active_rect = QRectF(0,0,m_fWidth,m_fHeight);
|
||||
painter.drawRoundedRect(active_rect, 0.5 * m_fHeight, 0.5 * m_fHeight); //画开启状态
|
||||
} else {
|
||||
painter.save();
|
||||
painter.setBrush(m_colorInactive);
|
||||
QRectF inactive_rect = QRectF(0 ,0,m_fWidth,m_fHeight);
|
||||
painter.drawRoundedRect(inactive_rect, 0.5 * m_fHeight, 0.5 * m_fHeight); //画关闭状态
|
||||
}
|
||||
painter.restore();
|
||||
painter.save();
|
||||
if (!m_enabled) {
|
||||
painter.setBrush(COLOR_UNABLE);
|
||||
// QRectF enableRect = QRectF(30, 10, 8, 4);
|
||||
// painter.drawRoundedRect(enableRect, 2, 2);
|
||||
} else {
|
||||
painter.setBrush(Qt::white);
|
||||
}
|
||||
painter.drawEllipse(m_fCurrentValue,4, 16, 16);
|
||||
|
||||
painter.restore();
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* 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, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#ifndef SWITCHBUTTON_H
|
||||
#define SWITCHBUTTON_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QTimer>
|
||||
#include <QWidget>
|
||||
#include <QPainter>
|
||||
|
||||
class SwitchButton : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SwitchButton(QWidget *parent = nullptr);
|
||||
void setSwitchStatus(bool check);
|
||||
bool getSwitchStatus();
|
||||
void setEnabled(bool enabled);
|
||||
bool getEnabled();
|
||||
|
||||
private:
|
||||
QColor m_colorActive;
|
||||
QColor m_colorInactive;
|
||||
int m_bIsOn = 1;
|
||||
QTimer *m_cTimer;
|
||||
float m_fWidth;
|
||||
float m_fHeight;
|
||||
float m_fCurrentValue;
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void enterEvent(QEvent *event);
|
||||
void leaveEvent(QEvent *event);
|
||||
bool m_enabled = true;
|
||||
|
||||
Q_SIGNALS:
|
||||
void clicked();
|
||||
void switchStatusChanged();
|
||||
|
||||
private Q_SLOTS:
|
||||
void startAnimation();
|
||||
|
||||
};
|
||||
|
||||
#endif // SWITCHBUTTON_H
|
|
@ -0,0 +1,18 @@
|
|||
INCLUDEPATH += $$PWD
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/divider.h \
|
||||
$$PWD/infobutton.h \
|
||||
$$PWD/loadingdiv.h \
|
||||
$$PWD/radioitembutton.h \
|
||||
$$PWD/switchbutton.h \
|
||||
$$PWD/kylable.h
|
||||
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/divider.cpp \
|
||||
$$PWD/infobutton.cpp \
|
||||
$$PWD/loadingdiv.cpp \
|
||||
$$PWD/radioitembutton.cpp \
|
||||
$$PWD/switchbutton.cpp \
|
||||
$$PWD/kylable.cpp
|
|
@ -0,0 +1,140 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>WiFiConfigDialog</class>
|
||||
<widget class="QDialog" name="WiFiConfigDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>474</width>
|
||||
<height>320</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="lbTitle">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>60</x>
|
||||
<y>30</y>
|
||||
<width>290</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="lbWifiName">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>60</x>
|
||||
<y>140</y>
|
||||
<width>90</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="lbWifiPassord">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>60</x>
|
||||
<y>200</y>
|
||||
<width>90</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="leWiFiName">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>190</x>
|
||||
<y>140</y>
|
||||
<width>240</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="leWifiPassword">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>190</x>
|
||||
<y>200</y>
|
||||
<width>241</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btnCancel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>220</x>
|
||||
<y>260</y>
|
||||
<width>96</width>
|
||||
<height>36</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btnOk">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>330</x>
|
||||
<y>260</y>
|
||||
<width>96</width>
|
||||
<height>36</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="lbWifiId">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>60</x>
|
||||
<y>80</y>
|
||||
<width>121</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="leWifiId">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>190</x>
|
||||
<y>80</y>
|
||||
<width>240</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBoxPwd">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>400</x>
|
||||
<y>211</y>
|
||||
<width>18</width>
|
||||
<height>9</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -0,0 +1,210 @@
|
|||
/*
|
||||
* KWin Style UKUI
|
||||
*
|
||||
* Copyright (C) 2020, KylinSoft Co., Ltd.
|
||||
*
|
||||
* 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 <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Yue Lan <lanyue@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "xatom-helper.h"
|
||||
#include <limits.h>
|
||||
#include <QX11Info>
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
static XAtomHelper *global_instance = nullptr;
|
||||
|
||||
XAtomHelper *XAtomHelper::getInstance()
|
||||
{
|
||||
if(!global_instance)
|
||||
global_instance = new XAtomHelper;
|
||||
return global_instance;
|
||||
}
|
||||
|
||||
bool XAtomHelper::isFrameLessWindow(int winId)
|
||||
{
|
||||
auto hints = getInstance()->getWindowMotifHint(winId);
|
||||
if(hints.flags == MWM_HINTS_DECORATIONS && hints.functions == 1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool XAtomHelper::isWindowDecorateBorderOnly(int winId)
|
||||
{
|
||||
return isWindowMotifHintDecorateBorderOnly(getInstance()->getWindowMotifHint(winId));
|
||||
}
|
||||
|
||||
bool XAtomHelper::isWindowMotifHintDecorateBorderOnly(const MotifWmHints &hint) {
|
||||
bool isDeco = false;
|
||||
if(hint.flags & MWM_HINTS_DECORATIONS && hint.flags != MWM_HINTS_DECORATIONS) {
|
||||
if(hint.decorations == MWM_DECOR_BORDER)
|
||||
isDeco = true;
|
||||
}
|
||||
return isDeco;
|
||||
}
|
||||
|
||||
bool XAtomHelper::isUKUICsdSupported()
|
||||
{
|
||||
// fixme:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool XAtomHelper::isUKUIDecorationWindow(int winId)
|
||||
{
|
||||
if(m_ukuiDecorationAtion == None)
|
||||
return false;
|
||||
|
||||
Atom type;
|
||||
int format;
|
||||
ulong nitems;
|
||||
ulong bytes_after;
|
||||
uchar *data;
|
||||
|
||||
bool isUKUIDecoration = false;
|
||||
|
||||
XGetWindowProperty(QX11Info::display(), winId, m_ukuiDecorationAtion,
|
||||
0, LONG_MAX, false,
|
||||
m_ukuiDecorationAtion, &type,
|
||||
&format, &nitems,
|
||||
&bytes_after, &data);
|
||||
|
||||
if(type == m_ukuiDecorationAtion) {
|
||||
if(nitems == 1) {
|
||||
isUKUIDecoration = data[0];
|
||||
}
|
||||
}
|
||||
|
||||
return isUKUIDecoration;
|
||||
}
|
||||
|
||||
UnityCorners XAtomHelper::getWindowBorderRadius(int winId)
|
||||
{
|
||||
UnityCorners corners;
|
||||
|
||||
Atom type;
|
||||
int format;
|
||||
ulong nitems;
|
||||
ulong bytes_after;
|
||||
uchar *data;
|
||||
|
||||
if(m_unityBorderRadiusAtom != None) {
|
||||
XGetWindowProperty(QX11Info::display(), winId, m_unityBorderRadiusAtom,
|
||||
0, LONG_MAX, false,
|
||||
XA_CARDINAL, &type,
|
||||
&format, &nitems,
|
||||
&bytes_after, &data);
|
||||
|
||||
if(type == XA_CARDINAL) {
|
||||
if(nitems == 4) {
|
||||
corners.topLeft = static_cast<ulong>(data[0]);
|
||||
corners.topRight = static_cast<ulong>(data[1 * sizeof(ulong)]);
|
||||
corners.bottomLeft = static_cast<ulong>(data[2 * sizeof(ulong)]);
|
||||
corners.bottomRight = static_cast<ulong>(data[3 * sizeof(ulong)]);
|
||||
}
|
||||
XFree(data);
|
||||
}
|
||||
}
|
||||
|
||||
return corners;
|
||||
}
|
||||
|
||||
void XAtomHelper::setWindowBorderRadius(int winId, const UnityCorners &data)
|
||||
{
|
||||
if(m_unityBorderRadiusAtom == None)
|
||||
return;
|
||||
|
||||
ulong corners[4] = {data.topLeft, data.topRight, data.bottomLeft, data.bottomRight};
|
||||
|
||||
XChangeProperty(QX11Info::display(), winId, m_unityBorderRadiusAtom, XA_CARDINAL,
|
||||
32, XCB_PROP_MODE_REPLACE, (const unsigned char *) &corners, sizeof(corners) / sizeof(corners[0]));
|
||||
}
|
||||
|
||||
void XAtomHelper::setWindowBorderRadius(int winId, int topLeft, int topRight, int bottomLeft, int bottomRight)
|
||||
{
|
||||
if(m_unityBorderRadiusAtom == None)
|
||||
return;
|
||||
|
||||
ulong corners[4] = {(ulong)topLeft, (ulong)topRight, (ulong)bottomLeft, (ulong)bottomRight};
|
||||
|
||||
XChangeProperty(QX11Info::display(), winId, m_unityBorderRadiusAtom, XA_CARDINAL,
|
||||
32, XCB_PROP_MODE_REPLACE, (const unsigned char *) &corners, sizeof(corners) / sizeof(corners[0]));
|
||||
}
|
||||
|
||||
void XAtomHelper::setUKUIDecoraiontHint(int winId, bool set)
|
||||
{
|
||||
if(m_ukuiDecorationAtion == None)
|
||||
return;
|
||||
|
||||
XChangeProperty(QX11Info::display(), winId, m_ukuiDecorationAtion, m_ukuiDecorationAtion, 32, XCB_PROP_MODE_REPLACE, (const unsigned char *) &set, 1);
|
||||
}
|
||||
|
||||
void XAtomHelper::setWindowMotifHint(int winId, const MotifWmHints &hints)
|
||||
{
|
||||
if(m_unityBorderRadiusAtom == None)
|
||||
return;
|
||||
|
||||
XChangeProperty(QX11Info::display(), winId, m_motifWMHintsAtom, m_motifWMHintsAtom,
|
||||
32, XCB_PROP_MODE_REPLACE, (const unsigned char *)&hints, sizeof(MotifWmHints) / sizeof(ulong));
|
||||
}
|
||||
|
||||
MotifWmHints XAtomHelper::getWindowMotifHint(int winId)
|
||||
{
|
||||
MotifWmHints hints;
|
||||
|
||||
if(m_unityBorderRadiusAtom == None)
|
||||
return hints;
|
||||
|
||||
uchar *data;
|
||||
Atom type;
|
||||
int format;
|
||||
ulong nitems;
|
||||
ulong bytes_after;
|
||||
|
||||
XGetWindowProperty(QX11Info::display(), winId, m_motifWMHintsAtom,
|
||||
0, sizeof(MotifWmHints) / sizeof(long), false, AnyPropertyType, &type,
|
||||
&format, &nitems, &bytes_after, &data);
|
||||
|
||||
if(type == None) {
|
||||
return hints;
|
||||
} else {
|
||||
hints = *(MotifWmHints *)data;
|
||||
XFree(data);
|
||||
}
|
||||
return hints;
|
||||
}
|
||||
|
||||
XAtomHelper::XAtomHelper(QObject *parent) : QObject(parent)
|
||||
{
|
||||
if(!QX11Info::isPlatformX11())
|
||||
return;
|
||||
|
||||
m_motifWMHintsAtom = XInternAtom(QX11Info::display(), "_MOTIF_WM_HINTS", true);
|
||||
m_unityBorderRadiusAtom = XInternAtom(QX11Info::display(), "_UNITY_GTK_BORDER_RADIUS", false);
|
||||
m_ukuiDecorationAtion = XInternAtom(QX11Info::display(), "_KWIN_UKUI_DECORAION", false);
|
||||
}
|
||||
|
||||
Atom XAtomHelper::registerUKUICsdNetWmSupportAtom()
|
||||
{
|
||||
// fixme:
|
||||
return None;
|
||||
}
|
||||
|
||||
void XAtomHelper::unregisterUKUICsdNetWmSupportAtom()
|
||||
{
|
||||
// fixme:
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
* KWin Style UKUI
|
||||
*
|
||||
* Copyright (C) 2020, KylinSoft Co., Ltd.
|
||||
*
|
||||
* 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 <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Yue Lan <lanyue@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef XATOMHELPER_H
|
||||
#define XATOMHELPER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <X11/Xlib.h>
|
||||
#include <NETWM>
|
||||
|
||||
struct UnityCorners {
|
||||
ulong topLeft = 0;
|
||||
ulong topRight = 0;
|
||||
ulong bottomLeft = 0;
|
||||
ulong bottomRight = 0;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
ulong flags = 0;
|
||||
ulong functions = 0;
|
||||
ulong decorations = 0;
|
||||
long input_mode = 0;
|
||||
ulong status = 0;
|
||||
} MotifWmHints, MwmHints;
|
||||
|
||||
#define MWM_HINTS_FUNCTIONS (1L << 0)
|
||||
#define MWM_HINTS_DECORATIONS (1L << 1)
|
||||
#define MWM_HINTS_INPUT_MODE (1L << 2)
|
||||
#define MWM_HINTS_STATUS (1L << 3)
|
||||
|
||||
#define MWM_FUNC_ALL (1L << 0)
|
||||
#define MWM_FUNC_RESIZE (1L << 1)
|
||||
#define MWM_FUNC_MOVE (1L << 2)
|
||||
#define MWM_FUNC_MINIMIZE (1L << 3)
|
||||
#define MWM_FUNC_MAXIMIZE (1L << 4)
|
||||
#define MWM_FUNC_CLOSE (1L << 5)
|
||||
|
||||
#define MWM_DECOR_ALL (1L << 0)
|
||||
#define MWM_DECOR_BORDER (1L << 1)
|
||||
#define MWM_DECOR_RESIZEH (1L << 2)
|
||||
#define MWM_DECOR_TITLE (1L << 3)
|
||||
#define MWM_DECOR_MENU (1L << 4)
|
||||
#define MWM_DECOR_MINIMIZE (1L << 5)
|
||||
#define MWM_DECOR_MAXIMIZE (1L << 6)
|
||||
|
||||
#define MWM_INPUT_MODELESS 0
|
||||
#define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1
|
||||
#define MWM_INPUT_SYSTEM_MODAL 2
|
||||
#define MWM_INPUT_FULL_APPLICATION_MODAL 3
|
||||
#define MWM_INPUT_APPLICATION_MODAL MWM_INPUT_PRIMARY_APPLICATION_MODAL
|
||||
|
||||
#define MWM_TEAROFF_WINDOW (1L<<0)
|
||||
|
||||
namespace UKUI {
|
||||
class Decoration;
|
||||
}
|
||||
|
||||
class XAtomHelper : public QObject
|
||||
{
|
||||
// friend class UKUI::Decoration;
|
||||
Q_OBJECT
|
||||
public:
|
||||
static XAtomHelper *getInstance();
|
||||
|
||||
static bool isFrameLessWindow(int winId);
|
||||
|
||||
static bool isWindowDecorateBorderOnly(int winId);
|
||||
static bool isWindowMotifHintDecorateBorderOnly(const MotifWmHints &hint);
|
||||
bool isUKUICsdSupported();
|
||||
bool isUKUIDecorationWindow(int winId);
|
||||
|
||||
UnityCorners getWindowBorderRadius(int winId);
|
||||
void setWindowBorderRadius(int winId, const UnityCorners &data);
|
||||
void setWindowBorderRadius(int winId, int topLeft, int topRight, int bottomLeft, int bottomRight);
|
||||
void setUKUIDecoraiontHint(int winId, bool set = true);
|
||||
|
||||
void setWindowMotifHint(int winId, const MotifWmHints &hints);
|
||||
MotifWmHints getWindowMotifHint(int winId);
|
||||
|
||||
private:
|
||||
explicit XAtomHelper(QObject *parent = nullptr);
|
||||
|
||||
Atom registerUKUICsdNetWmSupportAtom();
|
||||
void unregisterUKUICsdNetWmSupportAtom();
|
||||
|
||||
Atom m_motifWMHintsAtom = None;
|
||||
Atom m_unityBorderRadiusAtom = None;
|
||||
Atom m_ukuiDecorationAtion = None;
|
||||
};
|
||||
|
||||
#endif // XATOMHELPER_H
|
|
@ -0,0 +1,7 @@
|
|||
INCLUDEPATH += $$PWD
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/xatom-helper.h \
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/xatom-helper.cpp \
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue