Import Upstream version 3.14.0.0+0512

This commit is contained in:
谢炜 2022-06-02 16:27:45 +08:00
commit 9e51c5bb15
341 changed files with 37939 additions and 0 deletions

1
AUTHORS Normal file
View File

@ -0,0 +1 @@
shine <shenghuang@ubuntukylin.com>

674
COPYING Normal file
View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

189
README.md Normal file
View File

@ -0,0 +1,189 @@
## kylin-nm介绍
### 简介
麒麟网络工具kylin-network-manager简称kylin-nm是操作系统的网络前端其主要功能有
1、托盘栏图标及右键菜单
查看当前网络状态
左键点击托盘网络图标显示kylin-nm主界面
右键点击托盘网络图标显示右键菜单
2、对有线网络的管理
有线网络界面管理
连接/断开网络
网线拔插
多有线网卡支持
打开或关闭有线开关
查看或修改无线网络基本信息
3、对无线网络的管理
切换及刷新无线界面
查看无线网络列表
连接/断开无需密码的无线网
连接/断开有密码类型的无线网
无线网卡插拔
多无线网卡支持
打开或关闭无线开关
查看或修改无线网络基本信息
4、连接隐藏无线网络
连接无安全性的无线网络
连接WPA及WPA2个人安全性的无线网络
连接WPA及WPA2企业安全性的无线网络
连接WPA3个人安全性的无线网络
5、窗口样式调节
深色与浅色窗口样式切换
调节网络工具窗口透明度
普通窗口与具有毛玻璃效果的窗口的切换
### 运行
麒麟网络工具的进程为kylin-nm默认开机自启依赖NetworkManger
### 命令行和dbus接口
kylin-nm进程的命令行如下
Usage: kylin-nm
#### dbus接口
DBUS类型SESSION BUS
DBUS名称com.kylin.network
OBJECT路径/
接口名称com.kylin.network
#### dbus方法
getWirelessList
参数:无
返回值QMap<QString, QVector<QStringList>>
键:网卡名称
值:无线网络的集合(第一项为已连接网络信息,若无连接则为"--",否则为"名称/信号强度/加密类型/Uuid/是否为本机开放热点";其余为未连接的网络信息,为"名称/信号强度/加密类型/是否为本机开放热点"
功能:获取无线列表及每个对应无线网络的信号强度、加密类型等信息。
getWiredList
参数:无
返回值QMap<QString, QVector<QStringList>>
键:网卡名称
值:有线网络的集合("名称/UUID/对应DBUS路径"),若无已连接网络则第一项默认为"--"
功能获取有线列表及每个对应的有线网络的uuid及dbus路径
setWiredSwitchEnable(bool enable)
参数:(bool开启有线总开关true关闭有线总开关false
返回值:无
功能:打开或关闭有线总开关
setWirelessSwitchEnable(bool enable)
参数:(bool开启无线总开关true关闭无线总开关false
返回值:无
功能:打开或关闭无线总开关
setDeviceEnable(QString devName, bool enable)
参数QStringdevName 设备名称bool enable 开启/关闭
返回值:无
功能:打开或关闭单个有线网卡开关
activateConnectint type, QString devName, QString ssid
参数:根据网卡类型 参数1 0:lan 1:wlan 参数2网卡名称 参数3uuid/ssid
返回值:无
功能:激活一个网络连接
deActivateConnect(int type, QString devName, QString ssid)
参数:根据网卡类型 参数1 0:lan 1:wlan 参数2网卡名称 参数3uuid/ssid
返回值:无
功能:断开一个网络连接
getDeviceListAndEnabled(int devType)
参数int devType 0:lan 1:wlan
返回值QMap<QString, bool>
键:设备名称
bool 开启true关闭 false
功能:获取设备列表和启用/禁用状态
getWirelessDeviceCap
返回值QMap<QString, int>
键:设备名称
int 0不支持热点 3支持2.4GHz 7支持5GHz&&2.4Ghz
功能:获取无线设备能力(2.4G/5G)
showPropertyWidget(QString devName, QString ssid)
参数QString devName 设备名称 QString ssid 根据网卡类型 有线为uuid/无线为ssid
返回值:无
功能:唤起对应网络连接的属性页,可以对基础信息的显示或修改
showCreateWiredConnectWidget(QString devName)
参数QString devName 有线网卡名称
返回值:无
功能:唤起新建有线连接界面
activeWirelessAp(const QString apName,
const QString apPassword,
const QString band,
const QString apDevice)
参数QString apName 热点名称
QString apPassword 热点密码
QString band 频带
QString apDevice
返回值:无
功能:开启移动热点
deactiveWirelessAp(const QString apName, const QString uuid)
参数QStringList名称/密码/设备名称/状态/UUID/频带)
返回值:无
功能: 断开移动热点
getStoredApInfo
参数QStringList名称/密码/设备名称/状态/UUID/频带)
返回值:无
功能:获取已保存的移动热点信息
getApInfoBySsid(QString devName, QString ssid)
参数QString devName 设备名称 QString ssid
返回值:无
功能:通过名称获取已保存的移动热点信息
reScan()
参数:无
返回值:无
功能:申请重新进行无线扫描
keyRingInit()
参数QString apName 热点名称 QString uuid
返回值:无
功能:断开移动热点
keyRingClear()
参数:无
返回值:无
功能: 断开移动热点
### 原理与主要使用的技术
kylin-nm主要与NetworkManager进行交互通过对应的dbus信号驱动UI界面的更新。并通过提供的dbus方法来进行网络相关功能的调用。
麒麟网络工具按照功能划分成两层UI层和逻辑层。UI层实现网络资源的显示以及用户的交互逻辑层通过NetworkManager提供的Dbus接口完成网络资源的管理及其配置。
### 配置文件
kylin-nm的配置文件保存在如下路径
~/.config/ukui/kylin-nm.conf 有线无线开关状态 设备状态
org.ukui.kylin-nm.switch 对应的gsetting值 (有线无线开关状态)
### 编译
cd kylin-nm
mkdir build
cd build
qmake ..
make
sudo make install 
### 运行命令
./kylin-nm
### 调试
kylin-nm目前并采用ukui-log4qt模块的日志功能。日志默认保存在~/.log/kylin-nm.log中

13
kylin-nm.pro Normal file
View File

@ -0,0 +1,13 @@
TEMPLATE = subdirs
CONFIG += ordered \
qt
SUBDIRS = \
plugins/plugin.pro \
src \
TRANSLATIONS += \
translations/kylin-nm_zh_CN.ts \
translations/kylin-nm_tr.ts \
translations/kylin-nm_bo.ts

20
man/kylin-nm.1 Normal file
View File

@ -0,0 +1,20 @@
.\" Man page for Kylin-nm
.TH KYLIN-NM 1 "20 September 2019" "UKUI Desktop Environment"
.\" Please adjust this date when revising the manpage.
.\"
.SH "NAME"
kylin-nm \- The tool for the UKUI Desktop Environment
.SH "SYNOPSIS"
.B kylin-nm
.SH "DESCRIPTION"
The \fBkylin-nm\fR program is a part of the ukui-indicators, It provides network manager for the the UKUI Desktop Environment. Detect the system disk automatically, Can pop up and open the device.
.PP
This manual page documents the \fBkylin-nm\fR command.
.P
.SH "BUGS"
.SS Should you encounter any bugs, they may be reported at:
https://github.com/ukui/kylin-nm/issues
.SH "AUTHORS"
.SS This Man Page has been written for the UKUI Desktop Environment by:
shine <shenghuang@ubuntukylin.com> (2019)
.SH "SEE ALSO"

132
nmqrc.qrc Normal file
View File

@ -0,0 +1,132 @@
<RCC>
<qresource prefix="/">
<file>res/g/down_arrow.png</file>
<file>res/s/rescan/1.png</file>
<file>res/s/rescan/2.png</file>
<file>res/s/rescan/3.png</file>
<file>res/s/rescan/4.png</file>
<file>res/s/rescan/5.png</file>
<file>res/s/rescan/6.png</file>
<file>res/s/rescan/7.png</file>
<file>res/s/rescan/8.png</file>
<file>res/s/rescan/9.png</file>
<file>res/s/rescan/10.png</file>
<file>res/s/rescan/11.png</file>
<file>res/s/rescan/12.png</file>
<file>res/h/hide-pwd.png</file>
<file>res/h/right-pwd.png</file>
<file>res/h/show-pwd.png</file>
<file>res/h/no-pwd-wifi.png</file>
<file>translations/kylin-nm_bo.qm</file>
<file>translations/kylin-nm_tr.qm</file>
<file>translations/kylin-nm_zh_CN.qm</file>
<file>res/x/fly-mode-off.svg</file>
<file>res/x/fly-mode-on.svg</file>
<file>res/x/hot-spot-off.svg</file>
<file>res/x/hot-spot-on.svg</file>
<file>res/x/net-list-bg.svg</file>
<file>res/x/wifi-list-bg.svg</file>
<file>res/x/load-down.png</file>
<file>res/x/load-up.png</file>
<file>res/l/network-offline.png</file>
<file>res/l/network-offline.svg</file>
<file>res/l/network-online.png</file>
<file>res/l/network-online.svg</file>
<file>res/w/wifi-full.png</file>
<file>res/w/wifi-full-pwd.png</file>
<file>res/w/wifi-high.png</file>
<file>res/w/wifi-high-pwd.png</file>
<file>res/w/wifi-low.png</file>
<file>res/w/wifi-low-pwd.png</file>
<file>res/w/wifi-medium.png</file>
<file>res/w/wifi-medium-pwd.png</file>
<file>res/w/wifi-none.png</file>
<file>res/w/wifi-none-pwd.png</file>
<file>res/s/conning-a/1.png</file>
<file>res/s/conning-a/2.png</file>
<file>res/s/conning-a/3.png</file>
<file>res/s/conning-a/4.png</file>
<file>res/s/conning-a/5.png</file>
<file>res/s/conning-a/6.png</file>
<file>res/s/conning-a/7.png</file>
<file>res/s/conning-a/8.png</file>
<file>res/g/close_black.png</file>
<file>res/g/close_white.png</file>
<file>res/s/conning-s/1.png</file>
<file>res/s/conning-s/2.png</file>
<file>res/s/conning-s/3.png</file>
<file>res/s/conning-s/4.png</file>
<file>res/s/conning-s/5.png</file>
<file>res/s/conning-s/6.png</file>
<file>res/s/conning-s/7.png</file>
<file>res/s/conning-s/8.png</file>
<file>res/s/conning-s/9.png</file>
<file>res/s/conning-s/10.png</file>
<file>res/s/conning-s/11.png</file>
<file>res/s/conning-s/12.png</file>
<file>res/x/setup.png</file>
<file>res/x/control.svg</file>
<file>res/w/wifi6-full-pwd.png</file>
<file>res/w/wifi6-full.png</file>
<file>res/w/wifi6-high-pwd.png</file>
<file>res/w/wifi6-high.png</file>
<file>res/w/wifi6-low-pwd.png</file>
<file>res/w/wifi6-low.png</file>
<file>res/w/wifi6-medium-pwd.png</file>
<file>res/w/wifi6-medium.png</file>
<file>res/w/wifi6-none.png</file>
<file>res/w/wifi6+-none.png</file>
<file>res/w/wifi6+-meidum-pwd.png</file>
<file>res/w/wifi6+-medium.png</file>
<file>res/w/wifi6+-medium-pwd.png</file>
<file>res/w/wifi6+-low.png</file>
<file>res/w/wifi6+-low-pwd.png</file>
<file>res/w/wifi6+-high.png</file>
<file>res/w/wifi6+-high-pwd.png</file>
<file>res/w/wifi6+-full.png</file>
<file>res/w/wifi6+-full-pwd.png</file>
<file>res/w/wifi6-none-pwd.png</file>
<file>res/hw/wifi-full-pwd.png</file>
<file>res/hw/wifi-full.png</file>
<file>res/hw/wifi-high-pwd.png</file>
<file>res/hw/wifi-high.png</file>
<file>res/hw/wifi-low-pwd.png</file>
<file>res/hw/wifi-low.png</file>
<file>res/hw/wifi-medium-pwd.png</file>
<file>res/hw/wifi-medium.png</file>
<file>res/hw/wifi-none-pwd.png</file>
<file>res/hw/wifi-none.png</file>
<file>res/hw/wifi6-full-pwd.png</file>
<file>res/hw/wifi6-full.png</file>
<file>res/hw/wifi6-high-pwd.png</file>
<file>res/hw/wifi6-high.png</file>
<file>res/hw/wifi6-low-pwd.png</file>
<file>res/hw/wifi6-low.png</file>
<file>res/hw/wifi6-medium-pwd.png</file>
<file>res/hw/wifi6-medium.png</file>
<file>res/hw/wifi6-none-pwd.png</file>
<file>res/hw/wifi6-none.png</file>
<file>res/hw/wifi6+-full-pwd.png</file>
<file>res/hw/wifi6+-full.png</file>
<file>res/hw/wifi6+-high-pwd.png</file>
<file>res/hw/wifi6+-high.png</file>
<file>res/hw/wifi6+-low-pwd.png</file>
<file>res/hw/wifi6+-low.png</file>
<file>res/hw/wifi6+-medium-pwd.png</file>
<file>res/hw/wifi6+-medium.png</file>
<file>res/hw/wifi6+-none-pwd.png</file>
<file>res/hw/wifi6+-none.png</file>
<file>res/s/conning-b/1.png</file>
<file>res/s/conning-b/2.png</file>
<file>res/s/conning-b/3.png</file>
<file>res/s/conning-b/4.png</file>
<file>res/s/conning-b/5.png</file>
<file>res/s/conning-b/6.png</file>
<file>res/s/conning-b/7.png</file>
<file>res/s/conning-b/8.png</file>
<file>res/s/conning-b/9.png</file>
<file>res/s/conning-b/10.png</file>
<file>res/s/conning-b/11.png</file>
<file>res/s/conning-b/12.png</file>
</qresource>
</RCC>

View File

@ -0,0 +1,36 @@
#include "drownlabel.h"
#include "deviceframe.h"
#define ICONSIZE 16,16
DrownLabel::DrownLabel(QString devName, QWidget * parent) : QLabel(parent)
{
m_devName = devName;
setFixedSize(36,36);
loadPixmap(isChecked);
this->setProperty("useIconHighlightEffect", 0x2);
}
DrownLabel::~DrownLabel()
{
}
void DrownLabel::setDropDownStatus(bool status)
{
isChecked = status;
loadPixmap(isChecked);
}
void DrownLabel::loadPixmap(bool isChecked)
{
if (isChecked) {
setPixmap(QIcon::fromTheme("ukui-up-symbolic").pixmap(ICONSIZE));
} else {
setPixmap(QIcon::fromTheme("ukui-down-symbolic").pixmap(ICONSIZE));
}
}
void DrownLabel::mouseReleaseEvent(QMouseEvent *event)
{
emit labelClicked();
QWidget::mouseReleaseEvent(event);
}

View File

@ -0,0 +1,27 @@
#ifndef DROWNLABEL_H
#define DROWNLABEL_H
#include <QObject>
#include <QLabel>
#include <QWidget>
#include <QMouseEvent>
class DrownLabel : public QLabel
{
Q_OBJECT
public:
explicit DrownLabel(QString devName, QWidget * parent = nullptr);
~DrownLabel();
void setDropDownStatus(bool status);
QString m_devName;
bool isChecked = true;
private:
void loadPixmap(bool isChecked);
protected:
virtual void mouseReleaseEvent(QMouseEvent * event);
Q_SIGNALS:
void labelClicked();
};
#endif // DROWNLABEL_H

View File

@ -0,0 +1,105 @@
#include "infobutton.h"
#include <QEvent>
#include <QPainter>
#include <QApplication>
#include <QDebug>
#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
#define THEME_SCHAME "org.ukui.style"
#define COLOR_THEME "styleName"
InfoButton::InfoButton(QWidget *parent) : QPushButton(parent)
{
this->setFixedSize(BUTTON_SIZE);
initUI();
const QByteArray style_id(THEME_SCHAME);
if (QGSettings::isSchemaInstalled(style_id)) {
m_styleGsettings = new QGSettings(style_id);
connect(m_styleGsettings, &QGSettings::changed, this, &InfoButton::onGSettingChaned);
} else {
qDebug() << "Gsettings interface \"org.ukui.style\" is not exist!";
}
}
void InfoButton::initUI()
{
this->setFixedSize(BUTTON_SIZE);
m_backgroundColor = BACKGROUND_COLOR;
m_foregroundColor = FOREGROUND_COLOR_NORMAL;
}
void InfoButton::onGSettingChaned(const QString &key)
{
if (key == COLOR_THEME) {
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->repaint();
}
void InfoButton::leaveEvent(QEvent *event)
{
m_foregroundColor = FOREGROUND_COLOR_NORMAL;
this->repaint();
}
void InfoButton::mousePressEvent(QMouseEvent *event)
{
m_foregroundColor = FOREGROUND_COLOR_PRESS;
this->repaint();
return QPushButton::mousePressEvent(event);
}
void InfoButton::mouseReleaseEvent(QMouseEvent *event)
{
m_foregroundColor = FOREGROUND_COLOR_HOVER;
this->repaint();
return QPushButton::mouseReleaseEvent(event);
}

View File

@ -0,0 +1,35 @@
#ifndef INFOBUTTON_H
#define INFOBUTTON_H
#include <QPushButton>
#include <QIcon>
#include <QGSettings>
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;
//监听主题的Gsettings
QGSettings * m_styleGsettings = nullptr;
private slots:
void onGSettingChaned(const QString &key);
};
#endif // INFOBUTTON_H

View File

@ -0,0 +1,327 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2019 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 2 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "switchbutton.h"
#include <QDebug>
#define THEME_QT_SCHEMA "org.ukui.style"
#define THEME_GTK_SCHEMA "org.mate.interface"
#define TIMER_INTERVAL 5 //每隔5ms动画移动一次
#define MOVING_STEPS 40 //动画总共移动40次
SwitchButton::SwitchButton(QWidget *parent, bool useDisableStyle) :
QWidget(parent)
{
// this->resize(QSize(52, 24));
this->setFixedSize(QSize(50, 24));
checked = false;
hover = false;
disabled = false;
isMoving = false;
isAnimation = true;
m_useDisableStyle = useDisableStyle;
space = 4;
rectRadius = height()/2;
mStep = width()/MOVING_STEPS;//也就是40次动画就可以走完每次时间间隔是固定的5ms
mStartX = 0;
mEndX= 0;
mTimer = new QTimer(this);
mTimer->setInterval(TIMER_INTERVAL);//动画更新时间
connect(mTimer, SIGNAL(timeout()), this, SLOT(updatevalue()));
if(QGSettings::isSchemaInstalled(THEME_GTK_SCHEMA) && QGSettings::isSchemaInstalled(THEME_QT_SCHEMA)) {
QByteArray qtThemeID(THEME_QT_SCHEMA);
QByteArray gtkThemeID(THEME_GTK_SCHEMA);
m_gtkThemeSetting = new QGSettings(gtkThemeID,QByteArray(),this);
m_qtThemeSetting = new QGSettings(qtThemeID,QByteArray(),this);
QString style = m_qtThemeSetting->get("styleName").toString();
changeColor(style);
connect(m_qtThemeSetting,&QGSettings::changed, [this] (const QString &key) {
QString style = m_qtThemeSetting->get("styleName").toString();
if (key == "styleName") {
changeColor(style);
}
});
}
}
SwitchButton::~SwitchButton()
{
}
void SwitchButton::paintEvent(QPaintEvent *){
QPainter painter(this);
//启用反锯齿
painter.setRenderHint(QPainter::Antialiasing, true);
painter.setCompositionMode(QPainter::CompositionMode_Source);
drawBg(&painter);
if(!isAnimation)//动画如果禁用则圆形滑块isMoving始终为false
isMoving =false;
if(isMoving)
animation(&painter);
drawSlider(&painter);
painter.end();
}
void SwitchButton::changeColor(const QString &themes) {
if (hover) {
return ;//在鼠标下,禁止切换颜色鼠标离开时切换颜色
}
if (themes == "ukui-dark" || themes == "ukui-black") {
bgColorOff = QColor(OFF_BG_DARK_COLOR);
bgColorOn = QColor(ON_BG_DARK_COLOR);
rectColorEnabled = QColor(ENABLE_RECT_DARK_COLOR);
rectColorDisabled = QColor(DISABLE_RECT_DARK_COLOR);
sliderColorDisabled = QColor(DISABLE_RECT_DARK_COLOR);
sliderColorEnabled = QColor(ENABLE_RECT_DARK_COLOR);
bgHoverOnColor = QColor(ON_HOVER_BG_DARK_COLOR);
bgHoverOffColor = QColor(OFF_HOVER_BG_DARK_COLOR);
bgColorDisabled = QColor(DISABLE_DARK_COLOR);
} else {
bgColorOff = QColor(OFF_BG_LIGHT_COLOR);
bgColorOn = QColor(ON_BG_LIGHT_COLOR);
rectColorEnabled = QColor(ENABLE_RECT_LIGHT_COLOR);
rectColorDisabled = QColor(DISABLE_RECT_LIGHT_COLOR);
sliderColorDisabled = QColor(DISABLE_RECT_LIGHT_COLOR);
sliderColorEnabled = QColor(ENABLE_RECT_LIGHT_COLOR);
bgHoverOnColor = QColor(ON_HOVER_BG_LIGHT_COLOR);
bgHoverOffColor = QColor(OFF_HOVER_BG_LIGHT_COLOR);
bgColorDisabled = QColor(DISABLE_LIGHT_COLOR);
}
}
//动画绘制
void SwitchButton::animation(QPainter *painter){
painter->save();
int h = height();
int w = width();
painter->setPen(Qt::NoPen);
//颜色设置
if(checked){
//开关在左侧时
painter->setBrush(bgColorOn);
rect.setRect(0,0,h+mStartX,h);
}else{
painter->setBrush(bgColorOff);
rect.setRect(mStartX,0,w-mStartX,h);
}
painter->drawRoundedRect(rect,rectRadius,rectRadius);
painter->restore();
}
//绘制背景
void SwitchButton::drawBg(QPainter *painter){
int w = width();
int h = height();
painter->save();
painter->setPen(Qt::NoPen);
if (disabled && m_useDisableStyle) {
painter->setPen(Qt::NoPen);
painter->setBrush(bgColorDisabled);
} else {
if(checked){
if(isMoving){
painter->setBrush(bgColorOff);
rect.setRect(mStartX,0,w-mStartX,h);
}else {
painter->setBrush(bgColorOn);
rect.setRect(0, 0, w, h);
}
}else{
if(isMoving){
painter->setBrush(bgColorOn);
rect.setRect(0,0,mStartX+h,h);
}
else {
painter->setBrush(bgColorOff);
rect.setRect(0, 0, w, h);
}
}
}
//半径为高度的一半
painter->drawRoundedRect(rect,rectRadius,rectRadius);
painter->restore();
}
//绘制滑块,也就是圆形按钮
void SwitchButton::drawSlider(QPainter *painter){
painter->save();
painter->setPen(Qt::NoPen);
if (!disabled || !m_useDisableStyle){
painter->setBrush(sliderColorEnabled);
}
else
painter->setBrush(sliderColorDisabled);
if (disabled) {
if (!checked){
QRect smallRect(8, height() / 2 - 2, 10 , 4);
painter->drawRoundedRect(smallRect,3,3);
}else{
QRect smallRect(width() - 8 * 2, height() / 2 - 2, 10 , 4);
painter->drawRoundedRect(smallRect,3,3);
}
}
QRect rect(0, 0, width(), height());
int sliderWidth = rect.height() - space * 2;
QRect sliderRect(mStartX + space, space, sliderWidth, sliderWidth);
painter->drawEllipse(sliderRect);
painter->restore();
}
void SwitchButton::mousePressEvent(QMouseEvent *){
qDebug()<<isMoving<<checked<<disabled;
if (isMoving) {
return ;
}
if(disabled){
mEndX = 0;
Q_EMIT disabledClick();
return ;
}else{
checked = !checked;
Q_EMIT checkedChanged(checked);
mStep = width() / MOVING_STEPS;
if (checked){
//circle out
// endX = width() - height() + space;
//circle in
mEndX = width() - height();
}
else {
mEndX = 0;
}
mTimer->start();
isMoving = true;
}
}
void SwitchButton::resizeEvent(QResizeEvent *){
//每次开始的x坐标都是跳过圆角从直线的地方开始计算
mStep = width() / MOVING_STEPS;
if (checked){
//circle out
// startX = width() - height() + space;
//circle in
mStartX = width() - height();
}
else
mStartX = 0;
rectRadius = height()/2;
update();
}
void SwitchButton::enterEvent(QEvent *event) {
bgColorOn = bgHoverOnColor;
bgColorOff = bgHoverOffColor;
hover = true;
update();
return QWidget::enterEvent(event);
}
void SwitchButton::leaveEvent(QEvent *event) {
hover = false;
QString style = m_qtThemeSetting->get("styleName").toString();
changeColor(style);
update();
return QWidget::leaveEvent(event);
}
//根据事件向左还是向右移动
void SwitchButton::updatevalue(){
if (checked)
if (mStartX < mEndX-mStep){
mStartX = mStartX + mStep;
}
else{
mStartX = mEndX;
mTimer->stop();
isMoving = false;
}
else{
if (mStartX > mEndX+mStep){
mStartX = mStartX - mStep;
}
else{
mStartX = mEndX;
mTimer->stop();
isMoving = false;
}
}
update();
}
void SwitchButton::setChecked(bool checked){
if (this->checked != checked){
this->checked = checked;
Q_EMIT checkedChanged(checked);
update();
}
mStep = width() / MOVING_STEPS;
if (checked){
//circle out
// endX = width() - height() + space;
//circle in
mEndX = width() - height();
}
else{
mEndX = 0;
}
mTimer->start();
isMoving = true;
}
bool SwitchButton::isChecked(){
return this->checked;
}
void SwitchButton::setDisabledFlag(bool value)
{
disabled = value;
update();
}
bool SwitchButton::getDisabledFlag()
{
return disabled;
}
void SwitchButton::setAnimation(bool on){
isAnimation = on;
}

View File

@ -0,0 +1,121 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2019 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 2 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef SWITCHBUTTON_H
#define SWITCHBUTTON_H
#include <QWidget>
#include <QTimer>
#include <QPainter>
#include <QPainterPath>
#include <QEvent>
#include <QGSettings/QGSettings>
#define OFF_BG_DARK_COLOR "#404040"
#define OFF_HOVER_BG_DARK_COLOR "#666666"
#define ON_BG_DARK_COLOR "#3790FA"
#define ON_HOVER_BG_DARK_COLOR "#40A9FB"
#define DISABLE_DARK_COLOR "#474747"
#define DISABLE_RECT_DARK_COLOR "#6E6E6E"
#define ENABLE_RECT_DARK_COLOR "#FFFFFF"
#define OFF_BG_LIGHT_COLOR "#E0E0E0"
#define OFF_HOVER_BG_LIGHT_COLOR "#B3B3B3"
#define ON_BG_LIGHT_COLOR "#3790FA"
#define ON_HOVER_BG_LIGHT_COLOR "#40A9FB"
#define DISABLE_LIGHT_COLOR "#E9E9E9"
#define DISABLE_RECT_LIGHT_COLOR "#B3B3B3"
#define ENABLE_RECT_LIGHT_COLOR "#FFFFFF"
class SwitchButton : public QWidget
{
Q_OBJECT
public:
SwitchButton(QWidget *parent = 0, bool useDisableStyle = true);
~SwitchButton();
void setChecked(bool checked);
void setAnimation(bool on);
bool isChecked();
void setDisabledFlag(bool);
bool getDisabledFlag();
protected:
void mousePressEvent(QMouseEvent *);
void resizeEvent(QResizeEvent *);
void paintEvent(QPaintEvent *);
void enterEvent(QEvent *event);
void leaveEvent(QEvent *event);
void drawBg(QPainter * painter);
void drawSlider(QPainter * painter);
void changeColor(const QString &themes);
private:
bool checked; //切换的判断
bool disabled;
void animation(QPainter *painter);
QRect rect;
bool isMoving; //滑块动作判断
bool isAnimation; // 是否允许动画执行
QColor bgColorOff;
QColor bgColorOn;
QColor bgHoverOnColor;
QColor bgHoverOffColor;
QColor bgColorDisabled;
QColor sliderColorEnabled;
QColor sliderColorDisabled;
QColor rectColorEnabled;
QColor rectColorDisabled;
QColor sliderColorOff;
QColor sliderColorOn;
QGSettings *m_qtThemeSetting;
QGSettings *m_gtkThemeSetting;
int space; //滑块离背景间隔
int rectRadius; //圆角角度
int mStep; //移动步长
int mStartX;
int mEndX;
bool hover;
QTimer * mTimer;
bool m_useDisableStyle;
private Q_SLOTS:
void updatevalue();
Q_SIGNALS:
void checkedChanged(bool checked);
void disabledClick();
};
#endif // SWITCHBUTTON_H

View File

@ -0,0 +1,9 @@
#LIBINTERFACE_NAME = $$qtLibraryTarget(drownlabel)
SOURCES += \
$$PWD/DrownLabel/drownlabel.cpp \
HEADERS += \
$$PWD/DrownLabel/drownlabel.h \

View File

@ -0,0 +1,9 @@
#LIBINTERFACE_NAME = $$qtLibraryTarget(infobutton)
SOURCES += \
$$PWD/InfoButton/infobutton.cpp \
HEADERS += \
$$PWD/InfoButton/infobutton.h \

View File

@ -0,0 +1,8 @@
#LIBINTERFACE_NAME = $$qtLibraryTarget(switchbutton)
SOURCES += \
$$PWD/SwitchButton/switchbutton.cpp \
HEADERS += \
$$PWD/SwitchButton/switchbutton.h \

View File

@ -0,0 +1,155 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2019 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 2 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "mobilehotspot.h"
#include <QDebug>
MobileHotspot::MobileHotspot() : mFirstLoad(true) {
QTranslator* translator = new QTranslator(this);
qDebug() << "/usr/share/kylin-nm/mobilehotspot/" + QLocale::system().name();
if (!translator->load("/usr/share/kylin-nm/mobilehotspot/" + QLocale::system().name())) {
qDebug() << "load failed";
}
QApplication::installTranslator(translator);
pluginName = tr("MobileHotspot");
qDebug() << pluginName;
pluginType = NETWORK;
qDBusRegisterMetaType<QMap<QString, bool> >();
qDBusRegisterMetaType<QMap<QString, int> >();
needLoad = isExitWirelessDevice();
}
MobileHotspot::~MobileHotspot()
{
if (!mFirstLoad) {
// delete pluginWidget;
// pluginWidget = nullptr;
}
}
QString MobileHotspot::plugini18nName() {
return pluginName;
}
int MobileHotspot::pluginTypes() {
return pluginType;
}
QWidget *MobileHotspot::pluginUi() {
if (mFirstLoad) {
mFirstLoad = false;
pluginWidget = new MobileHotspotWidget;
pluginWidget->setAttribute(Qt::WA_DeleteOnClose);
}
return pluginWidget;
}
const QString MobileHotspot::name() const {
return QStringLiteral("mobilehotspot");
}
bool MobileHotspot::isEnable() const
{
qDebug() << needLoad;
return needLoad;
}
bool MobileHotspot::isShowOnHomePage() const
{
return false;
}
QIcon MobileHotspot::icon() const
{
return QIcon();
}
QString MobileHotspot::translationPath() const
{
return "/usr/share/kylin-nm/mobilehotspot/%1.ts";
}
void MobileHotspot::initSearchText()
{
//~ contents_path /mobilehotspot/mobilehotspot
tr("mobilehotspot");
//~ contents_path /mobilehotspot/mobilehotspot open
tr("mobilehotspot open");
}
bool MobileHotspot::isExitWirelessDevice()
{
QDBusInterface *interface = new QDBusInterface("com.kylin.network", "/com/kylin/network",
"com.kylin.network",
QDBusConnection::sessionBus());
if (!interface->isValid()) {
qDebug() << "/com/kylin/network is invalid";
return false;
}
QDBusMessage result = interface->call(QStringLiteral("getDeviceListAndEnabled"),1);
if(result.type() == QDBusMessage::ErrorMessage) {
qWarning() << "getWirelessDeviceList error:" << result.errorMessage();
return false;
}
auto dbusArg = result.arguments().at(0).value<QDBusArgument>();
QMap<QString, bool> deviceListMap;
dbusArg >> deviceListMap;
QDBusReply<QMap<QString, int> > capReply = interface->call("getWirelessDeviceCap");
if (!capReply.isValid()) {
qDebug()<<"execute dbus method 'getWirelessDeviceCap' is invalid in func initInterfaceInfo()" <<capReply.error().type() ;
return false;
}
QMap<QString, int> devCapMap = capReply.value();
if (deviceListMap.isEmpty()) {
qDebug() << "no wireless device";
return false;
} else {
QMap<QString, bool>::Iterator iter = deviceListMap.begin();
while (iter != deviceListMap.end()) {
QString interfaceName = iter.key();
if (!devCapMap.contains(interfaceName)) {
iter++;
continue;
}
if (deviceListMap[interfaceName] & 0x01) {
qDebug() << "wireless device" << interfaceName << "support hotspot";
return true;
}
iter++;
}
}
qDebug() << "no wireless device support hotspot";
return false;
}

View File

@ -0,0 +1,78 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2019 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 2 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef MOBILEHOTSPOT_H
#define MOBILEHOTSPOT_H
#include <QObject>
#include <QtPlugin>
#include <QTranslator>
#include <QApplication>
#include <QDBusMessage>
#include <QDBusObjectPath>
#include <QDBusInterface>
#include <QDBusReply>
#include <QDBusMetaType>
#include "interface.h"
#include "switchbutton.h"
#include "hoverbtn.h"
#include "mobilehotspotwidget.h"
namespace Ui {
class MobileHotspot;
}
class MobileHotspot : public QObject, CommonInterface
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.ukcc.CommonInterface")
Q_INTERFACES(CommonInterface)
public:
MobileHotspot();
~MobileHotspot();
QString plugini18nName() Q_DECL_OVERRIDE;
int pluginTypes() Q_DECL_OVERRIDE;
QWidget * pluginUi() Q_DECL_OVERRIDE;
const QString name() const Q_DECL_OVERRIDE;
bool isShowOnHomePage() const Q_DECL_OVERRIDE;
QIcon icon() const Q_DECL_OVERRIDE;
bool isEnable() const Q_DECL_OVERRIDE;
QString translationPath() const Q_DECL_OVERRIDE;
private:
void initSearchText();
bool isExitWirelessDevice();
QString pluginName;
int pluginType;
MobileHotspotWidget *pluginWidget;
private:
bool mFirstLoad;
bool needLoad;
};
#endif // MOBILEHOTSPOT_H

View File

@ -0,0 +1,42 @@
QT += widgets network dbus gui core
TEMPLATE = lib
CONFIG += plugin
TARGET = $$qtLibraryTarget(mobilehotspot)
DESTDIR = ../..
target.path = $$[QT_INSTALL_LIBS]/ukui-control-center
trans.files = translations/*
trans.path = /usr/share/kylin-nm/mobilehotspot/
INCLUDEPATH += \
$$PROJECT_COMPONENTSOURCE \
$$PROJECT_ROOTDIR \
/usr/include/ukcc/interface \
/usr/include/ukcc/widgets
LIBS += -L$$[QT_INSTALL_LIBS] -lgsettings-qt -lukcc
CONFIG += c++11 \
link_pkgconfig \
PKGCONFIG += gsettings-qt \
#DEFINES += QT_DEPRECATED_WARNINGS
SOURCES += \
mobilehotspot.cpp \
mobilehotspotwidget.cpp
HEADERS += \
mobilehotspot.h \
mobilehotspotwidget.h \
libukcc_global.h
INSTALLS += target \
trans
TRANSLATIONS += \
translations/zh_CN.ts \
translations/tr.ts \
translations/bo.ts

View File

@ -0,0 +1,678 @@
#include "mobilehotspotwidget.h"
#include <QDebug>
#define LABEL_RECT 17, 0, 105, 23
#define CONTENTS_MARGINS 0, 0, 0, 0
#define FRAME_MIN_SIZE 550, 60
#define FRAME_MAX_SIZE 16777215, 16777215
#define CONTECT_FRAME_MAX_SIZE 16777215, 60
#define LABLE_MIN_WIDTH 140
#define COMBOBOX_MIN_WIDTH 200
#define LINE_MAX_SIZE 16777215, 1
#define LINE_MIN_SIZE 0, 1
#define LAYOUT_LEFT_MARGINS 8
#define ICON_SIZE 24,24
#define WIRELESS 1
#define AP_NAME_MAX_LENGTH 32
const QByteArray GSETTINGS_SCHEMA = "org.ukui.kylin-nm.switch";
const QString WIRELESS_SWITCH = "wirelessswitch";
void MobileHotspotWidget::showDesktopNotify(const QString &message)
{
QDBusInterface iface("org.freedesktop.Notifications",
"/org/freedesktop/Notifications",
"org.freedesktop.Notifications",
QDBusConnection::sessionBus());
QList<QVariant> args;
args<<(tr("ukui control center"))
<<((unsigned int) 0)
<<QString("gnome-dev-ethernet")
<<tr("ukui control center desktop message") //显示的是什么类型的信息
<<message //显示的具体信息
<<QStringList()
<<QVariantMap()
<<(int)-1;
iface.callWithArgumentList(QDBus::AutoDetect,"Notify",args);
}
MobileHotspotWidget::MobileHotspotWidget(QWidget *parent) : QWidget(parent)
{
mVlayout = new QVBoxLayout(this);
mVlayout->setContentsMargins(CONTENTS_MARGINS);
qDBusRegisterMetaType<QMap<QString, bool> >();
qDBusRegisterMetaType<QMap<QString, int> >();
qDBusRegisterMetaType<QVector<QStringList> >();
qDBusRegisterMetaType<QMap<QString, QVector<QStringList> >>();
initUI();
m_switchBtn->installEventFilter(this);
m_interface = new QDBusInterface("com.kylin.network", "/com/kylin/network",
"com.kylin.network",
QDBusConnection::sessionBus());
if(!m_interface->isValid()) {
qDebug() << "dbus interface com.kylin.network is invaild";
m_switchBtn->setChecked(false);
setUiEnabled(false);
}
m_hostName = getHostName();
initDbusConnect();
initInterfaceInfo();
getApInfo();
connect(m_switchBtn, &SwitchButton::checkedChanged, this, &MobileHotspotWidget::setUiEnabled);
connect(m_interfaceComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [=]() {
m_interfaceName = m_interfaceComboBox->currentText();
updateBandCombox();
});
connect(m_pwdShowBox, &QCheckBox::clicked, this, [=]() {
if (m_pwdNameLine->echoMode() == QLineEdit::Password) {
m_pwdShowBox->setIcon(QIcon::fromTheme("ukui-eye-display-symbolic"));
m_pwdNameLine->setEchoMode(QLineEdit::Normal);
} else {
m_pwdNameLine->setEchoMode(QLineEdit::Password);
m_pwdShowBox->setIcon(QIcon::fromTheme("ukui-eye-hidden-symbolic"));
}
});
}
MobileHotspotWidget::~MobileHotspotWidget()
{
delete m_interface;
}
bool MobileHotspotWidget::eventFilter(QObject *watched, QEvent *event)
{
if (event->type() == QEvent::MouseButtonDblClick && watched == m_switchBtn) {
return true;
}
if (event->type() == QEvent::MouseButtonPress) {
if (watched == m_switchBtn) {
if (!m_interface->isValid()) {
return true;
}
if (m_switchBtn->getDisabledFlag()) {
showDesktopNotify(tr("wirless switch is close or no wireless device"));
return true;
}
if (m_switchBtn->isChecked()) {
showDesktopNotify(tr("start to close hotspot"));
QDBusReply<void> reply = m_interface->call("deactiveWirelessAp", m_apNameLine->text(), m_uuid);
if (!reply.isValid()) {
qDebug() << "[MobileHotspotWidget] call deactiveWirelessAp failed ";
return true;
}
} else {
if (m_apNameLine->text().isEmpty() || m_interfaceName.isEmpty())
{
showDesktopNotify(tr("hotpots name or device is invalid"));
return true;
}
if (m_pwdNameLine->text().length() < 8) {
showDesktopNotify(tr("can not create hotspot with password length less than eight!"));
return true;
}
showDesktopNotify(tr("start to open hotspot ") + m_apNameLine->text());
QDBusReply<void> reply = m_interface->call("activeWirelessAp",
m_apNameLine->text(),
m_pwdNameLine->text(),
m_freqBandComboBox->currentText(),
m_interfaceComboBox->currentText());
if (!reply.isValid()) {
qDebug() << "[MobileHotspotWidget] call deactiveWirelessAp failed ";
return true;
}
}
return true;
}
}
return QWidget::eventFilter(watched, event);
}
void MobileHotspotWidget::paintEvent(QPaintEvent *event)
{
QWidget::paintEvent(event);
}
void MobileHotspotWidget::initUI()
{
QFrame *hotspotFrame = new QFrame(this);
hotspotFrame->setMinimumSize(FRAME_MIN_SIZE);
hotspotFrame->setMaximumSize(FRAME_MAX_SIZE);
hotspotFrame->setFrameShape(QFrame::Box);
QVBoxLayout *hotspotLyt = new QVBoxLayout(hotspotFrame);
hotspotLyt->setContentsMargins(0, 0, 0, 0);
m_hotspotTitleLabel = new TitleLabel(this);
m_hotspotTitleLabel->setText(tr("Hotspot"));
setSwitchFrame();
setApNameFrame();
setPasswordFrame();
setFreqBandFrame();
setInterFaceFrame();
switchAndApNameLine = myLine();
apNameAndPwdLine = myLine();
pwdAndfreqBandLine = myLine();
freqBandAndInterfaceLine = myLine();
/* add widget */
hotspotLyt->addWidget(m_switchFrame);
hotspotLyt->addWidget(switchAndApNameLine);
hotspotLyt->addWidget(m_ApNameFrame);
hotspotLyt->addWidget(apNameAndPwdLine);
hotspotLyt->addWidget(m_passwordFrame);
hotspotLyt->addWidget(pwdAndfreqBandLine);
hotspotLyt->addWidget(m_freqBandFrame);
hotspotLyt->addWidget(freqBandAndInterfaceLine);
hotspotLyt->addWidget(m_interfaceFrame);
hotspotLyt->setSpacing(0);
mVlayout->addWidget(m_hotspotTitleLabel);
mVlayout->setSpacing(8);
mVlayout->addWidget(hotspotFrame);
mVlayout->addStretch();
}
void MobileHotspotWidget::initDbusConnect()
{
if(m_interface->isValid()) {
connect(m_interface,SIGNAL(activateFailed(QString)), this, SLOT(onActivateFailed(QString)), Qt::QueuedConnection);
connect(m_interface,SIGNAL(deactivateFailed(QString)), this, SLOT(onDeactivateFailed(QString)), Qt::QueuedConnection);
connect(m_interface,SIGNAL(deviceStatusChanged()), this, SLOT(onDeviceStatusChanged()), Qt::QueuedConnection);
connect(m_interface,SIGNAL(deviceNameChanged(QString, QString, int)), this, SLOT(onDeviceNameChanged(QString, QString, int)), Qt::QueuedConnection);
connect(m_interface,SIGNAL(hotspotDeactivated(QString, QString)), this, SLOT(onHotspotDeactivated(QString, QString)), Qt::QueuedConnection);
connect(m_interface,SIGNAL(hotspotActivated(QString, QString, QString)), this, SLOT(onHotspotActivated(QString, QString, QString)), Qt::QueuedConnection);
connect(m_interface, SIGNAL(wlanactiveConnectionStateChanged(QString, QString, QString, int)), this, SLOT(onActiveConnectionChanged(QString, QString, QString, int)), Qt::QueuedConnection);
}
if (QGSettings::isSchemaInstalled(GSETTINGS_SCHEMA)) {
m_switchGsettings = new QGSettings(GSETTINGS_SCHEMA);
onGsettingChanged(WIRELESS_SWITCH);
connect(m_switchGsettings, &QGSettings::changed, this, &MobileHotspotWidget::onGsettingChanged, Qt::QueuedConnection);
}
connect(m_apNameLine, &QLineEdit::textEdited, this, &MobileHotspotWidget::onApLineEditTextEdit);
}
void MobileHotspotWidget::onApLineEditTextEdit(QString text)
{
int count = 0;
int i = 0;
for ( ; i < text.length(); ++i) {
count += text.mid(i,1).toLocal8Bit().length();
if (count > AP_NAME_MAX_LENGTH) {
break;
}
}
m_apNameLine->setText(text.left(i));
}
void MobileHotspotWidget::onActiveConnectionChanged(QString deviceName, QString ssid, QString uuid, int status)
{
if(m_uuid == uuid && status == 4) {
showDesktopNotify(tr("hotspot already close"));
m_switchBtn->setChecked(false);
setUiEnabled(false);
m_uuid.clear();
}
}
void MobileHotspotWidget::onGsettingChanged(const QString &key)
{
if (key == WIRELESS_SWITCH) {
bool status = m_switchGsettings->get(WIRELESS_SWITCH).toBool();
if (!status) {
// if (m_switchBtn->isChecked()) {
// if(m_interface->isValid()) {
// QDBusReply<void> reply = m_interface->call("deactiveWirelessAp",
// m_apNameLine->text(),
// m_pwdNameLine->text(),
// m_interfaceComboBox->currentText());
// if (!reply.isValid()) {
// qDebug() << "[MobileHotspotWidget] call deactiveWirelessAp failed ";
// return true;
// }
// }
// }
m_switchBtn->setChecked(status);
m_uuid.clear();
m_switchBtn->setDisabledFlag(true);
} else {
m_switchBtn->setDisabledFlag(false);
}
}
}
void MobileHotspotWidget::initInterfaceInfo()
{
if(!m_interface->isValid()) {
return;
}
m_interfaceComboBox->clear();
QDBusReply<QMap<QString, bool> > reply = m_interface->call("getDeviceListAndEnabled",WIRELESS);
if (!reply.isValid()) {
qDebug()<<"execute dbus method 'getDeviceListAndEnabled' is invalid in func initInterfaceInfo()";
setWidgetHidden(true);
return;
}
QMap<QString, bool> devMap = reply.value();
QDBusReply<QMap<QString, int> > capReply = m_interface->call("getWirelessDeviceCap");
if (!capReply.isValid()) {
qDebug()<<"execute dbus method 'getWirelessDeviceCap' is invalid in func initInterfaceInfo()" <<capReply.error().type() ;
setWidgetHidden(true);
return;
}
QMap<QString, int> devCapMap = capReply.value();
if (devMap.isEmpty()) {
qDebug() << "no wireless device";
setWidgetHidden(true);
m_switchBtn->setDisabledFlag(true);
} else {
QMap<QString, bool>::Iterator iter = devMap.begin();
while (iter != devMap.end()) {
QString interfaceName = iter.key();
if (devCapMap[interfaceName] & 0x01) {
m_interfaceComboBox->addItem(interfaceName);
}
iter++;
}
if (m_interfaceComboBox->count() > 0) {
setWidgetHidden(false);
m_interfaceName = m_interfaceComboBox->currentText();
if (m_interfaceComboBox->count() == 1) {
updateBandCombox();
}
} else {
qDebug() << "no useable wireless device";
setWidgetHidden(true);
}
}
}
void MobileHotspotWidget::getApInfo()
{
if (!m_interface->isValid()) {
return;
}
if (m_interfaceComboBox->count() <= 0) {
m_switchBtn->setChecked(false);
setWidgetHidden(true);
qWarning() << "getApInfo but interface is empty";
return;
}
QDBusReply<QStringList> reply = m_interface->call("getStoredApInfo");
if (!reply.isValid()) {
qDebug()<<"execute dbus method 'getStoredApInfo' is invalid in func getObjectPath()";
}
QStringList apInfo = reply.value();
if (apInfo.isEmpty()) {
qDebug() << "no stored hotspot info";
m_apNameLine->setText(m_hostName);
m_pwdNameLine->setText("12345678");
return;
} else {
int index = m_interfaceComboBox->findText(apInfo.at(2));
if (index >= 0) {
m_apNameLine->setText(apInfo.at(0));
m_pwdNameLine->setText(apInfo.at(1));
m_interfaceComboBox->setCurrentIndex(index);
m_interfaceName = apInfo.at(2);
if (apInfo.at(3) == "true") {
m_switchBtn->setChecked(true);
setUiEnabled(true);
m_uuid = apInfo.at(4);
} else {
m_switchBtn->setChecked(false);
setUiEnabled(false);
}
} else {
qDebug() << "no such interface " << apInfo.at(2);
}
}
}
void MobileHotspotWidget::setSwitchFrame()
{
/* Open */
m_switchFrame = new QFrame(this);
m_switchFrame->setFrameShape(QFrame::Shape::NoFrame);
m_switchFrame->setMinimumSize(FRAME_MIN_SIZE);
m_switchFrame->setMaximumSize(CONTECT_FRAME_MAX_SIZE);
QHBoxLayout *switchLayout = new QHBoxLayout();
m_switchLabel = new QLabel(tr("Open"), this);
m_switchLabel->setMinimumWidth(LABLE_MIN_WIDTH);
m_switchBtn = new SwitchButton(this);
switchLayout->addSpacing(LAYOUT_LEFT_MARGINS);
switchLayout->addWidget(m_switchLabel);
switchLayout->addStretch();
switchLayout->addWidget(m_switchBtn);
m_switchFrame->setLayout(switchLayout);
}
void MobileHotspotWidget::setApNameFrame()
{
/* ApName */
m_ApNameFrame = new QFrame(this);
m_ApNameFrame->setFrameShape(QFrame::Shape::NoFrame);
m_ApNameFrame->setMinimumSize(FRAME_MIN_SIZE);
m_ApNameFrame->setMaximumSize(CONTECT_FRAME_MAX_SIZE);
QHBoxLayout *apNameHLayout = new QHBoxLayout();
m_apNameLabel = new QLabel(tr("Wi-Fi Name"), this);
m_apNameLabel->setMinimumWidth(LABLE_MIN_WIDTH);
m_apNameLine = new QLineEdit(this);
m_apNameLine->setMinimumWidth(COMBOBOX_MIN_WIDTH);
m_apNameLine->setMaxLength(AP_NAME_MAX_LENGTH);
apNameHLayout->addSpacing(LAYOUT_LEFT_MARGINS);
apNameHLayout->addWidget(m_apNameLabel);
apNameHLayout->addWidget(m_apNameLine);
m_ApNameFrame->setLayout(apNameHLayout);
}
void MobileHotspotWidget::setPasswordFrame()
{
/* Password */
m_passwordFrame = new QFrame(this);
m_passwordFrame->setFrameShape(QFrame::Shape::NoFrame);
m_passwordFrame->setMinimumSize(FRAME_MIN_SIZE);
m_passwordFrame->setMaximumSize(CONTECT_FRAME_MAX_SIZE);
QHBoxLayout *passwordHLayout = new QHBoxLayout();
m_pwdLabel = new QLabel(tr("Password"), this);
m_pwdLabel->setMinimumWidth(LABLE_MIN_WIDTH);
m_pwdNameLine = new QLineEdit(this);
m_pwdNameLine->setMinimumWidth(COMBOBOX_MIN_WIDTH);
m_pwdNameLine->setEchoMode(QLineEdit::Password);
passwordHLayout->addSpacing(LAYOUT_LEFT_MARGINS);
passwordHLayout->addWidget(m_pwdLabel);
passwordHLayout->addWidget(m_pwdNameLine);
m_passwordFrame->setLayout(passwordHLayout);
m_pwdShowBox = new QPushButton(this);
m_pwdShowBox->setFlat(true);
m_pwdShowBox->setFixedSize(ICON_SIZE);
m_pwdShowBox->setIcon(QIcon::fromTheme("ukui-eye-hidden-symbolic"));
m_pwdShowBox->setCursor(Qt::PointingHandCursor);
//防止文本框输入内容位于按钮之下
QMargins margins = m_pwdNameLine->textMargins();
m_pwdNameLine->setTextMargins(margins.left(), margins.top(), m_pwdShowBox->width() + 10, margins.bottom());
QHBoxLayout *pSearchLayout = new QHBoxLayout();
pSearchLayout->addStretch();
pSearchLayout->addWidget(m_pwdShowBox);
pSearchLayout->setSpacing(0);
pSearchLayout->setContentsMargins(0, 0, 10, 0);
m_pwdNameLine->setLayout(pSearchLayout);
m_pwdNameLine->setEchoMode(QLineEdit::Password);
}
void MobileHotspotWidget::setFreqBandFrame()
{
/* frequency band */
m_freqBandFrame = new QFrame(this);
m_freqBandFrame->setFrameShape(QFrame::Shape::NoFrame);
m_freqBandFrame->setMinimumSize(FRAME_MIN_SIZE);
m_freqBandFrame->setMaximumSize(CONTECT_FRAME_MAX_SIZE);
QHBoxLayout *freqBandHLayout = new QHBoxLayout();
m_freqBandLabel = new QLabel(tr("Frequency band"), this);
m_freqBandLabel->setMinimumWidth(LABLE_MIN_WIDTH);
m_freqBandComboBox = new QComboBox(this);
m_freqBandComboBox->setInsertPolicy(QComboBox::NoInsert);
m_freqBandComboBox->setMinimumWidth(COMBOBOX_MIN_WIDTH);
m_freqBandComboBox->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
m_freqBandComboBox->addItem("2.4Ghz");
m_freqBandComboBox->addItem("5Ghz");
freqBandHLayout->addSpacing(LAYOUT_LEFT_MARGINS);
freqBandHLayout->addWidget(m_freqBandLabel);
freqBandHLayout->addWidget(m_freqBandComboBox);
m_freqBandFrame->setLayout(freqBandHLayout);
}
void MobileHotspotWidget::setInterFaceFrame()
{
/* key tips */
m_interfaceFrame = new QFrame(this);
m_interfaceFrame->setFrameShape(QFrame::Shape::NoFrame);
m_interfaceFrame->setMinimumSize(FRAME_MIN_SIZE);
m_interfaceFrame->setMaximumSize(CONTECT_FRAME_MAX_SIZE);
QHBoxLayout *interfaceHLayout = new QHBoxLayout;
m_interfaceLabel = new QLabel(tr("Net card"), this);
m_interfaceLabel->setMinimumWidth(LABLE_MIN_WIDTH);
m_interfaceComboBox = new QComboBox(this);
m_interfaceComboBox->setInsertPolicy(QComboBox::NoInsert);
m_interfaceComboBox->setMinimumWidth(COMBOBOX_MIN_WIDTH);
m_interfaceComboBox->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
interfaceHLayout->addSpacing(LAYOUT_LEFT_MARGINS);
interfaceHLayout->addWidget(m_interfaceLabel);
interfaceHLayout->addWidget(m_interfaceComboBox);
m_interfaceFrame->setLayout(interfaceHLayout);
}
void MobileHotspotWidget::onActivateFailed(QString errorMessage)
{
if (errorMessage.indexOf("hotspot")) {
//todo
// showDesktopNotify(errorMessage);
}
}
void MobileHotspotWidget::onDeactivateFailed(QString errorMessage)
{
if (errorMessage.indexOf("hotspot")) {
// showDesktopNotify(errorMessage);
}
}
//设备插拔
void MobileHotspotWidget::onDeviceStatusChanged()
{
initInterfaceInfo();
getApInfo();
}
void MobileHotspotWidget::onDeviceNameChanged(QString oldName, QString newName, int type)
{
if (WIRELESS != type) {
return;
}
int index = m_interfaceComboBox->findText(oldName);
if (index >= 0) {
m_interfaceComboBox->setItemText(index, newName);
if (m_interfaceName == oldName) {
m_interfaceName = newName;
}
}
}
//热点断开
void MobileHotspotWidget::onHotspotDeactivated(QString devName, QString ssid)
{
if (!m_switchBtn->isChecked()) {
return;
}
if (devName == m_interfaceComboBox->currentText() && ssid == m_apNameLine->text()) {
m_switchBtn->setChecked(false);
m_uuid.clear();
// setUiEnabled(true);
showDesktopNotify(tr("hotspot already close"));
}
}
//热点连接
void MobileHotspotWidget::onHotspotActivated(QString devName, QString ssid, QString uuid)
{
qDebug() << "onHotspotActivated" <<devName << ssid << uuid;
if (m_switchBtn->isChecked()) {
return;
}
if (devName == m_interfaceComboBox->currentText() && ssid == m_apNameLine->text()) {
m_switchBtn->setChecked(true);
m_uuid = uuid;
// setUiEnabled(false);
showDesktopNotify(tr("hotspot already open"));
} else {
QStringList info;
if (!getApInfoBySsid(devName, ssid, info)) {
return;
}
int index = m_interfaceComboBox->findText(devName);
if (index >= 0) {
showDesktopNotify(tr("hotspot already open"));
m_apNameLine->setText(ssid);
m_interfaceComboBox->setCurrentIndex(index);
m_switchBtn->setChecked(true);
m_switchBtn->setDisabledFlag(false);
m_pwdNameLine->setText(info.at(0));
m_interfaceName = devName;
updateBandCombox();
index = m_freqBandComboBox->findText(info.at(1));
if (index >= 0) {
m_freqBandComboBox->setCurrentIndex(index);
}
m_uuid = uuid;
} else {
qDebug() << "no such device in combo box";
}
}
}
bool MobileHotspotWidget::getApInfoBySsid(QString devName, QString ssid, QStringList &info)
{
info.clear();
if(!m_interface->isValid()) {
return false;
}
QDBusReply<QStringList> reply = m_interface->call("getApInfoBySsid", devName, ssid);
if (!reply.isValid()) {
qDebug()<<"execute dbus method 'getApInfoBySsid' is invalid in func getApInfoBySsid()";
}
info = reply.value();
if (info.size() != 2) {
return false;
} else {
return true;
}
}
void MobileHotspotWidget::setUiEnabled(bool enable)
{
qDebug() << "switch mode change to " << enable;
if (enable) {
m_pwdNameLine->setEnabled(false);
m_freqBandComboBox->setEnabled(false);
m_interfaceComboBox->setEnabled(false);
m_apNameLine->setEnabled(false);
} else {
m_pwdNameLine->setEnabled(true);
m_freqBandComboBox->setEnabled(true);
m_interfaceComboBox->setEnabled(true);
m_apNameLine->setEnabled(true);
}
}
void MobileHotspotWidget::setWidgetHidden(bool isHidden)
{
m_ApNameFrame->setHidden(isHidden);
m_passwordFrame->setHidden(isHidden);
m_freqBandFrame->setHidden(isHidden);
m_interfaceFrame->setHidden(isHidden);
switchAndApNameLine->setHidden(isHidden);
apNameAndPwdLine->setHidden(isHidden);
pwdAndfreqBandLine->setHidden(isHidden);
freqBandAndInterfaceLine->setHidden(isHidden);
if (isHidden) {
m_switchBtn->setChecked(false);
m_switchBtn->setDisabledFlag(true);
m_interfaceName = "";
m_uuid = "";
} else {
m_switchBtn->setDisabledFlag(false);
onGsettingChanged(WIRELESS_SWITCH);
}
}
void MobileHotspotWidget::updateBandCombox()
{
m_freqBandComboBox->clear();
QDBusReply<QMap<QString, int> > capReply = m_interface->call("getWirelessDeviceCap");
if (!capReply.isValid()) {
qDebug()<<"execute dbus method 'getWirelessDeviceCap' is invalid in func initInterfaceInfo()" << capReply.error().message();
setWidgetHidden(true);
return;
}
QMap<QString, int> devCapMap = capReply.value();
if (devCapMap[m_interfaceName] & 0x02) {
m_freqBandComboBox->addItem("2.4Ghz");
}
if (devCapMap[m_interfaceName] & 0x04) {
m_freqBandComboBox->addItem("5Ghz");
}
}
QFrame* MobileHotspotWidget::myLine()
{
QFrame *line = new QFrame(this);
line->setMinimumSize(QSize(LINE_MIN_SIZE));
line->setMaximumSize(QSize(LINE_MAX_SIZE));
line->setLineWidth(0);
line->setFrameShape(QFrame::HLine);
line->setFrameShadow(QFrame::Sunken);
return line;
}
QString MobileHotspotWidget::getHostName()
{
int count = 0;
while (count < 3) {
QDBusInterface hostInterface("org.freedesktop.hostname1",
"/org/freedesktop/hostname1",
"org.freedesktop.hostname1",
QDBusConnection::systemBus());
if (hostInterface.isValid()) {
return hostInterface.property("Hostname").value<QString>();
} else {
count++;
}
}
return "default";
}

View File

@ -0,0 +1,119 @@
#ifndef MOBILEHOTSPOTWIDGET_H
#define MOBILEHOTSPOTWIDGET_H
#include <QWidget>
#include <QLabel>
#include <QHBoxLayout>
#include <QPushButton>
#include <QComboBox>
#include <QLineEdit>
#include <QCheckBox>
#include <QTranslator>
#include <QApplication>
#include <QDBusMessage>
#include <QDBusObjectPath>
#include <QDBusInterface>
#include <QDBusReply>
#include <QDBusMetaType>
#include "switchbutton.h"
#include "titlelabel.h"
class MobileHotspotWidget : public QWidget
{
Q_OBJECT
public:
explicit MobileHotspotWidget(QWidget *parent = nullptr);
~MobileHotspotWidget();
private:
QFrame *m_switchFrame = nullptr; //开关
QFrame *m_ApNameFrame = nullptr; //wifi名称
QFrame *m_passwordFrame = nullptr; //密码
QFrame *m_freqBandFrame = nullptr; //频带
QFrame *m_interfaceFrame = nullptr; //网卡
SwitchButton *m_switchBtn;
TitleLabel *m_hotspotTitleLabel;
QLabel *m_switchLabel;
QLabel *m_apNameLabel;
QLabel *m_pwdLabel;
QLabel *m_freqBandLabel;
QLabel *m_interfaceLabel;
QPushButton *m_pwdShowBox;
QFrame *switchAndApNameLine;
QFrame *apNameAndPwdLine;
QFrame *pwdAndfreqBandLine;
QFrame *freqBandAndInterfaceLine;
QVBoxLayout *mVlayout;
QLineEdit *m_apNameLine;
QLineEdit *m_pwdNameLine;
QComboBox *m_freqBandComboBox;
QComboBox *m_interfaceComboBox;
QDBusInterface *m_interface = nullptr;
QString m_interfaceName = "";
QGSettings *m_switchGsettings = nullptr;
QString m_uuid = "";
QString m_hostName = "";
void initUI();
void initDbusConnect();
void initInterfaceInfo();
void getApInfo();
bool getApInfoBySsid(QString devName, QString ssid, QStringList &info);
void setSwitchFrame();
void setApNameFrame();
void setPasswordFrame();
void setFreqBandFrame();
void setInterFaceFrame();
void setUiEnabled(bool enable);
void setWidgetHidden(bool isHidden);
void showDesktopNotify(const QString &message);
void updateBandCombox();
QString getHostName();
bool eventFilter(QObject *watched, QEvent *event);
void paintEvent(QPaintEvent *event);
QFrame* myLine();
signals:
private slots:
void onActivateFailed(QString errorMessage);
void onDeactivateFailed(QString errorMessage);
//设备插拔
void onDeviceStatusChanged();
void onDeviceNameChanged(QString oldName, QString newName, int type);
//热点断开
void onHotspotDeactivated(QString devName, QString ssid);
//热点连接
void onHotspotActivated(QString devName, QString ssid, QString uuid);
void onGsettingChanged(const QString &key);
void onActiveConnectionChanged(QString deviceName, QString ssid, QString uuid, int status);
void onApLineEditTextEdit(QString text);
};
#endif // MOBILEHOTSPOTWIDGET_H

View File

@ -0,0 +1 @@
<クd<>箆!ソ`。スン

View File

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>MobileHotspot</name>
<message>
<location filename="../mobilehotspot.cpp" line="35"/>
<source>MobileHotspot</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspot.cpp" line="101"/>
<source>mobilehotspot</source>
<translation type="unfinished"></translation>
<extra-contents_path>/mobilehotspot/mobilehotspot</extra-contents_path>
</message>
<message>
<location filename="../mobilehotspot.cpp" line="103"/>
<source>mobilehotspot open</source>
<translation type="unfinished"></translation>
<extra-contents_path>/mobilehotspot/mobilehotspot open</extra-contents_path>
</message>
</context>
<context>
<name>MobileHotspotWidget</name>
<message>
<location filename="../mobilehotspotwidget.cpp" line="30"/>
<source>ukui control center</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="33"/>
<source>ukui control center desktop message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="102"/>
<source>wirless switch is close or no wireless device</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="106"/>
<source>start to close hotspot</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="115"/>
<source>hotpots name or device is invalid</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="119"/>
<source>can not create hotspot with password length less than eight!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="122"/>
<source>start to open hotspot </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="155"/>
<source>Hotspot</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="227"/>
<location filename="../mobilehotspotwidget.cpp" line="532"/>
<source>hotspot already close</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="367"/>
<source>Open</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="388"/>
<source>Wi-Fi Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="410"/>
<source>Password</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="448"/>
<source>Frequency band</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="473"/>
<source>Net card</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="548"/>
<location filename="../mobilehotspotwidget.cpp" line="556"/>
<source>hotspot already open</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -0,0 +1 @@
<クd<>箆!ソ`。スン

View File

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>MobileHotspot</name>
<message>
<location filename="../mobilehotspot.cpp" line="35"/>
<source>MobileHotspot</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspot.cpp" line="101"/>
<source>mobilehotspot</source>
<translation type="unfinished"></translation>
<extra-contents_path>/mobilehotspot/mobilehotspot</extra-contents_path>
</message>
<message>
<location filename="../mobilehotspot.cpp" line="103"/>
<source>mobilehotspot open</source>
<translation type="unfinished"></translation>
<extra-contents_path>/mobilehotspot/mobilehotspot open</extra-contents_path>
</message>
</context>
<context>
<name>MobileHotspotWidget</name>
<message>
<location filename="../mobilehotspotwidget.cpp" line="30"/>
<source>ukui control center</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="33"/>
<source>ukui control center desktop message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="102"/>
<source>wirless switch is close or no wireless device</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="106"/>
<source>start to close hotspot</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="115"/>
<source>hotpots name or device is invalid</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="119"/>
<source>can not create hotspot with password length less than eight!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="122"/>
<source>start to open hotspot </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="155"/>
<source>Hotspot</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="227"/>
<location filename="../mobilehotspotwidget.cpp" line="532"/>
<source>hotspot already close</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="367"/>
<source>Open</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="388"/>
<source>Wi-Fi Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="410"/>
<source>Password</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="448"/>
<source>Frequency band</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="473"/>
<source>Net card</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="548"/>
<location filename="../mobilehotspotwidget.cpp" line="556"/>
<source>hotspot already open</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

Binary file not shown.

View File

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="zh_CN">
<context>
<name>MobileHotspot</name>
<message>
<location filename="../mobilehotspot.cpp" line="35"/>
<source>MobileHotspot</source>
<translation></translation>
</message>
<message>
<location filename="../mobilehotspot.cpp" line="101"/>
<source>mobilehotspot</source>
<translation></translation>
<extra-contents_path>/mobilehotspot/mobilehotspot</extra-contents_path>
</message>
<message>
<location filename="../mobilehotspot.cpp" line="103"/>
<source>mobilehotspot open</source>
<translation> </translation>
<extra-contents_path>/mobilehotspot/mobilehotspot open</extra-contents_path>
</message>
</context>
<context>
<name>MobileHotspotWidget</name>
<message>
<location filename="../mobilehotspotwidget.cpp" line="30"/>
<source>ukui control center</source>
<translation></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="33"/>
<source>ukui control center desktop message</source>
<translation></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="102"/>
<source>wirless switch is close or no wireless device</source>
<translation>线线</translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="106"/>
<source>start to close hotspot</source>
<translation></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="115"/>
<source>hotpots name or device is invalid</source>
<translation></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="119"/>
<source>can not create hotspot with password length less than eight!</source>
<translation></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="122"/>
<source>start to open hotspot </source>
<translation></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="155"/>
<source>Hotspot</source>
<translation></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="227"/>
<location filename="../mobilehotspotwidget.cpp" line="532"/>
<source>hotspot already close</source>
<translation></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="367"/>
<source>Open</source>
<translation></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="388"/>
<source>Wi-Fi Name</source>
<translation>Wi-Fi名称</translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="410"/>
<source>Password</source>
<translation></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="448"/>
<source>Frequency band</source>
<translation></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="473"/>
<source>Net card</source>
<translation></translation>
</message>
<message>
<location filename="../mobilehotspotwidget.cpp" line="548"/>
<location filename="../mobilehotspotwidget.cpp" line="556"/>
<source>hotspot already open</source>
<translation></translation>
</message>
</context>
</TS>

View File

@ -0,0 +1,70 @@
#include "addnetbtn.h"
#include <QEvent>
#include <QHBoxLayout>
#include <QLabel>
#include <QVariant>
#include <QPainter>
#include <QPainterPath>
#define RADIUS 6.0
AddNetBtn::AddNetBtn(QWidget *parent) : QPushButton(parent)
{
this->setObjectName("this");
this->setMinimumSize(QSize(580, 60));
this->setMaximumSize(QSize(16777215, 60));
this->setStyleSheet("QPushButton:!checked{background-color: palette(base)}");
this->setProperty("useButtonPalette", true);
QHBoxLayout *addLyt = new QHBoxLayout;
QLabel *iconLabel = new QLabel();
QLabel *textLabel = new QLabel(tr("Add WiredNetork"));
QIcon mAddIcon = QIcon::fromTheme("list-add-symbolic");
iconLabel->setPixmap(mAddIcon.pixmap(mAddIcon.actualSize(QSize(24, 24))));
iconLabel->setProperty("useIconHighlightEffect", true);
iconLabel->setProperty("iconHighlightEffectMode", 1);
addLyt->addStretch();
addLyt->addWidget(iconLabel);
addLyt->addWidget(textLabel);
addLyt->addStretch();
this->setLayout(addLyt);
}
AddNetBtn::~AddNetBtn()
{
}
void AddNetBtn::enterEvent(QEvent *event){
Q_EMIT enterWidget();
QPushButton::enterEvent(event);
}
void AddNetBtn::leaveEvent(QEvent *event){
Q_EMIT leaveWidget();
QPushButton::leaveEvent(event);
}
void AddNetBtn::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();
QPainterPath path;
path.addRoundedRect (rect, RADIUS, RADIUS);
QRect temp_rect(rect.left(), rect.top(), rect.width(), rect.height()/2);
path.addRect(temp_rect);
painter.drawPath(path);
QPushButton::paintEvent(event);
}

View File

@ -0,0 +1,27 @@
#ifndef ADDNETBTN_H
#define ADDNETBTN_H
#include <QObject>
#include <QWidget>
#include <QPushButton>
#include <QTranslator>
#include <QApplication>
class AddNetBtn : public QPushButton
{
Q_OBJECT
public:
AddNetBtn(QWidget *parent = nullptr);
~AddNetBtn();
protected:
virtual void leaveEvent(QEvent * event);
virtual void enterEvent(QEvent * event);
void paintEvent(QPaintEvent *event);
Q_SIGNALS:
void enterWidget();
void leaveWidget();
};
#endif // ADDNETBTN_H

View File

@ -0,0 +1,46 @@
#include "deviceframe.h"
#define LAYOUT_MARGINS 18,0,24,0
#define FRAME_HEIGHT 58
#define RADIUS 6.0
DeviceFrame::DeviceFrame(QString devName, QWidget *parent) : QFrame(parent)
{
this->setFrameShape(QFrame::Box);
this->setFixedHeight(FRAME_HEIGHT);
QHBoxLayout *deviceLayout = new QHBoxLayout(this);
deviceLayout->setContentsMargins(LAYOUT_MARGINS);
setLayout(deviceLayout);
deviceLabel = new QLabel(this);
dropDownLabel = new DrownLabel(devName, this);
deviceSwitch = new SwitchButton(this);
deviceLayout->addWidget(deviceLabel);
deviceLayout->addStretch();
deviceLayout->addWidget(dropDownLabel);
deviceLayout->addWidget(deviceSwitch);
}
DeviceFrame::~DeviceFrame()
{
}
void DeviceFrame::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();
QPainterPath path;
path.addRoundedRect (rect, RADIUS, RADIUS);
QRect temp_rect(rect.left(), rect.top() + rect.height()/2, rect.width(), rect.height()/2);
path.addRect(temp_rect);
painter.drawPath(path);
QFrame::paintEvent(event);
}

View File

@ -0,0 +1,33 @@
#ifndef DEVICEFRAME_H
#define DEVICEFRAME_H
#include <QObject>
#include <QWidget>
#include <QPushButton>
#include <QHBoxLayout>
#include <QLabel>
#include <QTimer>
#include <QDebug>
#include "switchbutton.h"
#include "../component/DrownLabel/drownlabel.h"
class DeviceFrame : public QFrame
{
public:
DeviceFrame(QString devName, QWidget *parent = nullptr);
~DeviceFrame();
public:
QLabel * deviceLabel = nullptr;
SwitchButton * deviceSwitch = nullptr;
DrownLabel *dropDownLabel = nullptr;
protected:
void paintEvent(QPaintEvent *event);
private:
bool isDropDown = false;
int frameSize;
};
#endif // DEVICEFRAME_H

View File

@ -0,0 +1,47 @@
#include "itemframe.h"
#include <QPainter>
#include <QPalette>
#define LAYOUT_MARGINS 0,0,0,0
#define MAIN_LAYOUT_MARGINS 0,0,0,0
ItemFrame::ItemFrame(QString devName, QWidget *parent) : QFrame(parent)
{
deviceLanLayout = new QVBoxLayout(this);
deviceLanLayout->setContentsMargins(MAIN_LAYOUT_MARGINS);
lanItemFrame = new QFrame(this);
lanItemFrame->setFrameShape(QFrame::Shape::NoFrame);
lanItemLayout = new QVBoxLayout(this);
lanItemLayout->setContentsMargins(LAYOUT_MARGINS);
lanItemLayout->setSpacing(1);
addLanWidget = new AddNetBtn(this);
deviceLanLayout->setSpacing(1);
setLayout(deviceLanLayout);
lanItemFrame->setLayout(lanItemLayout);
deviceFrame = new DeviceFrame(devName, this);
deviceLanLayout->addWidget(deviceFrame);
deviceLanLayout->addWidget(lanItemFrame);
deviceLanLayout->addWidget(addLanWidget);
//下拉按钮
connect(deviceFrame->dropDownLabel, &DrownLabel::labelClicked, this, &ItemFrame::onDrownLabelClicked);
}
ItemFrame::~ItemFrame()
{
}
void ItemFrame::onDrownLabelClicked()
{
if (!deviceFrame->dropDownLabel->isChecked) {
lanItemFrame->show();
deviceFrame->dropDownLabel->setDropDownStatus(true);
} else {
lanItemFrame->hide();
deviceFrame->dropDownLabel->setDropDownStatus(false);
}
}

View File

@ -0,0 +1,33 @@
#ifndef ITEMFRAME_H
#define ITEMFRAME_H
#include <QFrame>
#include <QVBoxLayout>
#include "deviceframe.h"
#include <addbtn.h>
#include "addnetbtn.h"
#include "lanitem.h"
class ItemFrame : public QFrame
{
Q_OBJECT
public:
ItemFrame(QString devName, QWidget *parent = nullptr);
~ItemFrame();
//单设备整体layout
QVBoxLayout * deviceLanLayout = nullptr;
//单设备名称+下拉按钮Frame+d单设备开关
DeviceFrame * deviceFrame = nullptr;
//单设备列表Frame
QFrame * lanItemFrame = nullptr;
//单设备列表layout
QVBoxLayout * lanItemLayout = nullptr;
//新建有线连接
AddNetBtn * addLanWidget = nullptr;
//单设备item列表 key:uuid
QMap<QString, LanItem *> itemMap;
private slots:
void onDrownLabelClicked();
};
#endif // ITEMFRAME_H

View File

@ -0,0 +1,81 @@
#include "lanitem.h"
#define FRAME_SPEED 150
#define LIMIT_TIME 60*1000
#define TOTAL_PAGE 8
#define THEME_QT_SCHEMA "org.ukui.style"
#define MODE_QT_KEY "style-name"
LanItem::LanItem(bool isAcitve, QWidget *parent)
: QPushButton(parent),isAcitve(isAcitve)
{
this->setMinimumSize(550, 58);
this->setProperty("useButtonPalette", true);
setStyleSheet("QPushButton:!checked{background-color: palette(base)}");
QHBoxLayout *mLanLyt = new QHBoxLayout(this);
mLanLyt->setContentsMargins(16,0,16,0);
mLanLyt->setSpacing(16);
iconLabel = new QLabel(this);
iconLabel->setProperty("useIconHighlightEffect", 0x2);
titileLabel = new FixLabel(this);
statusLabel = new QLabel(this);
statusLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
// statusLabel->setMinimumSize(36,36);
infoLabel = new InfoButton(this);
mLanLyt->addWidget(iconLabel);
mLanLyt->addWidget(titileLabel,Qt::AlignLeft);
mLanLyt->addStretch();
mLanLyt->addWidget(statusLabel);
mLanLyt->addWidget(infoLabel);
loadIcons.append(QIcon::fromTheme("ukui-loading-1-symbolic"));
loadIcons.append(QIcon::fromTheme("ukui-loading-2-symbolic"));
loadIcons.append(QIcon::fromTheme("ukui-loading-3-symbolic"));
loadIcons.append(QIcon::fromTheme("ukui-loading-4-symbolic"));
loadIcons.append(QIcon::fromTheme("ukui-loading-5-symbolic"));
loadIcons.append(QIcon::fromTheme("ukui-loading-6-symbolic"));
loadIcons.append(QIcon::fromTheme("ukui-loading-7-symbolic"));
waitTimer = new QTimer(this);
connect(waitTimer, &QTimer::timeout, this, &LanItem::updateIcon);
}
LanItem::~LanItem()
{
}
void LanItem::updateIcon()
{
if (currentIconIndex > 6) {
currentIconIndex = 0;
}
statusLabel->setPixmap(loadIcons.at(currentIconIndex).pixmap(16,16));
currentIconIndex ++;
}
void LanItem::startLoading()
{
waitTimer->start(FRAME_SPEED);
loading = true;
}
void LanItem::stopLoading(){
waitTimer->stop();
loading = false;
}
void LanItem::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.drawRect(rect);
QPushButton::paintEvent(event);
}

View File

@ -0,0 +1,51 @@
#ifndef LANITEM_H
#define LANITEM_H
#include <QWidget>
#include <QPushButton>
#include <QHBoxLayout>
#include <QLabel>
#include <QVariantMap>
#include <QTimer>
#include <QGSettings>
#include <QDebug>
#include <QImage>
#include <QPainter>
#include "fixlabel.h"
#include "infobutton.h"
class LanItem : public QPushButton
{
public:
LanItem(bool isAcitve, QWidget *parent = nullptr);
~LanItem();
public:
QLabel * iconLabel = nullptr;
InfoButton * infoLabel = nullptr;
FixLabel * titileLabel = nullptr;
QLabel * statusLabel = nullptr;
public:
void startLoading();
void stopLoading();
bool loading = false;
bool isAcitve = false;
QString uuid;
QString dbusPath;
protected:
void paintEvent(QPaintEvent *);
private:
QTimer *waitTimer = nullptr;
QGSettings *themeGsettings = nullptr;
QList<QIcon> loadIcons;
int currentIconIndex=0;
private slots:
void updateIcon();
};
#endif // LANITEM_H

View File

@ -0,0 +1,883 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2019 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 2 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "netconnect.h"
#include "ui_netconnect.h"
#include <QGSettings>
#include <QProcess>
#include <QTimer>
#include <QtDBus>
#include <QDir>
#include <QDebug>
#include <QtAlgorithms>
#define WIRED_TYPE 0
#define ITEMHEIGH 50
#define LAN_TYPE 0
#define CONTROL_CENTER_WIFI "org.ukui.control-center.wifi.switch"
const QString KLanSymbolic = "network-wired-connected-symbolic";
const QString NoNetSymbolic = "network-wired-disconnected-symbolic";
const QString WIRED_SWITCH = "wiredswitch";
const QByteArray GSETTINGS_SCHEMA = "org.ukui.kylin-nm.switch";
#define ACTIVATING 1
#define ACTIVATED 2
#define DEACTIVATING 3
#define DEACTIVATED 4
#define NO_MARGINS 0,0,0,0
#define TOP_MARGINS 0,8,0,0
#define MAIN_LAYOUT_MARGINS 0,0,0,8
#define SPACING 8
bool sortByVal(const QPair<QString, int> &l, const QPair<QString, int> &r) {
return (l.second < r.second);
}
void NetConnect::showDesktopNotify(const QString &message)
{
QDBusInterface iface("org.freedesktop.Notifications",
"/org/freedesktop/Notifications",
"org.freedesktop.Notifications",
QDBusConnection::sessionBus());
QList<QVariant> args;
args<<(tr("ukui control center"))
<<((unsigned int) 0)
<<QString("gnome-dev-ethernet")
<<tr("ukui control center desktop message") //显示的是什么类型的信息
<<message //显示的具体信息
<<QStringList()
<<QVariantMap()
<<(int)-1;
iface.callWithArgumentList(QDBus::AutoDetect,"Notify",args);
}
NetConnect::NetConnect() : mFirstLoad(true) {
QTranslator* translator = new QTranslator(this);
translator->load("/usr/share/kylin-nm/netconnect/" + QLocale::system().name());
QApplication::installTranslator(translator);
pluginName = tr("WiredConnect");
pluginType = NETWORK;
}
NetConnect::~NetConnect() {
if (!mFirstLoad) {
delete ui;
ui = nullptr;
delete m_interface;
delete m_switchGsettings;
}
}
QString NetConnect::plugini18nName() {
return pluginName;
}
int NetConnect::pluginTypes() {
return pluginType;
}
QWidget *NetConnect::pluginUi() {
if (mFirstLoad) {
mFirstLoad = false;
ui = new Ui::NetConnect;
pluginWidget = new QWidget;
pluginWidget->setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(pluginWidget);
qDBusRegisterMetaType<QVector<QStringList>>();
m_interface = new QDBusInterface("com.kylin.network",
"/com/kylin/network",
"com.kylin.network",
QDBusConnection::sessionBus());
if(!m_interface->isValid()) {
qWarning() << qPrintable(QDBusConnection::sessionBus().lastError().message());
}
initSearchText();
initComponent();
}
return pluginWidget;
}
const QString NetConnect::name() const {
return QStringLiteral("netconnect");
}
bool NetConnect::isEnable() const
{
return true;
}
bool NetConnect::isShowOnHomePage() const
{
return false;
}
QIcon NetConnect::icon() const
{
return QIcon();
}
QString NetConnect::translationPath() const
{
return "/usr/share/kylin-nm/netconnect/%1.ts";
}
void NetConnect::initSearchText() {
//~ contents_path /netconnect/Advanced settings"
ui->detailBtn->setText(tr("Advanced settings"));
ui->titleLabel->setText(tr("Wired Network"));
//~ contents_path /netconnect/open
ui->openLabel->setText(tr("open"));
}
bool NetConnect::eventFilter(QObject *w, QEvent *e) {
if (e->type() == QEvent::Enter) {
if (w->findChild<QWidget*>())
w->findChild<QWidget*>()->setStyleSheet("QWidget{background: palette(button);border-radius:4px;}");
} else if (e->type() == QEvent::Leave) {
if (w->findChild<QWidget*>())
w->findChild<QWidget*>()->setStyleSheet("QWidget{background: palette(base);border-radius:4px;}");
}
return QObject::eventFilter(w,e);
}
void NetConnect::initComponent() {
wiredSwitch = new SwitchButton(pluginWidget);
ui->openWIifLayout->addWidget(wiredSwitch);
ui->detailLayOut->setContentsMargins(MAIN_LAYOUT_MARGINS);
ui->verticalLayout_3->setContentsMargins(NO_MARGINS);
ui->availableLayout->setSpacing(SPACING);
ui->horizontalLayout->setContentsMargins(TOP_MARGINS);
connect(wiredSwitch, &SwitchButton::disabledClick, this, [=]() {
showDesktopNotify(tr("No ethernet device avaliable"));
});
if (QGSettings::isSchemaInstalled(GSETTINGS_SCHEMA)) {
m_switchGsettings = new QGSettings(GSETTINGS_SCHEMA);
connect(wiredSwitch, &SwitchButton::checkedChanged, this, [=] (bool checked) {
if (!m_interface->isValid()) {
return;
}
if (wiredSwitch->getDisabledFlag()) {
return;
}
qDebug() << "[NetConnect]call setWiredSwitchEnable" << checked << __LINE__;
m_interface->call(QStringLiteral("setWiredSwitchEnable"),checked);
qDebug() << "[NetConnect]call setWiredSwitchEnable Respond" << __LINE__;
});
setSwitchStatus();
connect(m_switchGsettings, &QGSettings::changed, this, [=] (const QString &key) {
if (key == WIRED_SWITCH) {
setSwitchStatus();
}
});
} else {
wiredSwitch->blockSignals(true);
wiredSwitch->setChecked(true);
wiredSwitch->blockSignals(false);
qDebug()<<"[Netconnect] org.ukui.kylin-nm.switch is not installed!";
}
getDeviceStatusMap(deviceStatusMap);
if (deviceStatusMap.isEmpty()) {
qDebug() << "[Netconnect] no device exist when init, set switch disable";
wiredSwitch->setDisabledFlag(true);
wiredSwitch->setChecked(false);
}
initNet();
if (!wiredSwitch->isChecked() || deviceStatusMap.isEmpty() || !m_interface->isValid()) {
hideLayout(ui->availableLayout);
}
// 有线网络断开或连接时刷新可用网络列表
connect(m_interface, SIGNAL(lanActiveConnectionStateChanged(QString, QString, int)), this, SLOT(onActiveConnectionChanged(QString, QString, int)), Qt::QueuedConnection);
//有线网络新增时添加网络
connect(m_interface, SIGNAL(lanAdd(QString, QStringList)), this, SLOT(onLanAdd(QString, QStringList)), Qt::QueuedConnection);
//删除有线网络
connect(m_interface, SIGNAL(lanRemove(QString)), this, SLOT(onLanRemove(QString)), Qt::QueuedConnection);
//更新有线网络
connect(m_interface, SIGNAL(lanUpdate(QString, QStringList)), this, SLOT(updateLanInfo(QString, QStringList)),Qt::QueuedConnection);
//网卡插拔处理
connect(m_interface, SIGNAL(deviceStatusChanged()), this, SLOT(onDeviceStatusChanged()),Qt::QueuedConnection);
//网卡name处理
connect(m_interface, SIGNAL(deviceNameChanged(QString, QString, int)), this, SLOT(onDeviceNameChanged(QString, QString, int)),Qt::QueuedConnection);
connect(ui->detailBtn, &QPushButton::clicked, this, [=](bool checked) {
Q_UNUSED(checked)
runExternalApp();
});
}
//获取网卡列表
void NetConnect::getDeviceStatusMap(QMap<QString, bool> &map)
{
if (!m_interface->isValid()) {
return;
}
qDebug() << "[NetConnect]call getDeviceListAndEnabled" << __LINE__;
QDBusMessage result = m_interface->call(QStringLiteral("getDeviceListAndEnabled"),0);
qDebug() << "[NetConnect]call getDeviceListAndEnabled Respond" << __LINE__;
if(result.type() == QDBusMessage::ErrorMessage)
{
qWarning() << "[NetConnect]getWiredDeviceList error:" << result.errorMessage();
return;
}
auto dbusArg = result.arguments().at(0).value<QDBusArgument>();
dbusArg >> map;
}
//lanUpdate
void NetConnect::updateLanInfo(QString deviceName, QStringList lanInfo)
{
//she bei gui shu bian hua && you xian ming cheng bian hua
QMap<QString, ItemFrame *>::iterator iter;
for (iter = deviceFrameMap.begin(); iter != deviceFrameMap.end(); iter++) {
if (deviceName.isEmpty()) {
//变为无指定网卡,所有列表都要添加
if (!iter.value()->itemMap.contains(lanInfo.at(1))) {
qDebug() << "[NetConnect]" << lanInfo.at(0) << " change to device none, add every list";
addOneLanFrame(iter.value(), iter.key(), lanInfo);
} else {
if (iter.value()->itemMap[lanInfo.at(1)]->titileLabel->text() != lanInfo.at(0)) {
qDebug() << "[NetConnect]" << iter.key()
<< iter.value()->itemMap[lanInfo.at(1)]->titileLabel->text() << "change to" << lanInfo.at(0);
iter.value()->itemMap[lanInfo.at(1)]->titileLabel->setText(lanInfo.at(0));
}
}
} else {
if (iter.key() != deviceName) {
qDebug() << "[NetConnect]" << lanInfo.at(0) << " not belongs to " << iter.key();
removeOneLanFrame(iter.value(), deviceName, lanInfo.at(1));
} else {
if (!iter.value()->itemMap.contains(lanInfo.at(1))) {
qDebug() << "[NetConnect]" << lanInfo.at(0) << " now belongs to " << deviceName;
addOneLanFrame(iter.value(), deviceName, lanInfo);
} else {
qDebug() << "[NetConnect]" << deviceName
<< iter.value()->itemMap[lanInfo.at(1)]->titileLabel->text() << "change to" << lanInfo.at(0);
if (iter.value()->itemMap[lanInfo.at(1)]->titileLabel->text() != lanInfo.at(0)) {
iter.value()->itemMap[lanInfo.at(1)]->titileLabel->setText(lanInfo.at(0));
}
}
}
}
}
}
//总开关
void NetConnect::setSwitchStatus()
{
if (QGSettings::isSchemaInstalled(GSETTINGS_SCHEMA)) {
bool status = m_switchGsettings->get(WIRED_SWITCH).toBool();
wiredSwitch->blockSignals(true);
wiredSwitch->setChecked(status);
wiredSwitch->blockSignals(false);
if (!status) {
hideLayout(ui->availableLayout);
} else {
showLayout(ui->availableLayout);
}
} else {
qDebug()<<"[netconnect] org.ukui.kylin-nm.switch is not installed!";
}
}
//总体隐藏
void NetConnect::hideLayout(QVBoxLayout * layout) {
for (int i = layout->layout()->count()-1; i >= 0; --i)
{
QLayoutItem *it = layout->layout()->itemAt(i);
ItemFrame *itemFrame = qobject_cast<ItemFrame *>(it->widget());
itemFrame->hide();
}
}
//总体显示
void NetConnect::showLayout(QVBoxLayout * layout) {
for (int i = layout->layout()->count()-1; i >= 0; --i)
{
QLayoutItem *it = layout->layout()->itemAt(i);
ItemFrame *itemFrame = qobject_cast<ItemFrame *>(it->widget());
itemFrame->show();
}
}
//初始化
void NetConnect::initNet()
{
//先构建每个设备的列表头
QStringList deviceList = deviceStatusMap.keys();
for (int i = 0; i < deviceList.size(); ++i) {
addDeviceFrame(deviceList.at(i));
}
//再填充每个设备的列表
for (int i = 0; i < deviceList.size(); ++i) {
initNetListFromDevice(deviceList.at(i));
}
}
void NetConnect::runExternalApp() {
QString cmd = "nm-connection-editor";
QProcess process(this);
process.startDetached(cmd);
}
//激活
void NetConnect::activeConnect(QString ssid, QString deviceName, int type) {
qDebug() << "[NetConnect]call activateConnect" << __LINE__;
m_interface->call(QStringLiteral("activateConnect"),type, deviceName, ssid);
qDebug() << "[NetConnect]call activateConnect respond" << __LINE__;
}
//断开
void NetConnect::deActiveConnect(QString ssid, QString deviceName, int type) {
qDebug() << "[NetConnect]call deActivateConnect" << __LINE__;
m_interface->call(QStringLiteral("deActivateConnect"),type, deviceName, ssid);
qDebug() << "[NetConnect]call deActivateConnect respond" << __LINE__;
}
//初始化设备列表 网卡标号问题?
void NetConnect::initNetListFromDevice(QString deviceName)
{
qDebug() << "[NetConnect]initNetListFromDevice " << deviceName;
if (!deviceFrameMap.contains(deviceName)) {
qDebug() << "[NetConnect]initNetListFromDevice " << deviceName << " not exist";
return;
}
if (!m_interface->isValid()) {
return;
}
qDebug() << "[NetConnect]call getWiredList" << __LINE__;
QDBusMessage result = m_interface->call(QStringLiteral("getWiredList"));
qDebug() << "[NetConnect]call getWiredList respond" << __LINE__;
if(result.type() == QDBusMessage::ErrorMessage)
{
qWarning() << "getWiredList error:" << result.errorMessage();
return;
}
auto dbusArg = result.arguments().at(0).value<QDBusArgument>();
QMap<QString, QVector<QStringList>> variantList;
dbusArg >> variantList;
if (variantList.size() == 0) {
qDebug() << "[NetConnect]initNetListFromDevice " << deviceName << " list empty";
return;
}
QMap<QString, QVector<QStringList>>::iterator iter;
for (iter = variantList.begin(); iter != variantList.end(); iter++) {
if (deviceName == iter.key()) {
QVector<QStringList> wlanListInfo = iter.value();
//处理列表 已连接
qDebug() << "[NetConnect]initNetListFromDevice " << deviceName << " acitved lan " << wlanListInfo.at(0);
addLanItem(deviceFrameMap[deviceName], deviceName, wlanListInfo.at(0), true);
//处理列表 未连接
for (int i = 1; i < wlanListInfo.length(); i++) {
qDebug() << "[NetConnect]initNetListFromDevice " << deviceName << " deacitved lan " << wlanListInfo.at(i);
addLanItem(deviceFrameMap[deviceName], deviceName, wlanListInfo.at(i), false);
}
}
}
return;
}
//初始化时添加一个项 不考虑顺序
void NetConnect::addLanItem(ItemFrame *frame, QString devName, QStringList infoList, bool isActived)
{
if (frame == nullptr) {
return;
}
if (infoList.size() == 1) {
return;
}
LanItem * lanItem = new LanItem(pluginWidget);
QString iconPath = KLanSymbolic;
if (isActived) {
lanItem->statusLabel->setText(tr("connected"));
} else {
lanItem->statusLabel->setText("");
}
QIcon searchIcon = QIcon::fromTheme(iconPath);
// if (iconPath != KLanSymbolic && iconPath != NoNetSymbolic) {
// lanItem->iconLabel->setProperty("useIconHighlightEffect", 0x10);
// }
lanItem->iconLabel->setPixmap(searchIcon.pixmap(searchIcon.actualSize(QSize(24, 24))));
lanItem->titileLabel->setText(infoList.at(0));
lanItem->uuid = infoList.at(1);
lanItem->dbusPath = infoList.at(2);
connect(lanItem->infoLabel, &InfoButton::clicked, this, [=]{
// open landetail page
if (!m_interface->isValid()) {
return;
}
qDebug() << "[NetConnect]call showPropertyWidget" << __LINE__;
m_interface->call(QStringLiteral("showPropertyWidget"), devName, infoList.at(1));
qDebug() << "[NetConnect]call showPropertyWidget respond" << __LINE__;
});
lanItem->isAcitve = isActived;
connect(lanItem, &QPushButton::clicked, this, [=] {
if (lanItem->isAcitve || lanItem->loading) {
deActiveConnect(lanItem->uuid, devName, WIRED_TYPE);
} else {
activeConnect(lanItem->uuid, devName, WIRED_TYPE);
}
});
//记录到deviceFrame的itemMap中
deviceFrameMap[devName]->itemMap.insert(infoList.at(1), lanItem);
qDebug()<<"insert " << infoList.at(1) << " to " << devName << " list";
frame->lanItemLayout->addWidget(lanItem);
}
//增加设备
void NetConnect::addDeviceFrame(QString devName)
{
qDebug() << "[NetConnect]addDeviceFrame " << devName;
qDebug() << "[NetConnect]call getDeviceListAndEnabled" << __LINE__;
QDBusMessage result = m_interface->call(QStringLiteral("getDeviceListAndEnabled"),0);
qDebug() << "[NetConnect]call getDeviceListAndEnabled Respond" << __LINE__;
if(result.type() == QDBusMessage::ErrorMessage)
{
qWarning() << "[NetConnect]getWiredDeviceList error:" << result.errorMessage();
return;
}
auto dbusArg = result.arguments().at(0).value<QDBusArgument>();
QMap<QString,bool> map;
dbusArg >> map;
bool enable = true;
if (map.contains(devName)) {
enable = map[devName];
}
ItemFrame *itemFrame = new ItemFrame(devName, pluginWidget);
ui->availableLayout->addWidget(itemFrame);
itemFrame->deviceFrame->deviceLabel->setText(tr("card")+/*QString("%1").arg(count)+*/""+devName);
itemFrame->deviceFrame->deviceSwitch->setChecked(enable);
if (enable) {
itemFrame->lanItemFrame->show();
itemFrame->deviceFrame->dropDownLabel->show();
} else {
itemFrame->lanItemFrame->hide();
itemFrame->deviceFrame->dropDownLabel->hide();
itemFrame->deviceFrame->dropDownLabel->setDropDownStatus(false);
}
deviceFrameMap.insert(devName, itemFrame);
qDebug() << "[NetConnect]deviceFrameMap insert" << devName;
connect(itemFrame->deviceFrame->deviceSwitch, &SwitchButton::checkedChanged, this, [=] (bool checked) {
qDebug() << "[NetConnect]call setDeviceEnable" << devName << checked << __LINE__;
m_interface->call(QStringLiteral("setDeviceEnable"), devName, checked);
qDebug() << "[NetConnect]call setDeviceEnable Respond" << __LINE__;
if (checked) {
qDebug() << "[NetConnect]set " << devName << "status" << true;
itemFrame->lanItemFrame->show();
itemFrame->deviceFrame->dropDownLabel->show();
itemFrame->deviceFrame->dropDownLabel->setDropDownStatus(true);
deviceStatusMap[devName] = true;
} else {
qDebug() << "[NetConnect]set " << devName << "status" << false;
itemFrame->lanItemFrame->hide();
itemFrame->deviceFrame->dropDownLabel->hide();
deviceStatusMap[devName] = false;
}
});
connect(itemFrame->addLanWidget, &AddNetBtn::clicked, this, [=](){
if (m_interface->isValid()) {
qDebug() << "[NetConnect]call showCreateWiredConnectWidget" << devName << __LINE__;
m_interface->call(QStringLiteral("showCreateWiredConnectWidget"), devName);
qDebug() << "[NetConnect]call setDeviceEnable Respond" << __LINE__;
}
});
}
//减少设备
void NetConnect::removeDeviceFrame(QString devName)
{
qDebug() << "[NetConnect]removeDeviceFrame " << devName;
if (deviceFrameMap.contains(devName)) {
ItemFrame *item = deviceFrameMap[devName];
if (item->lanItemFrame->layout() != NULL) {
QLayoutItem* layoutItem;
while ((layoutItem = item->lanItemFrame->layout()->takeAt(0)) != NULL) {
delete layoutItem->widget();
delete layoutItem;
layoutItem = nullptr;
}
item->itemMap.clear();
}
delete item;
item = nullptr;
deviceFrameMap.remove(devName);
qDebug() << "[NetConnect]deviceFrameMap remove" << devName;
}
}
//device add or remove=================================
void NetConnect::onDeviceStatusChanged()
{
qDebug()<<"[NetConnect]onDeviceStatusChanged";
QEventLoop eventloop;
QTimer::singleShot(300, &eventloop, SLOT(quit()));
eventloop.exec();
QStringList list;
QMap<QString, bool> map;
getDeviceStatusMap(map);
list = map.keys();
QStringList removeList;
QMap<QString, bool> addMap;
//remove的设备
for (int i = 0; i< deviceStatusMap.keys().size(); ++i) {
if (!list.contains(deviceStatusMap.keys().at(i))) {
qDebug() << "[NetConnect]onDeviceStatusChanged " << deviceStatusMap.keys().at(i) << "was removed";
removeList << deviceStatusMap.keys().at(i);
}
}
//add的设备
for (int i = 0; i< list.size(); ++i) {
if (!deviceStatusMap.keys().contains(list.at(i))) {
qDebug() << "[NetConnect]onDeviceStatusChanged " << list.at(i) << "was add, init status" << map[list.at(i)];
addMap.insert(list.at(i),map[list.at(i)]);
}
}
for (int i = 0; i < removeList.size(); ++i) {
removeDeviceFrame(removeList.at(i));
}
QStringList addList = addMap.keys();
for (int i = 0; i < addList.size(); ++i) {
qDebug() << "add a device " << addList.at(i) << "status" << map[addList.at(i)];
addDeviceFrame(addList.at(i));
initNetListFromDevice(addList.at(i));
}
deviceStatusMap = map;
if (deviceStatusMap.isEmpty()) {
wiredSwitch->setDisabledFlag(true);
wiredSwitch->setChecked(false);
} else {
wiredSwitch->setDisabledFlag(false);
setSwitchStatus();
}
}
void NetConnect::onDeviceNameChanged(QString oldName, QString newName, int type)
{
if (WIRED_TYPE != type || !deviceFrameMap.contains(oldName) || !deviceStatusMap.contains(oldName)) {
qDebug() << "[NetConnect]onDeviceNameChanged no such device " << oldName;
return;
}
if (deviceFrameMap.contains(newName) && deviceStatusMap.contains(newName)) {
qDebug() << "[NetConnect]onDeviceNameChanged already has device " << newName;
return;
}
qDebug() << "[NetConnect]onDeviceNameChanged " << oldName << "change to" << newName;
//shan chu chong jian
removeDeviceFrame(oldName);
removeDeviceFrame(newName);
getDeviceStatusMap(deviceStatusMap);
if (deviceStatusMap.contains(newName)) {
addDeviceFrame(newName);
initNetListFromDevice(newName);
}
}
//wifi add===============================================================
void NetConnect::onLanAdd(QString deviceName, QStringList lanInfo)
{
qDebug()<<"[NetConnect]onLanAdd "<< deviceName << " " << lanInfo;
if (!deviceName.isEmpty() && !deviceStatusMap.contains(deviceName)) {
return;
}
QMap<QString, ItemFrame *>::iterator iter;
for (iter = deviceFrameMap.begin(); iter != deviceFrameMap.end(); iter++) {
if (deviceName.isEmpty()) {
qDebug() << "[NetConnect]onLanAdd every list" << iter.key();
addOneLanFrame(iter.value(), iter.key(), lanInfo);
} else if (deviceName == iter.key()) {
qDebug() << "[NetConnect]onLanAdd "<< deviceName;
addOneLanFrame(iter.value(), deviceName, lanInfo);
break;
}
}
}
//wifi remove =============================================================
void NetConnect::onLanRemove(QString lanPath)
{
//开关已关闭 忽略
// if (!wifiSwtch->isChecked()) {
// qDebug() << "[NetConnect]recieve network remove,but wireless switch is off";
// return;
// }
qDebug()<<"[NetConnect]lan remove " << "dbus path:" << lanPath;
QMap<QString, ItemFrame *>::iterator iter;
for (iter = deviceFrameMap.begin(); iter != deviceFrameMap.end(); iter++) {
QMap<QString, LanItem *>::iterator itemIter;
for (itemIter = iter.value()->itemMap.begin(); itemIter != iter.value()->itemMap.end(); itemIter++) {
if (itemIter.value()->dbusPath == lanPath) {
qDebug()<<"[NetConnect]lan remove " << lanPath << " find in " << itemIter.value()->titileLabel->text();
QString key = itemIter.key();
iter.value()->lanItemLayout->removeWidget(itemIter.value());
delete itemIter.value();
iter.value()->itemMap.remove(key);
break;
}
}
}
}
//增加一项
void NetConnect::addOneLanFrame(ItemFrame *frame, QString deviceName, QStringList infoList)
{
if (nullptr == frame) {
return;
}
if (frame->itemMap.contains(infoList.at(1))) {
qDebug() << "[NetConnect]Already exist a lan " << infoList.at(1) << " in " << deviceName;
return;
}
qDebug() << "[NetConnect]addOneLanFrame" << deviceName << infoList.at(0);
QString connName = infoList.at(0);
QString connUuid = infoList.at(1);
QString connDbusPath = infoList.at(2);
LanItem * lanItem = new LanItem(pluginWidget);
QString iconPath;
iconPath = KLanSymbolic;
lanItem->statusLabel->setText("");
QIcon searchIcon = QIcon::fromTheme(iconPath);
// if (iconPath != KLanSymbolic && iconPath != NoNetSymbolic) {
// lanItem->iconLabel->setProperty("useIconHighlightEffect", 0x10);
// }
lanItem->iconLabel->setPixmap(searchIcon.pixmap(searchIcon.actualSize(QSize(24, 24))));
lanItem->titileLabel->setText(connName);
lanItem->uuid = connUuid;
lanItem->dbusPath = connDbusPath;
connect(lanItem->infoLabel, &InfoButton::clicked, this, [=]{
// open landetail page
if (!m_interface->isValid()) {
return;
}
qDebug() << "[NetConnect]call showPropertyWidget" << deviceName << connUuid << __LINE__;
m_interface->call(QStringLiteral("showPropertyWidget"), deviceName, connUuid);
qDebug() << "[NetConnect]call showPropertyWidget respond" << __LINE__;
});
lanItem->isAcitve = false;
connect(lanItem, &QPushButton::clicked, this, [=] {
if (lanItem->isAcitve || lanItem->loading) {
deActiveConnect(lanItem->uuid, deviceName, WIRED_TYPE);
} else {
activeConnect(lanItem->uuid, deviceName, WIRED_TYPE);
}
});
//记录到deviceFrame的itemMap中
deviceFrameMap[deviceName]->itemMap.insert(connUuid, lanItem);
int index = getInsertPos(connName, deviceName);
qDebug()<<"[NetConnect]addOneLanFrame " << connName << " to " << deviceName << " list at pos:" << index;
frame->lanItemLayout->insertWidget(index, lanItem);
}
void NetConnect::removeOneLanFrame(ItemFrame *frame, QString deviceName, QString uuid)
{
if (nullptr == frame) {
return;
}
if (!frame->itemMap.contains(uuid)) {
qDebug() << "[NetConnect]not exist a lan " << uuid << " in " << deviceName;
return;
}
qDebug()<<"[NetConnect]removeOneLanFrame " << uuid << " find in " << deviceName;
frame->lanItemLayout->removeWidget(frame->itemMap[uuid]);
delete frame->itemMap[uuid];
frame->itemMap.remove(uuid);
}
//activeconnect status change
void NetConnect::onActiveConnectionChanged(QString deviceName, QString uuid, int status)
{
if (uuid.isEmpty()) {
qDebug() << "[NetConnect]onActiveConnectionChanged but uuid is empty";
return;
}
qDebug() << "[NetConnect]onActiveConnectionChanged " << deviceName << uuid << status;
LanItem * item= nullptr;
if (deviceName.isEmpty()) {
if (status != DEACTIVATED) {
return;
}
//断开时 设备为空 说明此有线未指定设备 添加到所有列表中
QStringList infoList;
QMap<QString, ItemFrame *>::iterator iters;
for (iters = deviceFrameMap.begin(); iters != deviceFrameMap.end(); iters++) {
if (iters.value()->itemMap.contains(uuid)) {
item = iters.value()->itemMap[uuid];
infoList << item->titileLabel->text() << item->uuid << item->dbusPath;
//为断开则重新插入
int index = getInsertPos(item->titileLabel->text(), iters.key());
qDebug() << "[NetConnect]reinsert" << item->titileLabel->text() << "pos" << index << "in" << iters.key() << "because status changes to deactive";
deviceFrameMap[iters.key()]->lanItemLayout->removeWidget(item);
deviceFrameMap[iters.key()]->lanItemLayout->insertWidget(index,item);
itemActiveConnectionStatusChanged(item, status);
}
}
//添加到所有列表中
if (!infoList.isEmpty()) {
QMap<QString, ItemFrame *>::iterator iter;
for (iter = deviceFrameMap.begin(); iter != deviceFrameMap.end(); iter++) {
if (!iter.value()->itemMap.contains(uuid)) {
addOneLanFrame(iter.value(), iter.key(), infoList);
}
}
}
} else {
if (deviceFrameMap.contains(deviceName)) {
if (deviceFrameMap[deviceName]->itemMap.contains(uuid)) {
item = deviceFrameMap[deviceName]->itemMap[uuid];
if (status == ACTIVATED) {
//为已连接则放到第一个
deviceFrameMap[deviceName]->lanItemLayout->removeWidget(item);
deviceFrameMap[deviceName]->lanItemLayout->insertWidget(0,item);
} else if (status == DEACTIVATED) {
//为断开则重新插入
int index = getInsertPos(item->titileLabel->text(), deviceName);
qDebug() << "[NetConnect]reinsert" << item->titileLabel->text() << "pos" << index << "in" << deviceName << "because status changes to deactive";
deviceFrameMap[deviceName]->lanItemLayout->removeWidget(item);
deviceFrameMap[deviceName]->lanItemLayout->insertWidget(index,item);
}
itemActiveConnectionStatusChanged(item, status);
}
} else {
if (status == ACTIVATED || status == DEACTIVATED) {
//虚拟网卡处理
QMap<QString, ItemFrame *>::iterator iters;
for (iters = deviceFrameMap.begin(); iters != deviceFrameMap.end(); iters++) {
if (iters.value()->itemMap.contains(uuid)) {
removeOneLanFrame(iters.value(), iters.key(), uuid);
}
}
}
}
}
}
void NetConnect::itemActiveConnectionStatusChanged(LanItem *item, int status)
{
// QString iconPath = NoNetSymbolic;
if (status == ACTIVATING) {
item->startLoading();
} else if (status == ACTIVATED) {
item->stopLoading();
// iconPath = KLanSymbolic;
item->statusLabel->clear();
item->statusLabel->setMinimumSize(36,36);
item->statusLabel->setMaximumSize(16777215,16777215);
item->statusLabel->setText(tr("connected"));
item->isAcitve = true;
} else if (status == DEACTIVATING) {
item->startLoading();
} else {
item->stopLoading();
item->statusLabel->setMinimumSize(36,36);
item->statusLabel->setMaximumSize(16777215,16777215);
item->statusLabel->clear();
item->isAcitve = false;
}
// QIcon searchIcon = QIcon::fromTheme(iconPath);
// item->iconLabel->setPixmap(searchIcon.pixmap(searchIcon.actualSize(QSize(24, 24))));
}
int NetConnect::getInsertPos(QString connName, QString deviceName)
{
qDebug() << "[NetConnect]getInsertPos" << connName << deviceName;
int index = 0;
if(!m_interface->isValid()) {
index = 0;
} else {
qDebug() << "[NetConnect]call getWiredList" << __LINE__;
QDBusMessage result = m_interface->call(QStringLiteral("getWiredList"));
qDebug() << "[NetConnect]call getWiredList respond" << __LINE__;
if(result.type() == QDBusMessage::ErrorMessage)
{
qWarning() << "getWiredList error:" << result.errorMessage();
return 0;
}
auto dbusArg = result.arguments().at(0).value<QDBusArgument>();
QMap<QString, QVector<QStringList>> variantList;
dbusArg >> variantList;
if (!variantList.contains(deviceName)) {
qDebug() << "[NetConnect] getInsertPos but " << deviceName << "not exist";
return 0;
}
for (int i = 0; i < variantList[deviceName].size(); ++i ) {
if (variantList[deviceName].at(i).at(0) == connName) {
qDebug() << "pos in kylin-nm is " << i;
index = i;
break;
}
}
if (variantList[deviceName].at(0).size() == 1) {
index--;
}
}
return index;
}

View File

@ -0,0 +1,156 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2019 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 2 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef NETCONNECT_H
#define NETCONNECT_H
#include <QObject>
#include <QtPlugin>
#include <QTranslator>
#include <QApplication>
#include <QNetworkInterface>
#include <QtNetwork/QNetworkConfigurationManager>
#include <QtNetwork/QtNetwork>
#include <QTimer>
#include <QStringList>
#include <QString>
#include <QGSettings>
#include <QListWidget>
#include <QListWidgetItem>
#include <QMap>
#include <QPropertyAnimation>
#include <QPoint>
#include <QDBusMessage>
#include <QDBusObjectPath>
#include <QDBusInterface>
#include <QDBusReply>
#include "interface.h"
#include "addbtn.h"
#include "fixlabel.h"
#include "switchbutton.h"
#include "hoverbtn.h"
#include "lanitem.h"
#include "deviceframe.h"
#include "itemframe.h"
enum {
DISCONNECTED,
NOINTERNET,
CONNECTED
};
namespace Ui {
class NetConnect;
}
class NetConnect : public QObject, CommonInterface
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.ukcc.CommonInterface")
Q_INTERFACES(CommonInterface)
public:
NetConnect();
~NetConnect();
QString plugini18nName() Q_DECL_OVERRIDE;
int pluginTypes() Q_DECL_OVERRIDE;
QWidget * pluginUi() Q_DECL_OVERRIDE;
const QString name() const Q_DECL_OVERRIDE;
bool isShowOnHomePage() const Q_DECL_OVERRIDE;
QIcon icon() const Q_DECL_OVERRIDE;
bool isEnable() const Q_DECL_OVERRIDE;
QString translationPath() const Q_DECL_OVERRIDE;
private:
void initSearchText();
void initComponent();
void runExternalApp();
void showDesktopNotify(const QString &message);
//开关相关
void setSwitchStatus();
void hideLayout(QVBoxLayout * layout);
void showLayout(QVBoxLayout * layout);
int getInsertPos(QString connName, QString deviceName);
void deleteOneLan(QString ssid);
void activeConnect(QString ssid, QString deviceName, int type);
void deActiveConnect(QString ssid, QString deviceName, int type);
//获取设备列表
void getDeviceStatusMap(QMap<QString, bool> &map);
void initNet();
void initNetListFromDevice(QString deviceName);
//处理列表增加
void addLanItem(ItemFrame *frame, QString devName, QStringList infoList, bool isActived);
//增加设备
void addDeviceFrame(QString devName);
//减少设备
void removeDeviceFrame(QString devName);
//增加一项
void addOneLanFrame(ItemFrame *frame, QString devName, QStringList infoList);
//减少一项
void removeOneLanFrame(ItemFrame *frame, QString deviceName, QString uuid);
//单个lan连接状态变化
void itemActiveConnectionStatusChanged(LanItem *item, int status);
protected:
bool eventFilter(QObject *w,QEvent *e);
private:
Ui::NetConnect *ui;
QString pluginName;
int pluginType;
QWidget *pluginWidget;
QDBusInterface *m_interface = nullptr;
SwitchButton *wiredSwitch;
bool mFirstLoad;
QGSettings *m_switchGsettings;
QMap<QString, bool> deviceStatusMap;
QMap<QString, ItemFrame *> deviceFrameMap;
private slots:
void updateLanInfo(QString deviceName, QStringList lanInfo);
void onLanAdd(QString deviceName, QStringList lanInfo);
void onLanRemove(QString dbusPath);
void onActiveConnectionChanged(QString deviceName, QString uuid, int status);
void onDeviceStatusChanged();
void onDeviceNameChanged(QString, QString, int);
};
Q_DECLARE_METATYPE(QList<QDBusObjectPath>);
#endif // NETCONNECT_H

View File

@ -0,0 +1,53 @@
QT += widgets network dbus gui core
TEMPLATE = lib
CONFIG += plugin
include(../component/drownlabel.pri)
TARGET = $$qtLibraryTarget(netconnect)
DESTDIR = ../..
target.path = $$[QT_INSTALL_LIBS]/ukui-control-center
trans.files = translations/*
trans.path = /usr/share/kylin-nm/netconnect/
INCLUDEPATH += \
$$PROJECT_COMPONENTSOURCE \
$$PROJECT_ROOTDIR \
/usr/include/ukcc/interface \
/usr/include/ukcc/widgets
LIBS += -L$$[QT_INSTALL_LIBS] -lgsettings-qt -lukcc
CONFIG += c++11 \
link_pkgconfig \
PKGCONFIG += gsettings-qt \
#DEFINES += QT_DEPRECATED_WARNINGS
SOURCES += \
addnetbtn.cpp \
deviceframe.cpp \
# drownlabel.cpp \
itemframe.cpp \
lanitem.cpp \
netconnect.cpp
HEADERS += \
addnetbtn.h \
deviceframe.h \
# drownlabel.h \
itemframe.h \
lanitem.h \
netconnect.h
FORMS += \
netconnect.ui
INSTALLS += target \
trans
TRANSLATIONS += \
translations/zh_CN.ts \
translations/tr.ts \
translations/bo.ts

View File

@ -0,0 +1,244 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>NetConnect</class>
<widget class="QWidget" name="NetConnect">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>885</width>
<height>700</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="windowTitle">
<string notr="true">NetConnect</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="TitleLabel" name="titleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Wired Network</string>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="detailLayOut">
<property name="spacing">
<number>1</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<item>
<widget class="QFrame" name="openWifiFrame">
<property name="minimumSize">
<size>
<width>0</width>
<height>60</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>50</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="leftMargin">
<number>18</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="openWIifLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="rightMargin">
<number>8</number>
</property>
<item>
<widget class="QLabel" name="openLabel">
<property name="minimumSize">
<size>
<width>118</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>open</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>523</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>1</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="availableLayout">
<property name="spacing">
<number>1</number>
</property>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_4"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="detailBtn">
<property name="minimumSize">
<size>
<width>120</width>
<height>36</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>36</height>
</size>
</property>
<property name="text">
<string>Advanced settings</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>TitleLabel</class>
<extends>QLabel</extends>
<header>titlelabel.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1 @@
<クd<>箆!ソ`。スン

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>AddNetBtn</name>
<message>
<location filename="../addnetbtn.cpp" line="22"/>
<source>Add WiredNetork</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>NetConnect</name>
<message>
<location filename="../netconnect.ui" line="50"/>
<location filename="../netconnect.cpp" line="152"/>
<source>Wired Network</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../netconnect.ui" line="112"/>
<location filename="../netconnect.cpp" line="154"/>
<source>open</source>
<translation type="unfinished"></translation>
<extra-contents_path>/netconnect/open</extra-contents_path>
</message>
<message>
<location filename="../netconnect.ui" line="198"/>
<location filename="../netconnect.cpp" line="151"/>
<source>Advanced settings</source>
<translation type="unfinished"></translation>
<extra-contents_path>/netconnect/Advanced settings&quot;</extra-contents_path>
</message>
<message>
<location filename="../netconnect.cpp" line="63"/>
<source>ukui control center</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../netconnect.cpp" line="66"/>
<source>ukui control center desktop message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../netconnect.cpp" line="80"/>
<source>WiredConnect</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../netconnect.cpp" line="177"/>
<source>No ethernet device avaliable</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../netconnect.cpp" line="426"/>
<location filename="../netconnect.cpp" line="833"/>
<source>connected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../netconnect.cpp" line="490"/>
<source>card</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -0,0 +1 @@
<クd<>箆!ソ`。スン

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>AddNetBtn</name>
<message>
<location filename="../addnetbtn.cpp" line="22"/>
<source>Add WiredNetork</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>NetConnect</name>
<message>
<location filename="../netconnect.ui" line="50"/>
<location filename="../netconnect.cpp" line="152"/>
<source>Wired Network</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../netconnect.ui" line="112"/>
<location filename="../netconnect.cpp" line="154"/>
<source>open</source>
<translation type="unfinished"></translation>
<extra-contents_path>/netconnect/open</extra-contents_path>
</message>
<message>
<location filename="../netconnect.ui" line="198"/>
<location filename="../netconnect.cpp" line="151"/>
<source>Advanced settings</source>
<translation type="unfinished"></translation>
<extra-contents_path>/netconnect/Advanced settings&quot;</extra-contents_path>
</message>
<message>
<location filename="../netconnect.cpp" line="63"/>
<source>ukui control center</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../netconnect.cpp" line="66"/>
<source>ukui control center desktop message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../netconnect.cpp" line="80"/>
<source>WiredConnect</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../netconnect.cpp" line="177"/>
<source>No ethernet device avaliable</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../netconnect.cpp" line="426"/>
<location filename="../netconnect.cpp" line="833"/>
<source>connected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../netconnect.cpp" line="490"/>
<source>card</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

Binary file not shown.

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="zh_CN">
<context>
<name>AddNetBtn</name>
<message>
<location filename="../addnetbtn.cpp" line="22"/>
<source>Add WiredNetork</source>
<translation>线</translation>
</message>
</context>
<context>
<name>NetConnect</name>
<message>
<location filename="../netconnect.ui" line="50"/>
<location filename="../netconnect.cpp" line="152"/>
<source>Wired Network</source>
<translation>线</translation>
</message>
<message>
<location filename="../netconnect.ui" line="112"/>
<location filename="../netconnect.cpp" line="154"/>
<source>open</source>
<translation></translation>
<extra-contents_path>/netconnect/open</extra-contents_path>
</message>
<message>
<location filename="../netconnect.ui" line="198"/>
<location filename="../netconnect.cpp" line="151"/>
<source>Advanced settings</source>
<translation></translation>
<extra-contents_path>/netconnect/Advanced settings&quot;</extra-contents_path>
</message>
<message>
<location filename="../netconnect.cpp" line="63"/>
<source>ukui control center</source>
<translation></translation>
</message>
<message>
<location filename="../netconnect.cpp" line="66"/>
<source>ukui control center desktop message</source>
<translation></translation>
</message>
<message>
<location filename="../netconnect.cpp" line="80"/>
<source>WiredConnect</source>
<translation>线</translation>
</message>
<message>
<location filename="../netconnect.cpp" line="177"/>
<source>No ethernet device avaliable</source>
<translation>线</translation>
</message>
<message>
<location filename="../netconnect.cpp" line="426"/>
<location filename="../netconnect.cpp" line="833"/>
<source>connected</source>
<translation></translation>
</message>
<message>
<location filename="../netconnect.cpp" line="490"/>
<source>card</source>
<translation></translation>
</message>
</context>
</TS>

5
plugins/plugin.pro Normal file
View File

@ -0,0 +1,5 @@
TEMPLATE = subdirs
SUBDIRS = \
netconnect \
wlanconnect \
mobilehotspot

View File

@ -0,0 +1,48 @@
#include "deviceframe.h"
#include <QPainter>
#define LAYOUT_MARGINS 18,0,8,0
#define FRAME_HEIGHT 58
#define LAYOUT_SPACING 16
#define RADIUS 6.0
DeviceFrame::DeviceFrame(QString devName, QWidget *parent) : QFrame(parent)
{
this->setFrameShape(QFrame::Box);
this->setFixedHeight(FRAME_HEIGHT);
QHBoxLayout *deviceLayout = new QHBoxLayout(this);
deviceLayout->setContentsMargins(LAYOUT_MARGINS);
setLayout(deviceLayout);
deviceLayout->setSpacing(LAYOUT_SPACING);
deviceLabel = new QLabel(this);
dropDownLabel = new DrownLabel(devName, this);
deviceLayout->addWidget(deviceLabel);
deviceLayout->addStretch();
deviceLayout->addWidget(dropDownLabel);
}
DeviceFrame::~DeviceFrame()
{
}
void DeviceFrame::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();
QPainterPath path;
path.addRoundedRect (rect, RADIUS, RADIUS);
QRect temp_rect(rect.left(), rect.top() + rect.height()/2, rect.width(), rect.height()/2);
path.addRect(temp_rect);
painter.drawPath(path);
QFrame::paintEvent(event);
}

View File

@ -0,0 +1,30 @@
#ifndef DEVICEFRAME_H
#define DEVICEFRAME_H
#include <QObject>
#include <QWidget>
#include <QPushButton>
#include <QHBoxLayout>
#include <QLabel>
#include <QDebug>
#include "../component/DrownLabel/drownlabel.h"
class DeviceFrame : public QFrame
{
public:
DeviceFrame(QString devName, QWidget *parent = nullptr);
~DeviceFrame();
public:
//仅设备名称+下拉label
QLabel * deviceLabel = nullptr;
DrownLabel *dropDownLabel = nullptr;
protected:
void paintEvent(QPaintEvent *event);
private:
int frameSize;
};
#endif // DEVICEFRAME_H

View File

@ -0,0 +1,61 @@
#include "itemframe.h"
#include <QPainter>
#define LAYOUT_MARGINS 0,0,0,0
#define MAIN_LAYOUT_MARGINS 0,0,0,0
ItemFrame::ItemFrame(QString devName, QWidget *parent)
{
deviceLanLayout = new QVBoxLayout(this);
deviceLanLayout->setContentsMargins(MAIN_LAYOUT_MARGINS);
lanItemFrame = new QFrame(this);
lanItemFrame->setFrameShape(QFrame::Shape::NoFrame);
lanItemFrame->setContentsMargins(LAYOUT_MARGINS);
lanItemLayout = new QVBoxLayout(this);
lanItemLayout->setContentsMargins(LAYOUT_MARGINS);
lanItemLayout->setSpacing(1);
deviceLanLayout->setSpacing(1);
setLayout(deviceLanLayout);
lanItemFrame->setLayout(lanItemLayout);
deviceFrame = new DeviceFrame(devName, this);
deviceLanLayout->addWidget(deviceFrame);
deviceLanLayout->addWidget(lanItemFrame);
//下拉按钮
connect(deviceFrame->dropDownLabel, &DrownLabel::labelClicked, this, &ItemFrame::onDrownLabelClicked);
}
ItemFrame::~ItemFrame()
{
}
void ItemFrame::onDrownLabelClicked()
{
if (!deviceFrame->dropDownLabel->isChecked) {
lanItemFrame->show();
deviceFrame->dropDownLabel->setDropDownStatus(true);
} else {
lanItemFrame->hide();
deviceFrame->dropDownLabel->setDropDownStatus(false);
}
}
void ItemFrame::filletStyleChange()
{
if (lanItemLayout->isEmpty()) {
return;
}
for (int i = 0; i < lanItemLayout->count(); ++i) {
QLayoutItem *it = lanItemLayout->itemAt(i);
WlanItem *itemFrame = (WlanItem*)(it->widget());
if (i != lanItemLayout->count()-1) {
itemFrame->setHalfFillet(false);
} else {
itemFrame->setHalfFillet(true);
}
}
}

View File

@ -0,0 +1,33 @@
#ifndef ITEMFRAME_H
#define ITEMFRAME_H
#include <QFrame>
#include <QVBoxLayout>
#include "deviceframe.h"
#include "wlanitem.h"
class ItemFrame : public QFrame
{
Q_OBJECT
public:
ItemFrame(QString devName, QWidget *parent = nullptr);
~ItemFrame();
//单设备整体layout
QVBoxLayout * deviceLanLayout = nullptr;
//单设备名称+下拉按钮Frame
DeviceFrame * deviceFrame = nullptr;
//单设备列表Frame
QFrame * lanItemFrame = nullptr;
//单设备列表layout
QVBoxLayout * lanItemLayout = nullptr;
//单设备item列表
QMap<QString, WlanItem *> itemMap;
//已激活uuid
QString uuid = "";
void filletStyleChange();
private slots:
void onDrownLabelClicked();
};
#endif // ITEMFRAME_H

View File

@ -0,0 +1 @@
<クd<>箆!ソ`。スン

View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>WlanConnect</name>
<message>
<location filename="../wlanconnect.ui" line="14"/>
<location filename="../wlanconnect.cpp" line="97"/>
<source>WlanConnect</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../wlanconnect.ui" line="35"/>
<location filename="../wlanconnect.cpp" line="168"/>
<source>WLAN</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../wlanconnect.ui" line="94"/>
<location filename="../wlanconnect.cpp" line="170"/>
<source>open</source>
<translation type="unfinished"></translation>
<extra-contents_path>/wlanconnect/open</extra-contents_path>
</message>
<message>
<location filename="../wlanconnect.ui" line="147"/>
<location filename="../wlanconnect.cpp" line="167"/>
<source>Advanced settings</source>
<translation type="unfinished"></translation>
<extra-contents_path>/wlanconnect/Advanced settings&quot;</extra-contents_path>
</message>
<message>
<location filename="../wlanconnect.cpp" line="80"/>
<source>ukui control center</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../wlanconnect.cpp" line="83"/>
<source>ukui control center desktop message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../wlanconnect.cpp" line="192"/>
<source>No wireless network card detected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../wlanconnect.cpp" line="330"/>
<location filename="../wlanconnect.cpp" line="933"/>
<location filename="../wlanconnect.cpp" line="995"/>
<source>connected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../wlanconnect.cpp" line="879"/>
<source>card</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -0,0 +1 @@
<クd<>箆!ソ`。スン

View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>WlanConnect</name>
<message>
<location filename="../wlanconnect.ui" line="14"/>
<location filename="../wlanconnect.cpp" line="97"/>
<source>WlanConnect</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../wlanconnect.ui" line="35"/>
<location filename="../wlanconnect.cpp" line="168"/>
<source>WLAN</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../wlanconnect.ui" line="94"/>
<location filename="../wlanconnect.cpp" line="170"/>
<source>open</source>
<translation type="unfinished"></translation>
<extra-contents_path>/wlanconnect/open</extra-contents_path>
</message>
<message>
<location filename="../wlanconnect.ui" line="147"/>
<location filename="../wlanconnect.cpp" line="167"/>
<source>Advanced settings</source>
<translation type="unfinished"></translation>
<extra-contents_path>/wlanconnect/Advanced settings&quot;</extra-contents_path>
</message>
<message>
<location filename="../wlanconnect.cpp" line="80"/>
<source>ukui control center</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../wlanconnect.cpp" line="83"/>
<source>ukui control center desktop message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../wlanconnect.cpp" line="192"/>
<source>No wireless network card detected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../wlanconnect.cpp" line="330"/>
<location filename="../wlanconnect.cpp" line="933"/>
<location filename="../wlanconnect.cpp" line="995"/>
<source>connected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../wlanconnect.cpp" line="879"/>
<source>card</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

Binary file not shown.

View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="zh_CN">
<context>
<name>WlanConnect</name>
<message>
<location filename="../wlanconnect.ui" line="14"/>
<location filename="../wlanconnect.cpp" line="97"/>
<source>WlanConnect</source>
<translation>线</translation>
</message>
<message>
<location filename="../wlanconnect.ui" line="35"/>
<location filename="../wlanconnect.cpp" line="168"/>
<source>WLAN</source>
<translation>线</translation>
</message>
<message>
<location filename="../wlanconnect.ui" line="94"/>
<location filename="../wlanconnect.cpp" line="170"/>
<source>open</source>
<translation></translation>
<extra-contents_path>/wlanconnect/open</extra-contents_path>
</message>
<message>
<location filename="../wlanconnect.ui" line="147"/>
<location filename="../wlanconnect.cpp" line="167"/>
<source>Advanced settings</source>
<translation></translation>
<extra-contents_path>/wlanconnect/Advanced settings&quot;</extra-contents_path>
</message>
<message>
<location filename="../wlanconnect.cpp" line="80"/>
<source>ukui control center</source>
<translation></translation>
</message>
<message>
<location filename="../wlanconnect.cpp" line="83"/>
<source>ukui control center desktop message</source>
<translation></translation>
</message>
<message>
<location filename="../wlanconnect.cpp" line="192"/>
<source>No wireless network card detected</source>
<translation>线</translation>
</message>
<message>
<location filename="../wlanconnect.cpp" line="330"/>
<location filename="../wlanconnect.cpp" line="933"/>
<location filename="../wlanconnect.cpp" line="995"/>
<source>connected</source>
<translation></translation>
</message>
<message>
<location filename="../wlanconnect.cpp" line="879"/>
<source>card</source>
<translation></translation>
</message>
</context>
</TS>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,165 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2019 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 2 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef WLANCONNECT_H
#define WLANCONNECT_H
#include <QObject>
#include <QtPlugin>
#include <QNetworkInterface>
#include <QtNetwork/QNetworkConfigurationManager>
#include <QtNetwork/QtNetwork>
#include <QTimer>
#include <QStringList>
#include <QString>
#include <QGSettings>
#include <QListWidget>
#include <QListWidgetItem>
#include <QMap>
#include <QDBusMessage>
#include <QDBusObjectPath>
#include <QDBusInterface>
#include <QDBusReply>
#include <interface.h>
#include "switchbutton.h"
#include "hoverbtn.h"
#include "itemframe.h"
#include "wlanitem.h"
namespace Ui {
class WlanConnect;
}
class WlanConnect : public QObject, CommonInterface
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.kycc.CommonInterface")
Q_INTERFACES(CommonInterface)
public:
WlanConnect();
~WlanConnect();
QString plugini18nName() Q_DECL_OVERRIDE;
int pluginTypes() Q_DECL_OVERRIDE;
QWidget * pluginUi() Q_DECL_OVERRIDE;
const QString name() const Q_DECL_OVERRIDE;
bool isShowOnHomePage() const Q_DECL_OVERRIDE;
QIcon icon() const Q_DECL_OVERRIDE;
bool isEnable() const Q_DECL_OVERRIDE;
QString translationPath() const Q_DECL_OVERRIDE;
private:
void initComponent();
void runExternalApp();
void initSearchText();
void showDesktopNotify(const QString &message);
//点击item 连接/断开
void activeConnect(QString netName, QString deviceName, int type);
void deActiveConnect(QString netName, QString deviceName, int type);
int sortWlanNet(QString deviceName, QString name, QString signal);
void updateIcon(WlanItem *item, QString signalStrength, QString security, QString isApConnection);
void resortWifiList(ItemFrame *frame, QVector<QStringList> list);
//单wifi图标
int setSignal(QString lv);
QString wifiIcon(bool isLock, int strength);
//开关相关
void setSwitchStatus();
void hideLayout(QVBoxLayout * layout);
void showLayout(QVBoxLayout * layout);
//获取设备列表
void getDeviceList(QStringList &list);
//初始化设备wifi列表
void initNet();
void initNetListFromDevice(QString deviceName);
//处理列表 已连接
void addActiveItem(ItemFrame *frame, QString devName, QStringList infoList);
//处理列表 未连接
void addCustomItem(ItemFrame *frame, QString devName, QStringList infoList);
//增加设备
void addDeviceFrame(QString devName);
//减少设备
void removeDeviceFrame(QString devName);
//增加ap
void addOneWlanFrame(ItemFrame *frame, QString deviceName, QString name, QString signal, QString uuid, bool isLock, bool status, int type, QString isApConnection);
//减少ap
void removeOneWlanFrame(ItemFrame *frame, QString deviceName, QString ssid);
//单个wifi连接状态变化
void itemActiveConnectionStatusChanged(WlanItem *item, int status);
protected:
bool eventFilter(QObject *w,QEvent *e);
private:
Ui::WlanConnect *ui;
QString pluginName;
int pluginType;
QWidget *pluginWidget;
QDBusInterface *m_interface = nullptr;
QGSettings *m_switchGsettings = nullptr;
//设备列表
QStringList deviceList;
//设备名 + 单设备frame
QMap<QString, ItemFrame *> deviceFrameMap;
//QVector<QStringList> wlanSignalList;
// DeviceWlanlistInfo deviceWlanlistInfo;
QTimer * m_scanTimer = nullptr;
// QTimer * m_updateTimer = nullptr;
private:
SwitchButton *m_wifiSwitch;
bool m_firstLoad;
private slots:
void onNetworkAdd(QString deviceName, QStringList wlanInfo);
void onNetworkRemove(QString deviceName, QString wlannName);
void onActiveConnectionChanged(QString deviceName, QString ssid, QString uuid, int status);
void updateList();
void onDeviceStatusChanged();
void onDeviceNameChanged(QString, QString, int);
void reScan();
};
#endif // WLANCONNECT_H

View File

@ -0,0 +1,51 @@
QT += widgets network dbus gui core
TEMPLATE = lib
CONFIG += plugin
include(../component/drownlabel.pri)
TARGET = $$qtLibraryTarget(wlanconnect)
DESTDIR = ../..
target.path = $$[QT_INSTALL_LIBS]/ukui-control-center
trans.files = translations/*
trans.path = /usr/share/kylin-nm/wlanconnect/
INCLUDEPATH += \
$$PROJECT_COMPONENTSOURCE \
$$PROJECT_ROOTDIR \
/usr/include/ukcc/interface \
/usr/include/ukcc/widgets
LIBS += -L$$[QT_INSTALL_LIBS] -lgsettings-qt -lukcc
CONFIG += c++11 \
link_pkgconfig \
PKGCONFIG += gsettings-qt \
#DEFINES += QT_DEPRECATED_WARNINGS
SOURCES += \
deviceframe.cpp \
# drownlabel.cpp \
itemframe.cpp \
wlanconnect.cpp \
wlanitem.cpp
HEADERS += \
deviceframe.h \
# drownlabel.h \
itemframe.h \
wlanconnect.h \
wlanitem.h
FORMS += \
wlanconnect.ui
INSTALLS += target \
trans
TRANSLATIONS += \
translations/zh_CN.ts \
translations/tr.ts \
translations/bo.ts

View File

@ -0,0 +1,192 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>WlanConnect</class>
<widget class="QWidget" name="WlanConnect">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>885</width>
<height>700</height>
</rect>
</property>
<property name="windowTitle">
<string>WlanConnect</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="0,0,0,0">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<item>
<widget class="TitleLabel" name="titleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>WLAN</string>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="detailLayOut_3">
<property name="spacing">
<number>1</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<item>
<widget class="QFrame" name="openWifiFrame">
<property name="minimumSize">
<size>
<width>0</width>
<height>60</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>50</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<property name="leftMargin">
<number>18</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="openWIifLayout">
<property name="rightMargin">
<number>16</number>
</property>
<item>
<widget class="QLabel" name="openLabel">
<property name="minimumSize">
<size>
<width>118</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>open</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>523</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QVBoxLayout" name="availableLayout">
<property name="spacing">
<number>1</number>
</property>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<property name="spacing">
<number>8</number>
</property>
<item>
<widget class="QPushButton" name="detailBtn">
<property name="minimumSize">
<size>
<width>120</width>
<height>36</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>36</height>
</size>
</property>
<property name="text">
<string>Advanced settings</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>TitleLabel</class>
<extends>QLabel</extends>
<header>titlelabel.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,90 @@
#include "wlanitem.h"
#include <QPainter>
#define FRAME_SPEED 150
#define LIMIT_TIME 60*1000
#define TOTAL_PAGE 8
#define RADIUS 6.0
#define THEME_QT_SCHEMA "org.ukui.style"
#define MODE_QT_KEY "style-name"
WlanItem::WlanItem(bool bAcitve, bool isLock, QWidget *parent)
: isAcitve(bAcitve), isLock(isLock), QPushButton(parent)
{
this->setMinimumSize(550, 58);
this->setProperty("useButtonPalette", true);
setStyleSheet("QPushButton:!checked{background-color: palette(base)}");
QHBoxLayout *mLanLyt = new QHBoxLayout(this);
mLanLyt->setContentsMargins(16,0,16,0);
mLanLyt->setSpacing(16);
iconLabel = new QLabel(this);
titileLabel = new FixLabel(this);
statusLabel = new QLabel(this);
statusLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
// statusLabel->setMinimumSize(36,36);
infoLabel = new InfoButton(this);
mLanLyt->addWidget(iconLabel);
mLanLyt->addWidget(titileLabel,Qt::AlignLeft);
mLanLyt->addStretch();
mLanLyt->addWidget(statusLabel);
mLanLyt->addWidget(infoLabel);
loadIcons.append(QIcon::fromTheme("ukui-loading-1-symbolic"));
loadIcons.append(QIcon::fromTheme("ukui-loading-2-symbolic"));
loadIcons.append(QIcon::fromTheme("ukui-loading-3-symbolic"));
loadIcons.append(QIcon::fromTheme("ukui-loading-4-symbolic"));
loadIcons.append(QIcon::fromTheme("ukui-loading-5-symbolic"));
loadIcons.append(QIcon::fromTheme("ukui-loading-6-symbolic"));
loadIcons.append(QIcon::fromTheme("ukui-loading-7-symbolic"));
waitTimer = new QTimer(this);
connect(waitTimer, &QTimer::timeout, this, &WlanItem::updateIcon);
}
WlanItem::~WlanItem()
{
}
void WlanItem::updateIcon()
{
if (currentIconIndex > 6) {
currentIconIndex = 0;
}
statusLabel->setPixmap(loadIcons.at(currentIconIndex).pixmap(16,16));
currentIconIndex ++;
}
void WlanItem::startLoading()
{
waitTimer->start(FRAME_SPEED);
loading = true;
}
void WlanItem::stopLoading(){
waitTimer->stop();
loading = false;
}
void WlanItem::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();
if (!useHalfFillet) {
painter.drawRect(rect);
} else {
QPainterPath path;
path.addRoundedRect (rect, RADIUS, RADIUS);
QRect temp_rect(rect.left(), rect.top(), rect.width(), rect.height()/2);
path.addRect(temp_rect);
painter.drawPath(path);
}
QPushButton::paintEvent(event);
}

View File

@ -0,0 +1,52 @@
#ifndef WLANITEM_H
#define WLANITEM_H
#include <QWidget>
#include <QPushButton>
#include <QHBoxLayout>
#include <QLabel>
#include <QVariantMap>
#include <QTimer>
#include <QDebug>
#include <QGSettings>
#include <QImage>
#include "fixlabel.h"
#include "infobutton.h"
class WlanItem : public QPushButton
{
public:
WlanItem(bool bAcitve, bool isLock, QWidget *parent = nullptr);
~WlanItem();
public:
QLabel * iconLabel = nullptr;
InfoButton * infoLabel = nullptr;
FixLabel * titileLabel = nullptr;
QLabel * statusLabel = nullptr;
QString uuid = "";
void setHalfFillet(bool flag) {useHalfFillet = flag; repaint();}
public:
void startLoading();
void stopLoading();
bool isAcitve = false;
bool loading = false;
bool isLock = false;
protected:
void paintEvent(QPaintEvent *event);
private:
QTimer *waitTimer = nullptr;
QGSettings *themeGsettings = nullptr;
bool useHalfFillet = false;
QList<QIcon> loadIcons;
int currentIconIndex=0;
private slots:
void updateIcon();
};
#endif // WLANITEM_H

1
res.qrc Normal file
View File

@ -0,0 +1 @@
<RCC/>

BIN
res/g/close_black.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

BIN
res/g/close_white.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 B

BIN
res/g/down_arrow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 B

BIN
res/h/hide-pwd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
res/h/no-pwd-wifi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
res/h/right-pwd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
res/h/show-pwd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
res/hw/wifi-full-pwd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
res/hw/wifi-full.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 557 B

BIN
res/hw/wifi-high-pwd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 682 B

BIN
res/hw/wifi-high.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 605 B

BIN
res/hw/wifi-low-pwd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 651 B

BIN
res/hw/wifi-low.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 B

BIN
res/hw/wifi-medium-pwd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 663 B

BIN
res/hw/wifi-medium.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 606 B

BIN
res/hw/wifi-none-pwd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 B

BIN
res/hw/wifi-none.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 565 B

BIN
res/hw/wifi6+-full-pwd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 737 B

BIN
res/hw/wifi6+-full.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 665 B

BIN
res/hw/wifi6+-high-pwd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 781 B

BIN
res/hw/wifi6+-high.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 705 B

BIN
res/hw/wifi6+-low-pwd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 780 B

BIN
res/hw/wifi6+-low.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 704 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 781 B

BIN
res/hw/wifi6+-medium.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 712 B

BIN
res/hw/wifi6+-none-pwd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 765 B

BIN
res/hw/wifi6+-none.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 690 B

BIN
res/hw/wifi6-full-pwd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 762 B

BIN
res/hw/wifi6-full.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 690 B

BIN
res/hw/wifi6-high-pwd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 803 B

BIN
res/hw/wifi6-high.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 733 B

BIN
res/hw/wifi6-low-pwd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 806 B

BIN
res/hw/wifi6-low.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 755 B

BIN
res/hw/wifi6-medium-pwd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 812 B

BIN
res/hw/wifi6-medium.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 742 B

BIN
res/hw/wifi6-none-pwd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 789 B

BIN
res/hw/wifi6-none.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 718 B

BIN
res/l/network-offline.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 B

Some files were not shown because too many files have changed in this diff Show More