Import Upstream version 1.2.0.1kylin60
|
@ -0,0 +1,32 @@
|
|||
cmake_minimum_required(VERSION 2.6)
|
||||
project(ukui-biometric-auth)
|
||||
|
||||
find_package(Qt5 COMPONENTS Core Widgets DBus Svg)
|
||||
find_package(Qt5LinguistTools)
|
||||
find_package(OpenCV REQUIRED)
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(GIOUNIX2 REQUIRED gio-unix-2.0)
|
||||
pkg_check_modules(GLIB2 REQUIRED glib-2.0 gio-2.0)
|
||||
|
||||
set(UKUI_BIOMETRIC_DIR /usr/share/ukui-biometric)
|
||||
set(CMAKE_INSTALL_PREFIX /usr)
|
||||
|
||||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror")
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set (CONDOR_SCRIPT_PERMS OWNER_READ OWNER_WRITE OWNER_EXECUTE
|
||||
GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
|
||||
add_compile_options(-fPIC)
|
||||
add_definitions(-DUKUI_BIOMETRIC=${UKUI_BIOMETRIC_DIR})
|
||||
add_definitions(-DCONFIG_FILE=/etc/biometric-auth/ukui-biometric.conf)
|
||||
|
||||
|
||||
add_subdirectory(bioauth)
|
||||
add_subdirectory(bioauth-bin)
|
||||
add_subdirectory(pam-biometric)
|
||||
add_subdirectory(polkit-agent)
|
||||
add_subdirectory(images)
|
||||
|
||||
add_dependencies(bioauth BioAuth)
|
||||
add_dependencies(polkit-ukui-authentication-agent-1 BioAuthWidgets)
|
|
@ -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>.
|
|
@ -0,0 +1,29 @@
|
|||
project(bioauth-bin)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
||||
include_directories(
|
||||
../common
|
||||
../bioauth/include
|
||||
${Qt5Core_INCLUDE_DIRS}
|
||||
${Qt5DBus_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(bin_SRCS
|
||||
${bin_SRCS}
|
||||
src/main.cpp
|
||||
src/keywatcher.cpp
|
||||
../common/generic.cpp
|
||||
)
|
||||
|
||||
add_executable(bioauth ${bin_SRCS})
|
||||
target_link_libraries(bioauth Qt5::Core BioAuth)
|
||||
|
||||
install(TARGETS bioauth DESTINATION bin)
|
||||
|
||||
file(GLOB ts_files i18n_ts/*.ts)
|
||||
qt5_add_translation(qm_files ${ts_files})
|
||||
add_custom_target(bioauth-bin_i18n DEPENDS ${qm_files} SOURCES ${ts_files})
|
||||
add_dependencies(bioauth bioauth-bin_i18n)
|
||||
|
||||
install(FILES ${qm_files} DESTINATION ${UKUI_BIOMETRIC_DIR}/i18n_qm/bioauth-bin)
|
|
@ -0,0 +1,119 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1">
|
||||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="100"/>
|
||||
<source>Try it again</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="102"/>
|
||||
<source>Use other Devices</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="103"/>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="112"/>
|
||||
<source>Choose the option</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="134"/>
|
||||
<location filename="../src/main.cpp" line="169"/>
|
||||
<location filename="../src/main.cpp" line="178"/>
|
||||
<source>Invaild response "</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="134"/>
|
||||
<location filename="../src/main.cpp" line="169"/>
|
||||
<location filename="../src/main.cpp" line="178"/>
|
||||
<source>authentication will be canceld</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="135"/>
|
||||
<location filename="../src/main.cpp" line="170"/>
|
||||
<location filename="../src/main.cpp" line="179"/>
|
||||
<location filename="../src/main.cpp" line="315"/>
|
||||
<source>AUTHENTICATION CANCELED</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="146"/>
|
||||
<source>=== BIOMETRIC DEVICES ===</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="157"/>
|
||||
<source>Choose the device</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="210"/>
|
||||
<source>Sevice Name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="211"/>
|
||||
<source>DISPLAY env</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="212"/>
|
||||
<source>User</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="213"/>
|
||||
<source>Display debug information</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="214"/>
|
||||
<source>Device short name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="249"/>
|
||||
<source>BIOMETRIC AUTHENTICATION</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="251"/>
|
||||
<source>Press Q or Esc to cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="263"/>
|
||||
<source>AUTHENTICATION SUCCESS</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="267"/>
|
||||
<source>AUTHENTICATION FAILED</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="277"/>
|
||||
<source>Failed to verify %1, you still have %2 verification opportunities</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="279"/>
|
||||
<source>Unable to verify %1, please enter password.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="302"/>
|
||||
<source>BIOMETRIC AUTHENTICATION END</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
|
@ -0,0 +1,91 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="bo_CN">
|
||||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<source>DISPLAY env</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Choose the option</source>
|
||||
<translation>གདམ་བྱ་འདེམ་པ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>=== BIOMETRIC DEVICES ===</source>
|
||||
<translation>=== 生物识别设备 ===</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Display debug information</source>
|
||||
<translation>བསྒྱུར་བཅོས་ཆ་འཕྲིན་མངོན་དུ་བཅུག་པ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Invaild response "</source>
|
||||
<translation>ནུས་མེད་ཀྱི་དང་ལེན་ཨང་།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>AUTHENTICATION SUCCESS</source>
|
||||
<translation>བདེན་དཔང་ངོས་འཛིན་ལེགས་གྲུབ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Try it again</source>
|
||||
<translation>ཡང་བསྐྱར་ཚོད་ལྟ་ཐེངས་གཅིག</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation>མེད་པར་བཟོ་བ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>authentication will be canceld</source>
|
||||
<translation>བདེན་དཔང་ངོས་འཛིན་མི་འགྱངས་པར་རྩིས་མེད་གཏོང་།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>AUTHENTICATION CANCELED</source>
|
||||
<translation>བདེན་དཔང་ངོས་འཛིན་རྩིས་མེད་གཏོང་།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Sevice Name</source>
|
||||
<translation>ཞབས་ཞུའི་མིང་།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Press Q or Esc to cancel</source>
|
||||
<translation>Qམནན་པའམEscརྩིས་མེད།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>BIOMETRIC AUTHENTICATION</source>
|
||||
<translation>སྐྱེ་དངོས་བརྟག་དཔྱད་བདེན་དཔང་ངོས་འཛིན།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>AUTHENTICATION FAILED</source>
|
||||
<translation>བདེན་དཔང་ངོས་འཛིན་ཕམ་ཉེས་བྱུང་།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Use other Devices</source>
|
||||
<translation>སྒྲིག་ཆས་གཞན་བེད་སྤྱོད་བཏང་།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>BIOMETRIC AUTHENTICATION END</source>
|
||||
<translation>སྐྱེ་དངོས་བརྟག་དཔྱད་བདེན་དཔང་ངོས་འཛིན་མཇུག་སྒྲིལ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Choose the device</source>
|
||||
<translation>སྒྲིག་ཆས་འདེམ་པ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>User</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Device short name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Failed to verify %1, you still have %2 verification opportunities</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to verify %1, please enter password.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
|
@ -0,0 +1,114 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="es">
|
||||
<context>
|
||||
<name>BioDevices</name>
|
||||
<message>
|
||||
<source>FingerPrint</source>
|
||||
<translation type="vanished">Huella dactilar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>FingerVein</source>
|
||||
<translation type="vanished">FingerVein</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Iris</source>
|
||||
<translation type="vanished">Iris</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Face</source>
|
||||
<translation type="vanished">Cara</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>VoicePrint</source>
|
||||
<translation type="vanished">Impresión de voz</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<source>Try it again</source>
|
||||
<translation>Pruébalo otra vez</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Use other Devices</source>
|
||||
<translation>Usa otros dispositivos</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation>Cancelar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Choose the option</source>
|
||||
<translation>Elige la opción</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Invaild response "</source>
|
||||
<translation>Respuesta interna</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>AUTHENTICATION CANCELED</source>
|
||||
<translation>AUTENTIFICACIÓN CANCELADA</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>=== BIOMETRIC DEVICES ===</source>
|
||||
<translation>=== DISPOSITIVOS BIOMÉTRICOS ===</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Choose the device</source>
|
||||
<translation>Elige el dispositivo</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Sevice Name</source>
|
||||
<translation>Nombre del Servicio</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>DISPLAY env</source>
|
||||
<translation>PANTALLA env</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>User</source>
|
||||
<translation>Usuario</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Display debug information</source>
|
||||
<translation>Mostrar información de depuración</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Device short name</source>
|
||||
<translation>Nombre corto del dispositivo</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>BIOMETRIC AUTHENTICATION</source>
|
||||
<translation>AUTENTICACIÓN BIOMÉTRICA</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Press Q or Esc to cancel</source>
|
||||
<translation>Presione Q o Esc para cancelar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>AUTHENTICATION SUCCESS</source>
|
||||
<translation>ÉXITO DE LA AUTENTICACIÓN</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>AUTHENTICATION FAILED</source>
|
||||
<translation>Falla la autenticacion</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>BIOMETRIC AUTHENTICATION END</source>
|
||||
<translation>FINALIZACIÓN BIOMÉTRICA FINAL</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>authentication will be canceld</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Failed to verify %1, you still have %2 verification opportunities</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to verify %1, please enter password.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
|
@ -0,0 +1,114 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="fr">
|
||||
<context>
|
||||
<name>BioDevices</name>
|
||||
<message>
|
||||
<source>FingerPrint</source>
|
||||
<translation type="vanished">Empreinte digitale</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>FingerVein</source>
|
||||
<translation type="vanished">FingerVein</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Iris</source>
|
||||
<translation type="vanished">Iris</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Face</source>
|
||||
<translation type="vanished">Visage</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>VoicePrint</source>
|
||||
<translation type="vanished">VoicePrint</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<source>Try it again</source>
|
||||
<translation>Essayez à nouveau</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Use other Devices</source>
|
||||
<translation>Utiliser d'autres appareils</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation>Annuler</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Choose the option</source>
|
||||
<translation>Choisissez l'option</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Invaild response "</source>
|
||||
<translation>Réponse Invaild \ "</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>AUTHENTICATION CANCELED</source>
|
||||
<translation>AUTHENTIFICATION ANNULEE</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>=== BIOMETRIC DEVICES ===</source>
|
||||
<translation>=== DISPOSITIFS BIOMETRIQUES ===</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Choose the device</source>
|
||||
<translation>Choisissez l'appareil</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Sevice Name</source>
|
||||
<translation>Nom de Sevice</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>DISPLAY env</source>
|
||||
<translation>AFFICHER env</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>User</source>
|
||||
<translation>Utilisateur</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Display debug information</source>
|
||||
<translation>Afficher les informations de débogage</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Device short name</source>
|
||||
<translation>Nom abrégé de l'appareil</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>BIOMETRIC AUTHENTICATION</source>
|
||||
<translation>AUTHENTIFICATION BIOMETRIQUE</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Press Q or Esc to cancel</source>
|
||||
<translation>Appuyez sur Q ou Echap pour annuler</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>AUTHENTICATION SUCCESS</source>
|
||||
<translation>SUCCÈS D'AUTHENTIFICATION</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>AUTHENTICATION FAILED</source>
|
||||
<translation>AUTHENTIFICATION ÉCHOUÉE</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>BIOMETRIC AUTHENTICATION END</source>
|
||||
<translation>FIN DE L'AUTHENTIFICATION BIOMÉTRIQUE</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>authentication will be canceld</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Failed to verify %1, you still have %2 verification opportunities</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to verify %1, please enter password.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
|
@ -0,0 +1,114 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="pt">
|
||||
<context>
|
||||
<name>BioDevices</name>
|
||||
<message>
|
||||
<source>FingerPrint</source>
|
||||
<translation type="vanished">Impressão digital</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>FingerVein</source>
|
||||
<translation type="vanished">FingerVein</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Iris</source>
|
||||
<translation type="vanished">Íris</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Face</source>
|
||||
<translation type="vanished">Cara</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>VoicePrint</source>
|
||||
<translation type="vanished">VoicePrint</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<source>Try it again</source>
|
||||
<translation>Tente de novo</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Use other Devices</source>
|
||||
<translation>Use outros dispositivos</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation>Cancelar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Choose the option</source>
|
||||
<translation>Escolha a opção</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Invaild response "</source>
|
||||
<translation>Resposta Inválida \ "</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>AUTHENTICATION CANCELED</source>
|
||||
<translation>AUTENTICAÇÃO CANCELADA</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>=== BIOMETRIC DEVICES ===</source>
|
||||
<translation>=== DISPOSITIVOS BIOMÉTRICOS ===</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Choose the device</source>
|
||||
<translation>Escolha o dispositivo</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Sevice Name</source>
|
||||
<translation>Nome do Sevice</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>DISPLAY env</source>
|
||||
<translation>DISPLAY env</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>User</source>
|
||||
<translation>Do utilizador</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Display debug information</source>
|
||||
<translation>Exibir informações de depuração</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Device short name</source>
|
||||
<translation>Nome abreviado do dispositivo</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>BIOMETRIC AUTHENTICATION</source>
|
||||
<translation>AUTENTICAÇÃO BIOMÉTRICA</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Press Q or Esc to cancel</source>
|
||||
<translation>Pressione Q ou Esc para cancelar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>AUTHENTICATION SUCCESS</source>
|
||||
<translation>SUCESSO DE AUTENTICAÇÃO</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>AUTHENTICATION FAILED</source>
|
||||
<translation>AUTENTICAÇÃO FALHOU</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>BIOMETRIC AUTHENTICATION END</source>
|
||||
<translation>ENDEREÇO DE AUTENTICAÇÃO BIOMÉTRICA</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>authentication will be canceld</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Failed to verify %1, you still have %2 verification opportunities</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to verify %1, please enter password.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
|
@ -0,0 +1,114 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="ru">
|
||||
<context>
|
||||
<name>BioDevices</name>
|
||||
<message>
|
||||
<source>FingerPrint</source>
|
||||
<translation type="vanished">FingerPrint</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>FingerVein</source>
|
||||
<translation type="vanished">FingerVein</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Iris</source>
|
||||
<translation type="vanished">Ирис</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Face</source>
|
||||
<translation type="vanished">Лицо</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>VoicePrint</source>
|
||||
<translation type="vanished">Voiceprint</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<source>Try it again</source>
|
||||
<translation>Попробуйте снова</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Use other Devices</source>
|
||||
<translation>Использовать другие устройства</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation>Отмена</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Choose the option</source>
|
||||
<translation>Выберите вариант</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Invaild response "</source>
|
||||
<translation>Invaild response \ "</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>AUTHENTICATION CANCELED</source>
|
||||
<translation>АВТОРИЗАЦИЯ ОТМЕНА</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>=== BIOMETRIC DEVICES ===</source>
|
||||
<translation>=== БИОМЕТРИЧЕСКИЕ УСТРОЙСТВА ===</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Choose the device</source>
|
||||
<translation>Выберите устройство</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Sevice Name</source>
|
||||
<translation>Имя ячейки</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>DISPLAY env</source>
|
||||
<translation>DISPLAY env</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>User</source>
|
||||
<translation>пользователь</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Display debug information</source>
|
||||
<translation>Отображать отладочную информацию</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Device short name</source>
|
||||
<translation>Краткое название устройства</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>BIOMETRIC AUTHENTICATION</source>
|
||||
<translation>БИОМЕТРИЧЕСКАЯ АУТЕНТИФИКАЦИЯ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Press Q or Esc to cancel</source>
|
||||
<translation>Нажмите Q или Esc, чтобы отменить</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>AUTHENTICATION SUCCESS</source>
|
||||
<translation>УСПЕХ АУТЕНТИФИКАЦИИ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>AUTHENTICATION FAILED</source>
|
||||
<translation>АВТОРИЗАЦИЯ НЕИСПРАВНО</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>BIOMETRIC AUTHENTICATION END</source>
|
||||
<translation>КОНТРОЛЬ БИОМЕТРИЧЕСКОЙ АВТОРИЗАЦИИ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>authentication will be canceld</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Failed to verify %1, you still have %2 verification opportunities</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to verify %1, please enter password.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
|
@ -0,0 +1,142 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="tr">
|
||||
<context>
|
||||
<name>BioDevices</name>
|
||||
<message>
|
||||
<source>FingerPrint</source>
|
||||
<translation type="obsolete">Parmak İzi</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>FingerVein</source>
|
||||
<translation type="obsolete">Damar İzi</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Iris</source>
|
||||
<translation type="obsolete">Göz</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Face</source>
|
||||
<translation type="obsolete">Yüz Tanıma</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>VoicePrint</source>
|
||||
<translation type="obsolete">Ses İzi</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="100"/>
|
||||
<source>Try it again</source>
|
||||
<translation>Yeniden Dene</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="102"/>
|
||||
<source>Use other Devices</source>
|
||||
<translation>Diğer Cihazları Kullan</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="103"/>
|
||||
<source>Cancel</source>
|
||||
<translation>İptal</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="112"/>
|
||||
<source>Choose the option</source>
|
||||
<translation>Seçeneği seçin</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="134"/>
|
||||
<location filename="../src/main.cpp" line="169"/>
|
||||
<location filename="../src/main.cpp" line="178"/>
|
||||
<source>Invaild response "</source>
|
||||
<translation>Geçersiz cevap "</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="134"/>
|
||||
<location filename="../src/main.cpp" line="169"/>
|
||||
<location filename="../src/main.cpp" line="178"/>
|
||||
<source>authentication will be canceld</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="135"/>
|
||||
<location filename="../src/main.cpp" line="170"/>
|
||||
<location filename="../src/main.cpp" line="179"/>
|
||||
<location filename="../src/main.cpp" line="315"/>
|
||||
<source>AUTHENTICATION CANCELED</source>
|
||||
<translation>KİMLİK DOĞRULAMA</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="146"/>
|
||||
<source>=== BIOMETRIC DEVICES ===</source>
|
||||
<translation>=== BİYOMETRİK CİHAZLAR ===</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="157"/>
|
||||
<source>Choose the device</source>
|
||||
<translation>Cihazı seçin</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="210"/>
|
||||
<source>Sevice Name</source>
|
||||
<translation>Servis Adı</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="211"/>
|
||||
<source>DISPLAY env</source>
|
||||
<translation>EKRAN env</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="212"/>
|
||||
<source>User</source>
|
||||
<translation type="unfinished">Kullanıcı</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="213"/>
|
||||
<source>Display debug information</source>
|
||||
<translation>Hata ayıklama bilgilerini görüntüle</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="214"/>
|
||||
<source>Device short name</source>
|
||||
<translation type="unfinished">Cihaz kısa adı</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="249"/>
|
||||
<source>BIOMETRIC AUTHENTICATION</source>
|
||||
<translation>BİYOMETRİK KİMLİK DOĞRULAMA</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="251"/>
|
||||
<source>Press Q or Esc to cancel</source>
|
||||
<translation>İptal etmek için Q veya Esc tuşuna basın</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="263"/>
|
||||
<source>AUTHENTICATION SUCCESS</source>
|
||||
<translation>KİMLİK DOĞRULAMA</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="267"/>
|
||||
<source>AUTHENTICATION FAILED</source>
|
||||
<translation>KİMLİK DOĞRULAMA BAŞARISIZ OLDU</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="277"/>
|
||||
<source>Failed to verify %1, you still have %2 verification opportunities</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="279"/>
|
||||
<source>Unable to verify %1, please enter password.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="302"/>
|
||||
<source>BIOMETRIC AUTHENTICATION END</source>
|
||||
<translation>BİYOMETRİK KİMLİK DOĞRULAMA SONU</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
|
@ -0,0 +1,119 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="zh_CN">
|
||||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="100"/>
|
||||
<source>Try it again</source>
|
||||
<translation>再试一次</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="102"/>
|
||||
<source>Use other Devices</source>
|
||||
<translation>使用其他设备</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="103"/>
|
||||
<source>Cancel</source>
|
||||
<translation>取消</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="112"/>
|
||||
<source>Choose the option</source>
|
||||
<translation>选择选项</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="134"/>
|
||||
<location filename="../src/main.cpp" line="169"/>
|
||||
<location filename="../src/main.cpp" line="178"/>
|
||||
<source>Invaild response "</source>
|
||||
<translation>不能识别的响应 "</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="134"/>
|
||||
<location filename="../src/main.cpp" line="169"/>
|
||||
<location filename="../src/main.cpp" line="178"/>
|
||||
<source>authentication will be canceld</source>
|
||||
<translation>认证将要被取消</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="135"/>
|
||||
<location filename="../src/main.cpp" line="170"/>
|
||||
<location filename="../src/main.cpp" line="179"/>
|
||||
<location filename="../src/main.cpp" line="315"/>
|
||||
<source>AUTHENTICATION CANCELED</source>
|
||||
<translation>认证被取消</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="146"/>
|
||||
<source>=== BIOMETRIC DEVICES ===</source>
|
||||
<translation>=== 生物识别设备 ===</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="157"/>
|
||||
<source>Choose the device</source>
|
||||
<translation>选择设备</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="210"/>
|
||||
<source>Sevice Name</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="211"/>
|
||||
<source>DISPLAY env</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="212"/>
|
||||
<source>User</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="213"/>
|
||||
<source>Display debug information</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="214"/>
|
||||
<source>Device short name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="249"/>
|
||||
<source>BIOMETRIC AUTHENTICATION</source>
|
||||
<translation>生物识别认证</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="251"/>
|
||||
<source>Press Q or Esc to cancel</source>
|
||||
<translation>按Q或者Esc取消</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="263"/>
|
||||
<source>AUTHENTICATION SUCCESS</source>
|
||||
<translation>认证成功</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="267"/>
|
||||
<source>AUTHENTICATION FAILED</source>
|
||||
<translation>认证失败</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="277"/>
|
||||
<source>Failed to verify %1, you still have %2 verification opportunities</source>
|
||||
<translation>验证%1失败,您还有%2次尝试机会</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="279"/>
|
||||
<source>Unable to verify %1, please enter password.</source>
|
||||
<translation>无法验证%1,请输入密码.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="302"/>
|
||||
<source>BIOMETRIC AUTHENTICATION END</source>
|
||||
<translation>生物识别认证结束</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
**/
|
||||
|
||||
#include "keywatcher.h"
|
||||
#include <termios.h>
|
||||
|
||||
KeyWatcher::KeyWatcher(QObject *parent)
|
||||
: QThread(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void KeyWatcher::run()
|
||||
{
|
||||
// 修改终端属性,保证按键被立即接收
|
||||
struct termios current;
|
||||
tcgetattr(0, &save);
|
||||
current = save;
|
||||
current.c_lflag &= ~ICANON;
|
||||
current.c_lflag &= ~ECHO;
|
||||
current.c_cc[VMIN] = 1;
|
||||
current.c_cc[VTIME] = 0;
|
||||
tcsetattr(0, TCSANOW, ¤t);
|
||||
|
||||
while(!isInterruptionRequested()){
|
||||
|
||||
fd_set readfds;
|
||||
FD_ZERO(&readfds);
|
||||
FD_SET(0, &readfds);
|
||||
|
||||
char ch;
|
||||
switch(select(32, &readfds, NULL, NULL, NULL)){
|
||||
case 0:
|
||||
// printf("select time out\n");
|
||||
break;
|
||||
case -1:
|
||||
// printf("select error\n");
|
||||
break;
|
||||
default:
|
||||
// 'q' | 'Q' or Esc
|
||||
if((ch = getchar()) == 'q' || ch == 'Q' || ch == 27){
|
||||
tcsetattr(0, TCSANOW, &save);
|
||||
emit exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tcsetattr(0, TCSANOW, &save); // 恢复原来的终端属性,以免干扰shall和之后的程序运行
|
||||
}
|
||||
|
||||
void KeyWatcher::stop()
|
||||
{
|
||||
tcsetattr(0, TCSANOW, &save);
|
||||
|
||||
requestInterruption();
|
||||
terminate();
|
||||
wait();
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef KEYWATCHER_H
|
||||
#define KEYWATCHER_H
|
||||
|
||||
#include <QThread>
|
||||
#include <termios.h>
|
||||
|
||||
class KeyWatcher : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit KeyWatcher(QObject *parent = nullptr);
|
||||
void run() override;
|
||||
void stop();
|
||||
|
||||
signals:
|
||||
void exit();
|
||||
|
||||
private:
|
||||
struct termios save;
|
||||
};
|
||||
|
||||
#endif // KEYWATCHER_H
|
|
@ -0,0 +1,323 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
**/
|
||||
//#include "mainwindow.h"
|
||||
#include <QCoreApplication>
|
||||
#include <QTranslator>
|
||||
#include <QCommandLineOption>
|
||||
#include <QCommandLineParser>
|
||||
|
||||
#include <pwd.h>
|
||||
|
||||
#include "generic.h"
|
||||
#include "keywatcher.h"
|
||||
#include "bioauth.h"
|
||||
#include "biodevices.h"
|
||||
|
||||
#define START_COLOR "\033[1;31m"
|
||||
#define RESULT_COLOR "\033[1;31m"
|
||||
#define PROMPT_COLOR "\033[33m"
|
||||
#define NOTIFY_COLOR //"\033[37m"
|
||||
#define QUESTION_COLOR //"\033[1;37m"
|
||||
#define RESET_COLOR "\033[0m"
|
||||
|
||||
bool enableDebug;
|
||||
QString logPrefix;
|
||||
|
||||
enum MsgType
|
||||
{
|
||||
START,
|
||||
PROMPT,
|
||||
NOTIFY,
|
||||
QUESTION,
|
||||
RESULT
|
||||
};
|
||||
|
||||
enum _Option
|
||||
{
|
||||
OPTION_TRY_AGAIN,
|
||||
OPTION_SELECT_DEVICE,
|
||||
OPTION_CANCEL,
|
||||
OPTION_UNDEFINED
|
||||
};
|
||||
typedef enum _Option Option;
|
||||
|
||||
static QString lastMessage;
|
||||
|
||||
|
||||
void showMessage(const QString &message, int type)
|
||||
{
|
||||
// filter out the same message
|
||||
if(message == lastMessage)
|
||||
return;
|
||||
|
||||
lastMessage = message;
|
||||
|
||||
char *text = message.toLocal8Bit().data();
|
||||
|
||||
switch(type) {
|
||||
case START:
|
||||
fprintf(stdout, START_COLOR "=== %s ===\n", text);
|
||||
break;
|
||||
case PROMPT:
|
||||
fprintf(stdout, PROMPT_COLOR "%s\n", text);
|
||||
break;
|
||||
case NOTIFY:
|
||||
fprintf(stdout, NOTIFY_COLOR "%s\n", text);
|
||||
break;
|
||||
case QUESTION:
|
||||
fprintf(stdout, QUESTION_COLOR "%s", text);
|
||||
break;
|
||||
case RESULT:
|
||||
fprintf(stdout, RESULT_COLOR "=== %s ===\n", text);
|
||||
break;
|
||||
default:
|
||||
fprintf(stdout, "%s\n", text);
|
||||
break;
|
||||
}
|
||||
fprintf(stdout, RESET_COLOR);
|
||||
}
|
||||
|
||||
Option showOption(bool showSelectDevices)
|
||||
{
|
||||
QStringList optionList;
|
||||
QString message;
|
||||
|
||||
optionList << QObject::tr("Try it again");
|
||||
if(showSelectDevices)
|
||||
optionList << QObject::tr("Use other Devices");
|
||||
optionList << QObject::tr("Cancel");
|
||||
|
||||
for(int i = 0; i < optionList.size(); i++){
|
||||
message = QString(" %1. %2\n")
|
||||
.arg(QString::number(i+1))
|
||||
.arg(optionList.at(i));
|
||||
showMessage(message, QUESTION);
|
||||
}
|
||||
message = QString("%1 (1-%2):")
|
||||
.arg(QObject::tr("Choose the option"))
|
||||
.arg(QString::number(optionList.size()));
|
||||
showMessage(message, QUESTION);
|
||||
|
||||
char line[1024];
|
||||
fgets(line, sizeof(line), stdin);
|
||||
|
||||
if(line[strlen(line) - 1] == '\n')
|
||||
line[strlen(line) - 1] = '\0';
|
||||
|
||||
if(!strcmp(line, "1"))
|
||||
return OPTION_TRY_AGAIN;
|
||||
else if(!strcmp(line, "2"))
|
||||
{
|
||||
if(showSelectDevices)
|
||||
return OPTION_SELECT_DEVICE;
|
||||
else
|
||||
return OPTION_CANCEL;
|
||||
}
|
||||
else if(showSelectDevices && !strcmp(line, "3"))
|
||||
return OPTION_CANCEL;
|
||||
else {
|
||||
showMessage(QObject::tr("Invaild response \"") + line + "\"" + "," + QObject::tr("authentication will be canceld") , NOTIFY);
|
||||
showMessage(QObject::tr("AUTHENTICATION CANCELED"), START);
|
||||
exit(BIO_FAILED);
|
||||
}
|
||||
return OPTION_UNDEFINED;
|
||||
}
|
||||
|
||||
DeviceInfo showDevices(const QMap<int, QList<DeviceInfo>> &devicesMap)
|
||||
{
|
||||
int count = 0;
|
||||
QString message;
|
||||
|
||||
showMessage(QObject::tr("=== BIOMETRIC DEVICES ==="), PROMPT);
|
||||
for(auto type : devicesMap.keys()) {
|
||||
for(auto deviceInfo : devicesMap[type]) {
|
||||
message = QString(" %1. [%2] %3")
|
||||
.arg(QString::number(++count))
|
||||
.arg(BioDevices::bioTypeToString_tr(type))
|
||||
.arg(deviceInfo.device_shortname);
|
||||
showMessage(message, NOTIFY);
|
||||
}
|
||||
}
|
||||
message = QString("%1 (1-%2):")
|
||||
.arg(QObject::tr("Choose the device"))
|
||||
.arg(QString::number(count));
|
||||
showMessage(message, QUESTION);
|
||||
|
||||
char line[1024];
|
||||
fgets(line, sizeof(line), stdin);
|
||||
|
||||
if(line[strlen(line) - 1] == '\n')
|
||||
line[strlen(line) - 1] = '\0';
|
||||
|
||||
for(auto ch : QString(line)) {
|
||||
if(!ch.isDigit()){
|
||||
showMessage(QObject::tr("Invaild response \"") + line + "\"" + "," +QObject::tr("authentication will be canceld") , NOTIFY);
|
||||
showMessage(QObject::tr("AUTHENTICATION CANCELED"), START);
|
||||
exit(BIO_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
int deviceIndex = QString(line).toInt();
|
||||
|
||||
if(deviceIndex > count) {
|
||||
showMessage(QObject::tr("Invaild response \"") + line + "\"" + "," + QObject::tr("authentication will be canceld"), NOTIFY);
|
||||
showMessage(QObject::tr("AUTHENTICATION CANCELED"), START);
|
||||
exit(BIO_FAILED);
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
for(auto type : devicesMap.keys()) {
|
||||
int size = devicesMap[type].size();
|
||||
if(i + size >= deviceIndex) {
|
||||
return devicesMap[type][deviceIndex - i - 1];
|
||||
}
|
||||
i += size;
|
||||
}
|
||||
return DeviceInfo();
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication::setSetuidAllowed(true);
|
||||
QCoreApplication a(argc, argv);
|
||||
|
||||
QString locale = QLocale::system().name();
|
||||
QTranslator translator, translator_bin;
|
||||
QString qmfile = QString("%1/i18n_qm/%2.qm").arg(GET_STR(UKUI_BIOMETRIC)).arg(locale);
|
||||
QString qmfile_bin = QString("%1/i18n_qm/bioauth-bin/%2.qm").arg(GET_STR(UKUI_BIOMETRIC)).arg(locale);
|
||||
qDebug() << "load translation file " << qmfile << qmfile_bin;
|
||||
translator.load(qmfile);
|
||||
translator_bin.load((qmfile_bin));
|
||||
a.installTranslator(&translator);
|
||||
a.installTranslator(&translator_bin);
|
||||
|
||||
QCommandLineParser parser;
|
||||
QCommandLineOption serviceOption({"s", "service"}, QObject::tr("Sevice Name"));
|
||||
QCommandLineOption displayOption({"x", "display"}, QObject::tr("DISPLAY env"), "display", ":0");
|
||||
QCommandLineOption usernameOption({"u", "user"}, QObject::tr("User"), "user", "");
|
||||
QCommandLineOption debugOption({"d", "debug"}, QObject::tr("Display debug information"));
|
||||
QCommandLineOption deviceOption({"e", "device"}, QObject::tr("Device short name"), "");
|
||||
|
||||
parser.addOptions({serviceOption, displayOption, usernameOption, debugOption, deviceOption});
|
||||
parser.process(a);
|
||||
|
||||
if(parser.isSet(debugOption))
|
||||
enableDebug = true;
|
||||
else
|
||||
enableDebug = false;
|
||||
|
||||
logPrefix = "[pam-diaglog]:";
|
||||
qInstallMessageHandler(outputMessage);
|
||||
|
||||
QString userName = parser.value(usernameOption);
|
||||
if(userName.isEmpty())
|
||||
exit(BIO_ERROR);
|
||||
qDebug() << "authentication user: " << userName;
|
||||
|
||||
uid_t uid;
|
||||
struct passwd *pwd = getpwnam(userName.toLocal8Bit().data());
|
||||
if(pwd)
|
||||
uid = pwd->pw_uid;
|
||||
else
|
||||
exit(BIO_ERROR);
|
||||
|
||||
BioDevices bioDevices(true);
|
||||
int maxFailedTimes = bioDevices.getFailedTimes();
|
||||
int failedTimes = 0;
|
||||
DeviceInfoPtr deviceInfo = bioDevices.getDefaultDevice(uid);
|
||||
bool isHiddenSwitchButton = bioDevices.GetHiddenSwitchButton();
|
||||
if(!deviceInfo)
|
||||
exit(BIO_ERROR);
|
||||
if(bioDevices.getFeatureCount(uid)<1)
|
||||
exit(BIO_ERROR);
|
||||
|
||||
showMessage(QObject::tr("BIOMETRIC AUTHENTICATION"), START);
|
||||
if(!isHiddenSwitchButton)
|
||||
showMessage(QObject::tr("Press Q or Esc to cancel"), PROMPT);
|
||||
|
||||
BioAuth bioAuth(uid, deviceInfo);
|
||||
KeyWatcher watcher;
|
||||
QMap<int,int> m_failedTimes;
|
||||
QObject::connect(&bioAuth, &BioAuth::notify, &a, [&](const QString &msg){
|
||||
showMessage(msg, NOTIFY);
|
||||
});
|
||||
QObject::connect(&bioAuth, &BioAuth::authComplete, &a, [&](uid_t uid_, int result, int retErrNo){
|
||||
Q_UNUSED(retErrNo);
|
||||
watcher.stop();
|
||||
if(result && uid == uid_) {
|
||||
showMessage(QObject::tr("AUTHENTICATION SUCCESS"), RESULT);
|
||||
exit(BIO_SUCCESS);
|
||||
}
|
||||
else {
|
||||
showMessage(QObject::tr("AUTHENTICATION FAILED"), RESULT);
|
||||
|
||||
if (m_failedTimes.contains(deviceInfo->device_id)) {
|
||||
m_failedTimes[deviceInfo->device_id] = m_failedTimes[deviceInfo->device_id] + 1;
|
||||
} else {
|
||||
m_failedTimes[deviceInfo->device_id] = 1;
|
||||
}
|
||||
|
||||
if(m_failedTimes[deviceInfo->device_id]<maxFailedTimes)
|
||||
{
|
||||
showMessage(QObject::tr("Failed to verify %1, you still have %2 verification opportunities").arg(bioDevices.bioTypeToString_tr(deviceInfo->biotype)).arg(maxFailedTimes-m_failedTimes[deviceInfo->device_id]),RESULT);
|
||||
}else{
|
||||
showMessage(QObject::tr("Unable to verify %1, please enter password.").arg(bioDevices.bioTypeToString_tr(deviceInfo->biotype)),RESULT);
|
||||
exit(BIO_IGNORE);
|
||||
}
|
||||
Option option = showOption(bioDevices.count() > 1);
|
||||
switch(option) {
|
||||
case OPTION_TRY_AGAIN:
|
||||
bioAuth.startAuth();
|
||||
watcher.start();
|
||||
break;
|
||||
case OPTION_SELECT_DEVICE:
|
||||
{
|
||||
DeviceInfoPtr deviceInfo = std::make_shared<DeviceInfo>();
|
||||
*deviceInfo = showDevices(bioDevices.getAllDevices());
|
||||
bioAuth.setDevice(deviceInfo);
|
||||
bioAuth.startAuth();
|
||||
watcher.start();
|
||||
break;
|
||||
}
|
||||
case OPTION_CANCEL:
|
||||
if(isHiddenSwitchButton)
|
||||
{
|
||||
exit(BIO_ERROR);
|
||||
}else{
|
||||
showMessage(QObject::tr("BIOMETRIC AUTHENTICATION END"), START);
|
||||
exit(BIO_IGNORE);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
bioAuth.startAuth();
|
||||
|
||||
if(!isHiddenSwitchButton){
|
||||
QObject::connect(&watcher, &KeyWatcher::exit, &a, [&]{
|
||||
showMessage(QObject::tr("AUTHENTICATION CANCELED"), START);
|
||||
bioAuth.stopAuth();
|
||||
exit(BIO_IGNORE);
|
||||
});
|
||||
}
|
||||
watcher.start();
|
||||
|
||||
return a.exec();
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
qt5_wrap_ui(BioAuthWidgets_SRC
|
||||
src/bioauthwidget.ui
|
||||
src/biodeviceswidget.ui
|
||||
)
|
||||
|
||||
qt5_wrap_cpp(BioAuth_SRC
|
||||
include/bioauth.h
|
||||
include/biodevices.h
|
||||
)
|
||||
qt5_wrap_cpp(BioAuthWidgets_SRC
|
||||
include/bioauthwidget.h
|
||||
include/biodeviceswidget.h
|
||||
include/giodbus.h
|
||||
include/loginoptionswidget.h
|
||||
)
|
||||
|
||||
set(BioAuth_SRC
|
||||
${BioAuth_SRC}
|
||||
src/bioauth.cpp
|
||||
src/biodevices.cpp
|
||||
src/biotypes.cpp
|
||||
)
|
||||
|
||||
set(BioAuthWidgets_SRC
|
||||
${BioAuthWidgets_SRC}
|
||||
src/bioauthwidget.cpp
|
||||
src/biodeviceswidget.cpp
|
||||
src/giodbus.cpp
|
||||
src/loginoptionswidget.cpp
|
||||
)
|
||||
include_directories(
|
||||
${Qt5Core_INCLUDE_DIRS}
|
||||
${Qt5Widgets_INCLUDE_DIRS}
|
||||
${Qt5DBus_INCLUDE_DIRS}
|
||||
${GLIB2_INCLUDE_DIRS}
|
||||
include
|
||||
../common
|
||||
)
|
||||
add_library(BioAuth STATIC ${BioAuth_SRC})
|
||||
target_link_libraries(BioAuth Qt5::Core Qt5::DBus Qt5::Svg)
|
||||
add_library(BioAuthWidgets STATIC ${BioAuthWidgets_SRC})
|
||||
target_link_libraries(BioAuthWidgets BioAuth Qt5::Widgets ${OpenCV_LIBS} ${GIOUNIX2_LIBRARIES})
|
||||
#add_library(BioAuth OBJECT ${BioAuth_SRC})
|
||||
#add_library(BioAuthWidgets OBJECT ${BioAuth_SRC} ${BioAuthWidgets_SRC})
|
||||
|
||||
file(GLOB ts_files i18n_ts/*.ts)
|
||||
qt5_add_translation(qm_files ${ts_files})
|
||||
add_custom_target(bioauth_i18n DEPENDS ${qm_files} SOURCES ${ts_files})
|
||||
add_dependencies(BioAuth bioauth_i18n)
|
||||
|
||||
install(FILES ${qm_files} DESTINATION ${UKUI_BIOMETRIC_DIR}/i18n_qm)
|
|
@ -0,0 +1,103 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1">
|
||||
<context>
|
||||
<name>BioAuthWidget</name>
|
||||
<message>
|
||||
<location filename="../src/bioauthwidget.ui" line="14"/>
|
||||
<source>Form</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/bioauthwidget.ui" line="146"/>
|
||||
<location filename="../src/bioauthwidget.cpp" line="41"/>
|
||||
<source>Retry</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/bioauthwidget.cpp" line="96"/>
|
||||
<location filename="../src/bioauthwidget.cpp" line="212"/>
|
||||
<source>%1 too many unsuccessful attempts,please enter password.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/bioauthwidget.cpp" line="102"/>
|
||||
<source>%1 authentication failure,there are still %2 remaining opportunities</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/bioauthwidget.cpp" line="226"/>
|
||||
<source>Please use wechat to scan the code</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>BioDevices</name>
|
||||
<message>
|
||||
<location filename="../src/biodevices.cpp" line="63"/>
|
||||
<source>Unplugging of %1 device detected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/biodevices.cpp" line="73"/>
|
||||
<source>%1 device insertion detected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/biodevices.cpp" line="82"/>
|
||||
<source>ukui-biometric-manager</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/biodevices.cpp" line="85"/>
|
||||
<source>biometric</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/biodevices.cpp" line="351"/>
|
||||
<source>FingerPrint</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/biodevices.cpp" line="353"/>
|
||||
<source>FingerVein</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/biodevices.cpp" line="355"/>
|
||||
<source>Iris</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/biodevices.cpp" line="357"/>
|
||||
<source>Face</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/biodevices.cpp" line="359"/>
|
||||
<source>VoicePrint</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/biodevices.cpp" line="361"/>
|
||||
<source>QRCode</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>BioDevicesWidget</name>
|
||||
<message>
|
||||
<location filename="../src/biodeviceswidget.ui" line="14"/>
|
||||
<source>Form</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LoginOptionsWidget</name>
|
||||
<message>
|
||||
<location filename="../src/loginoptionswidget.cpp" line="57"/>
|
||||
<source>Login Options</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
|
@ -0,0 +1,112 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="bo_CN">
|
||||
<context>
|
||||
<name>BioAuthWidget</name>
|
||||
<message>
|
||||
<source>Form</source>
|
||||
<translation>ནས་འོང་བ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>More</source>
|
||||
<translation type="vanished">དེ་ལས་མང་བ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Retry</source>
|
||||
<translation>ཡང་བསྐྱར་ཚོད་ལེན།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Current Device: </source>
|
||||
<translation type="vanished">当前设备:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Password</source>
|
||||
<translation type="vanished">གསང་ཨང་།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TextLabel</source>
|
||||
<translation type="vanished">ཡིག་རྐྱང་ཕྲེང་བ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>%1 too many unsuccessful attempts,please enter password.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>%1 authentication failure,there are still %2 remaining opportunities</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Please use wechat to scan the code</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>BioDevices</name>
|
||||
<message>
|
||||
<source>Face</source>
|
||||
<translation>མིའི་གདོང་།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Iris</source>
|
||||
<translation>འཇའ་སྐྱི།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>biometric</source>
|
||||
<translation>生物特征</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>VoicePrint</source>
|
||||
<translation>སྒྲ་རིས།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unplugging of %1 device detected</source>
|
||||
<translation>检测到%1设备拔出</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>%1 device insertion detected</source>
|
||||
<translation>检测到%1设备插入</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>FingerPrint</source>
|
||||
<translation>མཛུབ་རིས།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>FingerVein</source>
|
||||
<translation>མཛུབ་མོའི་སྡོད་རྩ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ukui-biometric-manager</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>QRCode</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>BioDevicesWidget</name>
|
||||
<message>
|
||||
<source>OK</source>
|
||||
<translation type="vanished">གཏན་འཁེལ་བྱེད་པ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Back</source>
|
||||
<translation type="vanished">ཕྱིར་འཐེན།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Form</source>
|
||||
<translation>ནས་འོང་བ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Device types:</source>
|
||||
<translation type="vanished">设备类型:</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LoginOptionsWidget</name>
|
||||
<message>
|
||||
<source>Login Options</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
|
@ -0,0 +1,108 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="es">
|
||||
<context>
|
||||
<name>BioAuthWidget</name>
|
||||
<message>
|
||||
<source>Form</source>
|
||||
<translation>Formar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TextLabel</source>
|
||||
<translation type="vanished">TextLabel</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>More</source>
|
||||
<translation type="vanished">Más</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Retry</source>
|
||||
<translation>Procesar de nuevo</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Password</source>
|
||||
<translation type="vanished">Contraseña</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>%1 too many unsuccessful attempts,please enter password.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>%1 authentication failure,there are still %2 remaining opportunities</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Please use wechat to scan the code</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>BioDevices</name>
|
||||
<message>
|
||||
<source>FingerPrint</source>
|
||||
<translation>Huella dactilar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>FingerVein</source>
|
||||
<translation>FingerVein</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Iris</source>
|
||||
<translation>Iris</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Face</source>
|
||||
<translation>Cara</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>VoicePrint</source>
|
||||
<translation>Impresión de voz</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unplugging of %1 device detected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>%1 device insertion detected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>biometric</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ukui-biometric-manager</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>QRCode</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>BioDevicesWidget</name>
|
||||
<message>
|
||||
<source>Form</source>
|
||||
<translation>Formar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Device types:</source>
|
||||
<translation type="vanished">Tipos de dispositivos:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Back</source>
|
||||
<translation type="vanished">Espalda</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>OK</source>
|
||||
<translation type="vanished">DE ACUERDO</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LoginOptionsWidget</name>
|
||||
<message>
|
||||
<source>Login Options</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
|
@ -0,0 +1,108 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="fr">
|
||||
<context>
|
||||
<name>BioAuthWidget</name>
|
||||
<message>
|
||||
<source>Form</source>
|
||||
<translation>Forme</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TextLabel</source>
|
||||
<translation type="vanished">TextLabel</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>More</source>
|
||||
<translation type="vanished">Plus</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Retry</source>
|
||||
<translation>Recommencez</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Password</source>
|
||||
<translation type="vanished">Mot de passe</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>%1 too many unsuccessful attempts,please enter password.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>%1 authentication failure,there are still %2 remaining opportunities</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Please use wechat to scan the code</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>BioDevices</name>
|
||||
<message>
|
||||
<source>FingerPrint</source>
|
||||
<translation>Empreinte digitale</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>FingerVein</source>
|
||||
<translation>FingerVein</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Iris</source>
|
||||
<translation>Iris</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Face</source>
|
||||
<translation>Visage</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>VoicePrint</source>
|
||||
<translation>VoicePrint</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unplugging of %1 device detected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>%1 device insertion detected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>biometric</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ukui-biometric-manager</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>QRCode</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>BioDevicesWidget</name>
|
||||
<message>
|
||||
<source>Form</source>
|
||||
<translation>Forme</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Device types:</source>
|
||||
<translation type="vanished">Types d'appareils:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Back</source>
|
||||
<translation type="vanished">Arrière</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>OK</source>
|
||||
<translation type="vanished">D'accord</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LoginOptionsWidget</name>
|
||||
<message>
|
||||
<source>Login Options</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
|
@ -0,0 +1,108 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="pt">
|
||||
<context>
|
||||
<name>BioAuthWidget</name>
|
||||
<message>
|
||||
<source>Form</source>
|
||||
<translation>Formato</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TextLabel</source>
|
||||
<translation type="vanished">TextLabel</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>More</source>
|
||||
<translation type="vanished">Mais</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Retry</source>
|
||||
<translation>Tente novamente</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Password</source>
|
||||
<translation type="vanished">Senha</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>%1 too many unsuccessful attempts,please enter password.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>%1 authentication failure,there are still %2 remaining opportunities</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Please use wechat to scan the code</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>BioDevices</name>
|
||||
<message>
|
||||
<source>FingerPrint</source>
|
||||
<translation>Impressão digital</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>FingerVein</source>
|
||||
<translation>FingerVein</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Iris</source>
|
||||
<translation>Íris</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Face</source>
|
||||
<translation>Cara</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>VoicePrint</source>
|
||||
<translation>VoicePrint</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unplugging of %1 device detected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>%1 device insertion detected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>biometric</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ukui-biometric-manager</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>QRCode</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>BioDevicesWidget</name>
|
||||
<message>
|
||||
<source>Form</source>
|
||||
<translation>Formato</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Device types:</source>
|
||||
<translation type="vanished">Tipos de dispositivos:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Back</source>
|
||||
<translation type="vanished">Costas</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>OK</source>
|
||||
<translation type="vanished">Está bem</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LoginOptionsWidget</name>
|
||||
<message>
|
||||
<source>Login Options</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
|
@ -0,0 +1,108 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="ru">
|
||||
<context>
|
||||
<name>BioAuthWidget</name>
|
||||
<message>
|
||||
<source>Form</source>
|
||||
<translation>форма</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TextLabel</source>
|
||||
<translation type="vanished">TextLabel</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>More</source>
|
||||
<translation type="vanished">Больше</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Retry</source>
|
||||
<translation>Retry</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Password</source>
|
||||
<translation type="vanished">пароль</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>%1 too many unsuccessful attempts,please enter password.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>%1 authentication failure,there are still %2 remaining opportunities</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Please use wechat to scan the code</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>BioDevices</name>
|
||||
<message>
|
||||
<source>FingerPrint</source>
|
||||
<translation>FingerPrint</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>FingerVein</source>
|
||||
<translation>FingerVein</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Iris</source>
|
||||
<translation>Ирис</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Face</source>
|
||||
<translation>Лицо</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>VoicePrint</source>
|
||||
<translation>Voiceprint</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unplugging of %1 device detected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>%1 device insertion detected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>biometric</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ukui-biometric-manager</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>QRCode</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>BioDevicesWidget</name>
|
||||
<message>
|
||||
<source>Form</source>
|
||||
<translation>форма</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Device types:</source>
|
||||
<translation type="vanished">Типы устройств:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Back</source>
|
||||
<translation type="vanished">назад</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>OK</source>
|
||||
<translation type="vanished">ОК</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LoginOptionsWidget</name>
|
||||
<message>
|
||||
<source>Login Options</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
|
@ -0,0 +1,154 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="tr">
|
||||
<context>
|
||||
<name>BioAuthWidget</name>
|
||||
<message>
|
||||
<location filename="../src/bioauthwidget.ui" line="14"/>
|
||||
<source>Form</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>More</source>
|
||||
<translation type="vanished">Daha Fazla</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/bioauthwidget.ui" line="146"/>
|
||||
<location filename="../src/bioauthwidget.cpp" line="41"/>
|
||||
<source>Retry</source>
|
||||
<translation>Yeniden Dene</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Password</source>
|
||||
<translation type="vanished">Parola</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Current Device: </source>
|
||||
<translation type="vanished">Şuanki Aygıt:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/bioauthwidget.cpp" line="96"/>
|
||||
<location filename="../src/bioauthwidget.cpp" line="212"/>
|
||||
<source>%1 too many unsuccessful attempts,please enter password.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/bioauthwidget.cpp" line="102"/>
|
||||
<source>%1 authentication failure,there are still %2 remaining opportunities</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/bioauthwidget.cpp" line="226"/>
|
||||
<source>Please use wechat to scan the code</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>BioDevices</name>
|
||||
<message>
|
||||
<location filename="../src/biodevices.cpp" line="63"/>
|
||||
<source>Unplugging of %1 device detected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/biodevices.cpp" line="73"/>
|
||||
<source>%1 device insertion detected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/biodevices.cpp" line="82"/>
|
||||
<source>ukui-biometric-manager</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/biodevices.cpp" line="85"/>
|
||||
<source>biometric</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/biodevices.cpp" line="351"/>
|
||||
<source>FingerPrint</source>
|
||||
<translation>Parmak İzi</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/biodevices.cpp" line="353"/>
|
||||
<source>FingerVein</source>
|
||||
<translation>Damar İzi</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/biodevices.cpp" line="355"/>
|
||||
<source>Iris</source>
|
||||
<translation>Göz</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/biodevices.cpp" line="357"/>
|
||||
<source>Face</source>
|
||||
<translation>Yüz</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/biodevices.cpp" line="359"/>
|
||||
<source>VoicePrint</source>
|
||||
<translation>Ses İzi</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/biodevices.cpp" line="361"/>
|
||||
<source>QRCode</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>BioDevicesWidget</name>
|
||||
<message>
|
||||
<location filename="../src/biodeviceswidget.ui" line="14"/>
|
||||
<source>Form</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Device types:</source>
|
||||
<translation type="vanished">Aygıt türü:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Back</source>
|
||||
<translation type="vanished">Geri</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>OK</source>
|
||||
<translation type="vanished">Tamam</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>FingerPrint</source>
|
||||
<translation type="vanished">Parmak İzi</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LoginOptionsWidget</name>
|
||||
<message>
|
||||
<location filename="../src/loginoptionswidget.cpp" line="57"/>
|
||||
<source>Login Options</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<source>FingerPrint</source>
|
||||
<translation type="vanished">Parmak İzi</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>FingerVein</source>
|
||||
<translation type="vanished">Damar İzi</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Iris</source>
|
||||
<translation type="vanished">Göz</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Face</source>
|
||||
<translation type="vanished">Yüz</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>VoicePrint</source>
|
||||
<translation type="vanished">Ses İzi</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
|
@ -0,0 +1,175 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="zh_CN">
|
||||
<context>
|
||||
<name>BioAuthWidget</name>
|
||||
<message>
|
||||
<location filename="../src/bioauthwidget.ui" line="14"/>
|
||||
<source>Form</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>More</source>
|
||||
<translation type="vanished">更多</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/bioauthwidget.ui" line="146"/>
|
||||
<location filename="../src/bioauthwidget.cpp" line="41"/>
|
||||
<source>Retry</source>
|
||||
<translation>重试</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Too many unsuccessful attempts,please enter password.</source>
|
||||
<translation type="vanished">验证失败达最大次数,请使用密码解锁</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Bioauth authentication failed, you still have %1 verification opportunities</source>
|
||||
<translation type="vanished">生物认证失败,您还有%1次尝试机会</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Password</source>
|
||||
<translation type="vanished">密码</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Current Device: </source>
|
||||
<translation type="vanished">当前设备:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/bioauthwidget.cpp" line="96"/>
|
||||
<location filename="../src/bioauthwidget.cpp" line="212"/>
|
||||
<source>%1 too many unsuccessful attempts,please enter password.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/bioauthwidget.cpp" line="102"/>
|
||||
<source>%1 authentication failure,there are still %2 remaining opportunities</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/bioauthwidget.cpp" line="226"/>
|
||||
<source>Please use wechat to scan the code</source>
|
||||
<translation>请使用微信扫码</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>BioDevices</name>
|
||||
<message>
|
||||
<location filename="../src/biodevices.cpp" line="63"/>
|
||||
<source>Unplugging of %1 device detected</source>
|
||||
<translation>检测到%1设备拔出</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/biodevices.cpp" line="73"/>
|
||||
<source>%1 device insertion detected</source>
|
||||
<translation>检测到%1设备插入</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/biodevices.cpp" line="82"/>
|
||||
<source>ukui-biometric-manager</source>
|
||||
<translation>生物特征管理工具</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/biodevices.cpp" line="85"/>
|
||||
<source>biometric</source>
|
||||
<translation>生物特征</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/biodevices.cpp" line="351"/>
|
||||
<source>FingerPrint</source>
|
||||
<translation>指纹</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/biodevices.cpp" line="353"/>
|
||||
<source>FingerVein</source>
|
||||
<translation>指静脉</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/biodevices.cpp" line="355"/>
|
||||
<source>Iris</source>
|
||||
<translation>虹膜</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/biodevices.cpp" line="357"/>
|
||||
<source>Face</source>
|
||||
<translation>人脸识别</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/biodevices.cpp" line="359"/>
|
||||
<source>VoicePrint</source>
|
||||
<translation>声纹</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/biodevices.cpp" line="361"/>
|
||||
<source>QRCode</source>
|
||||
<translation>二维码</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Wechat</source>
|
||||
<translation type="vanished">微信</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>BioDevicesWidget</name>
|
||||
<message>
|
||||
<location filename="../src/biodeviceswidget.ui" line="14"/>
|
||||
<source>Form</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Device types:</source>
|
||||
<translation type="vanished">设备类型:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Back</source>
|
||||
<translation type="vanished">返回</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>OK</source>
|
||||
<translation type="vanished">确定</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>FingerPrint</source>
|
||||
<translation type="vanished">指纹</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LoginOptionsWidget</name>
|
||||
<message>
|
||||
<location filename="../src/loginoptionswidget.cpp" line="57"/>
|
||||
<source>Login Options</source>
|
||||
<translation>登录选项</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Wechat</source>
|
||||
<translation type="vanished">微信</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/loginoptionswidget.cpp" line="57"/>
|
||||
<source>Biometric</source>
|
||||
<translation>生物识别</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<source>FingerPrint</source>
|
||||
<translation type="vanished">指纹</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>FingerVein</source>
|
||||
<translation type="vanished">指静脉</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Iris</source>
|
||||
<translation type="vanished">虹膜</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Face</source>
|
||||
<translation type="vanished">人脸</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>VoicePrint</source>
|
||||
<translation type="vanished">声纹</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
**/
|
||||
#ifndef BIOAUTH_H
|
||||
#define BIOAUTH_H
|
||||
|
||||
#include <QObject>
|
||||
#include "biotypes.h"
|
||||
|
||||
class QDBusInterface;
|
||||
|
||||
/*!
|
||||
* \brief The BioAuth class
|
||||
* 负责真正的生物识别操作,通过startAuth开始认证,
|
||||
* 认证完成后会发出携带结果的authComplete信号
|
||||
*/
|
||||
class BioAuth : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit BioAuth(qint32 uid, const DeviceInfoPtr deviceInfo, QObject *parent = nullptr);
|
||||
explicit BioAuth(QObject *parent = nullptr);
|
||||
~BioAuth();
|
||||
void setDevice(const DeviceInfoPtr deviceInfo);
|
||||
void startAuth();
|
||||
void startAuth(qint32 uid, const DeviceInfoPtr deviceInfo);
|
||||
void stopAuth();
|
||||
bool isAuthenticating();
|
||||
void init();
|
||||
|
||||
signals:
|
||||
void authComplete(int uid, bool result, int retErrNo);
|
||||
void notify(const QString &message);
|
||||
void notifyDetail(int deviceId, const QString &message);
|
||||
void frameWritten(int deviceId);
|
||||
|
||||
private slots:
|
||||
void onIdentityComplete(QDBusPendingCallWatcher *watcher);
|
||||
void onStatusChanged(int deviceId, int statusType);
|
||||
void onFrameWritten(int drvid);
|
||||
|
||||
private:
|
||||
QDBusInterface *serviceInterface;
|
||||
|
||||
qint32 uid;
|
||||
DeviceInfoPtr deviceInfo = nullptr;
|
||||
bool isInAuthentication;
|
||||
};
|
||||
|
||||
#endif // BIOAUTH_H
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
**/
|
||||
#ifndef BIOAUTHWIDGET_H
|
||||
#define BIOAUTHWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "bioauth.h"
|
||||
|
||||
namespace Ui {
|
||||
class BioAuthWidget;
|
||||
}
|
||||
|
||||
class BioAuthWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BioAuthWidget(QWidget *parent = 0);
|
||||
~BioAuthWidget();
|
||||
void hidePasswdButton();
|
||||
bool isAuthenticating();
|
||||
|
||||
public slots:
|
||||
void startAuth(uid_t uid, const DeviceInfoPtr device);
|
||||
void setMoreDevices(bool hasMore);
|
||||
void stopAuth();
|
||||
void emitSwithToPassword();
|
||||
signals:
|
||||
void switchToPassword();
|
||||
void selectDevice();
|
||||
void authComplete(uid_t uid, bool ret);
|
||||
|
||||
private slots:
|
||||
void on_btnPasswdAuth_clicked();
|
||||
void on_btnMore_clicked();
|
||||
void on_btnRetry_clicked();
|
||||
|
||||
void onBioAuthNotify(const QString ¬ifyMsg);
|
||||
void onBioAuthComplete(uid_t uid, bool ret, int retErrNo);
|
||||
void onFrameWritten(int deviceId);
|
||||
|
||||
private:
|
||||
void setMovie();
|
||||
void setImage();
|
||||
|
||||
private:
|
||||
Ui::BioAuthWidget *ui;
|
||||
BioAuth *bioAuth;
|
||||
uid_t uid;
|
||||
DeviceInfoPtr device;
|
||||
int fd = -1;
|
||||
int dup_fd = -1;
|
||||
int nMaxFailCnt = 5;
|
||||
public:
|
||||
static int failedCount;
|
||||
};
|
||||
|
||||
#endif // BIOAUTHWIDGET_H
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
**/
|
||||
#ifndef BIODEVICES_H
|
||||
#define BIODEVICES_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QMap>
|
||||
#include <QList>
|
||||
#include "biotypes.h"
|
||||
|
||||
class QDBusInterface;
|
||||
|
||||
#define SHARE_BIOMETRIC_CONFIG_PATH "/var/lib/lightdm-data/%1/ukui-biometric.conf" //greeter、screensaver、polkit share conf
|
||||
|
||||
/*!
|
||||
* \brief The BioDevices class
|
||||
* this class saves the list of all device information
|
||||
* and list of available devices' info list for each uid
|
||||
*/
|
||||
class BioDevices : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit BioDevices(bool isIgnoreQrCode = false, QObject *parent = nullptr);
|
||||
|
||||
int count();
|
||||
QMap<int, QList<DeviceInfo>> getAllDevices();
|
||||
QMap<int, QList<DeviceInfo>> getUserDevices(int uid);
|
||||
QList<DeviceInfo> getDevices(int type);
|
||||
DeviceInfoPtr getDefaultDevice(uid_t uid);
|
||||
int GetLastDevice(const QString &userName);
|
||||
void SetLastDevice(const QString &userName, int drvid);
|
||||
DeviceInfoPtr findDevice(const QString &deviceName);
|
||||
DeviceInfoPtr findDevice(const int id);
|
||||
DeviceInfoPtr getFirstDevice(int uid);
|
||||
DeviceList GetDevList();
|
||||
int getFeatureCount(int uid, int indexStart = 0, int indexEnd = -1);
|
||||
static QString bioTypeToString_tr(int type);
|
||||
void setIsShowHotPlug(bool isShow);
|
||||
int GetUserDevFeatureCount(int uid,int drvid);
|
||||
int GetUserDevCount(int uid);
|
||||
bool getUseFirstDevice();
|
||||
int getFailedTimes();
|
||||
bool GetHiddenSwitchButton();
|
||||
bool GetQRCodeEnable();
|
||||
bool GetBioAuthEnable();
|
||||
/**
|
||||
* @brief UpdateStatus 获取更新的设备状态
|
||||
* @param drvid 驱动id
|
||||
* @return 结果:<int result, int enable, int devNum,
|
||||
* int devStatus, int opsStatus, notifyMessageId, ...>
|
||||
*/
|
||||
StatusReslut UpdateStatus(int drvid);
|
||||
|
||||
private:
|
||||
void connectToService();
|
||||
void getDevicesList();
|
||||
|
||||
signals:
|
||||
void deviceCountChanged(int newNum);
|
||||
|
||||
private slots:
|
||||
void onUSBDeviceHotPlug(int deviceId, int action, int devNumNow);
|
||||
|
||||
private:
|
||||
QDBusInterface *serviceInterface;
|
||||
DeviceList deviceInfos; //the list of al device info
|
||||
bool isShowHotPlug;
|
||||
bool useFirstDevice;
|
||||
bool m_isIgnoreQrCode = false;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // BIODEVICES_H
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
**/
|
||||
#ifndef BIODEVICESWIDGET_H
|
||||
#define BIODEVICESWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "biodevices.h"
|
||||
|
||||
#define UKUI_BIOMETRIC_SYS_CONFIG_PATH "/etc/biometric-auth/ukui-biometric.conf"
|
||||
namespace Ui {
|
||||
class BioDevicesWidget;
|
||||
}
|
||||
|
||||
class BioDevicesWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BioDevicesWidget(QWidget *parent = 0);
|
||||
void setCurrentDevice(DeviceInfoPtr device);
|
||||
~BioDevicesWidget();
|
||||
void init(uid_t uid);
|
||||
enum FLAG{FIRST,AGAIN};
|
||||
signals:
|
||||
void back();
|
||||
void deviceChanged(const DeviceInfo &device);
|
||||
void deviceCountChanged(int count);
|
||||
|
||||
private slots:
|
||||
// void on_btnBack_clicked();
|
||||
// void on_btnOK_clicked();
|
||||
void on_lwDevices_currentIndexChanged();
|
||||
void on_cmbDeviceTypes_currentIndexChanged(int index);
|
||||
|
||||
void onDeviceCountChanged();
|
||||
|
||||
private:
|
||||
Ui::BioDevicesWidget *ui;
|
||||
BioDevices bioDevices;
|
||||
QMap<int, QList<DeviceInfo>> devicesMap;
|
||||
|
||||
uid_t uid;
|
||||
};
|
||||
|
||||
int GetFailedTimes();
|
||||
#endif // BIODEVICESWIDGET_H
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
**/
|
||||
#ifndef BIOMETRIC_H
|
||||
#define BIOMETRIC_H
|
||||
|
||||
#include "bioauth.h"
|
||||
#include "biodevices.h"
|
||||
#include "bioauthwidget.h"
|
||||
#include "biodeviceswidget.h"
|
||||
|
||||
#endif // BIOMETRIC_H
|
|
@ -0,0 +1,116 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
**/
|
||||
#ifndef BIOCUSTOMTYPE_H
|
||||
#define BIOCUSTOMTYPE_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QtDBus>
|
||||
|
||||
#define BIO_DBUS_SERVICE "org.ukui.Biometric"
|
||||
#define BIO_DBUS_PATH "/org/ukui/Biometric"
|
||||
#define BIO_DBUS_INTERFACE "org.ukui.Biometric"
|
||||
|
||||
|
||||
#define DEFAULT_DEVICE "DefaultDevice"
|
||||
|
||||
|
||||
#ifdef LOG
|
||||
#undef LOG
|
||||
#endif
|
||||
#define LOG() qDebug() << "[BIOMETRIC]"
|
||||
|
||||
/* the type of device */
|
||||
enum BioType {
|
||||
BIOTYPE_FINGERPRINT,
|
||||
BIOTYPE_FINGERVEIN,
|
||||
BIOTYPE_IRIS,
|
||||
BIOTYPE_FACE,
|
||||
BIOTYPE_VOICEPRINT,
|
||||
__MAX_NR_BIOTYPES
|
||||
};
|
||||
|
||||
#define REMOTE_QRCODE_TYPE (8)
|
||||
|
||||
/* StatusChanged D-Bus 信号触发时的状态变化类型 */
|
||||
enum StatusType {
|
||||
STATUS_DEVICE,
|
||||
STATUS_OPERATION,
|
||||
STATUS_NOTIFY
|
||||
};
|
||||
|
||||
/* 录入/删除/搜索等 D-Bus 调用的最终结果,即返回值里的 result */
|
||||
enum DBusResult {
|
||||
DBUS_RESULT_SUCCESS = 0,
|
||||
DBUS_RESULT_ERROR,
|
||||
DBUS_RESULT_DEVICEBUSY,
|
||||
DBUS_RESULT_NOSUCHDEVICE,
|
||||
DBUS_RESULT_PERMISSIONDENIED
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief UpdateStauts调用返回的结果
|
||||
*/
|
||||
struct StatusReslut
|
||||
{
|
||||
int result;
|
||||
int enable;
|
||||
int devNum;
|
||||
int devStatus;
|
||||
int opsStatus;
|
||||
int notifyMessageId;
|
||||
};
|
||||
|
||||
/* the info of device */
|
||||
struct DeviceInfo {
|
||||
int device_id;
|
||||
QString device_shortname; /* aka driverName */
|
||||
QString device_fullname;
|
||||
int driver_enable; /* The corresponding driver is enabled/disabled */
|
||||
int device_available; /* The driver is enabled and the device is connected */
|
||||
int biotype;
|
||||
int stotype;
|
||||
int eigtype;
|
||||
int vertype;
|
||||
int idtype;
|
||||
int bustype;
|
||||
int dev_status;
|
||||
int ops_status;
|
||||
|
||||
bool operator==(const DeviceInfo&) const;
|
||||
|
||||
bool operator !=(const DeviceInfo &deviceInfo) const
|
||||
{
|
||||
return !(*this == deviceInfo);
|
||||
}
|
||||
friend QDebug& operator<<(QDebug &stream, const DeviceInfo &deviceInfo);
|
||||
|
||||
};
|
||||
Q_DECLARE_METATYPE(DeviceInfo)
|
||||
|
||||
typedef std::shared_ptr<DeviceInfo> DeviceInfoPtr;
|
||||
typedef QList<DeviceInfoPtr> DeviceList;
|
||||
typedef QMap<int, DeviceList> DeviceMap;
|
||||
|
||||
QDBusArgument &operator<<(QDBusArgument &argument, const DeviceInfo &deviceInfo);
|
||||
const QDBusArgument &operator>>(const QDBusArgument &argument, DeviceInfo &deviceInfo);
|
||||
QDebug operator <<(QDebug stream, const DeviceInfo &deviceInfo);
|
||||
|
||||
QString bioTypeToString(int type);
|
||||
|
||||
|
||||
#endif // BIOCUSTOMTYPE_H
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef GIODBUS_H
|
||||
#define GIODBUS_H
|
||||
|
||||
int get_server_gvariant_stdout(int drvid);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,138 @@
|
|||
#ifndef LOGINOPTIONSWIDGET_H
|
||||
#define LOGINOPTIONSWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QMap>
|
||||
#include "bioauth.h"
|
||||
#include "biodevices.h"
|
||||
|
||||
class QLabel;
|
||||
class QButtonGroup;
|
||||
class QHBoxLayout;
|
||||
class QVBoxLayout;
|
||||
class QToolButton;
|
||||
class QTimer;
|
||||
|
||||
enum LOGINOPT_TYPE {
|
||||
LOGINOPT_TYPE_PASSWORD = 0, // 密码
|
||||
LOGINOPT_TYPE_FACE, // 人脸
|
||||
LOGINOPT_TYPE_FINGERPRINT, // 指纹
|
||||
LOGINOPT_TYPE_IRIS, // 虹膜
|
||||
LOGINOPT_TYPE_VOICEPRINT, // 声纹
|
||||
LOGINOPT_TYPE_FINGERVEIN, // 指静脉
|
||||
LOGINOPT_TYPE_QRCODE, // 二维码
|
||||
LOGINOPT_TYPE_OTHERS, // 其他
|
||||
LOGINOPT_TYPE_COUNT
|
||||
};
|
||||
|
||||
class LoginOptionsWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit LoginOptionsWidget(QWidget *parent = nullptr);
|
||||
virtual ~LoginOptionsWidget();
|
||||
|
||||
bool getCurLoginOpt(int& nLoginOptType, int& nDrvId);
|
||||
unsigned getLoginOptCount();
|
||||
DeviceInfoPtr getFirstDevInfo();
|
||||
int convertDeviceType(int nDevType);
|
||||
void updateUIStatus(bool update);
|
||||
void setUser(int uid);
|
||||
void setCurrentDevice(int drvid);
|
||||
void setCurrentDevice(const QString &deviceName);
|
||||
void setCurrentDevice(const DeviceInfoPtr &pDeviceInfo);
|
||||
DeviceInfoPtr findDeviceById(int drvid);
|
||||
DeviceInfoPtr findDeviceByName(const QString &name);
|
||||
void setDeviceDisable(int nDevId, bool bDisable = true);
|
||||
bool isDeviceDisable(int nDevId);
|
||||
|
||||
/**
|
||||
* @brief 获取默认设备
|
||||
* @return
|
||||
*/
|
||||
QString GetDefaultDevice(uid_t uid);
|
||||
|
||||
/**
|
||||
* @brief 进行生物识别认证
|
||||
* @param deviceInfo 使用的设备
|
||||
* @param uid 待认证的用户id
|
||||
*/
|
||||
void startAuth(DeviceInfoPtr device, int uid);
|
||||
|
||||
/**
|
||||
* @brief 终止生物识别认证
|
||||
*/
|
||||
void stopAuth();
|
||||
|
||||
/**
|
||||
* @brief 是否正在认证
|
||||
* @return
|
||||
*/
|
||||
bool isAuthenticating() {
|
||||
return m_isInAuth;
|
||||
}
|
||||
|
||||
public slots:
|
||||
void readDevicesInfo();
|
||||
void onIdentifyComplete(int uid, bool ret, int retErrNo);
|
||||
void onStatusChanged(int drvid, const QString &message);
|
||||
void onFrameWritten(int drvid);
|
||||
void onUSBDeviceCountChange(int newNum);
|
||||
void onOptionSelected(int nIndex);
|
||||
void setQRCodeMsg(QString strMsg);
|
||||
void setQRCode(QImage& imgQRCode);
|
||||
void setFaceImg(QImage& imgFace, int nStatus = 0);
|
||||
|
||||
signals:
|
||||
void notifyOptionsChange(unsigned uOptionsCount);
|
||||
void optionSelected(unsigned uLoginOptType, const DeviceInfoPtr &deviceInfo);
|
||||
void updateImage(QImage img);
|
||||
// nStatus -1 dbus错误,0 无错误,1 超时,2 其他错误
|
||||
void authComplete(uid_t uid, bool bResult, int nStatus);
|
||||
void updateAuthMsg(QString strMsg);
|
||||
void updateWndSize(unsigned uLoginOptType, unsigned uLoginOptSize);
|
||||
|
||||
private:
|
||||
void initUI();
|
||||
void initConnections();
|
||||
void addOptionButton(unsigned uLoginOptType, int nDrvId, QString strDrvName);
|
||||
void clearOptionButtons();
|
||||
void updateOptionButtons();
|
||||
void startAuth_();
|
||||
bool getAuthDouble();
|
||||
QPixmap PixmapToRound(const QPixmap &src, int radius);
|
||||
QPixmap scaledPixmap(int width, int height, QString url);
|
||||
QPixmap loadSvg(QString path, QString color, int size);
|
||||
QPixmap drawSymbolicColoredPixmap(QPixmap &source, QString cgColor);
|
||||
|
||||
private:
|
||||
BioAuth *m_biomericProxy = nullptr;
|
||||
BioDevices *m_bioDevices = nullptr;
|
||||
DeviceMap m_mapDevices;
|
||||
unsigned m_curLoginOptType = LOGINOPT_TYPE_PASSWORD;
|
||||
int m_uid = -1;
|
||||
QString m_strUserName;
|
||||
DeviceInfoPtr m_curDevInfo = nullptr; // 当前选择的设备信息
|
||||
int m_dupFD = -1; // 透传的图像文件句柄
|
||||
bool m_isInAuth; // 是否正在验证
|
||||
bool m_isStopped; // 是否被强制终止
|
||||
QTimer *m_retrytimer = nullptr; // 重试定时器
|
||||
|
||||
// UI
|
||||
QVBoxLayout *m_layoutMain = nullptr;
|
||||
QHBoxLayout *m_layoutOptBtns = nullptr;
|
||||
QHBoxLayout *m_layoutImage = nullptr;
|
||||
|
||||
QLabel *m_labelOptTitle = nullptr;
|
||||
QButtonGroup *m_btnGroup = nullptr;
|
||||
QList<int> m_listDriveId;
|
||||
QMap<int, QToolButton*> m_mapOptBtns;
|
||||
QWidget *m_widgetImage = nullptr;
|
||||
QLabel *m_labelFace = nullptr;
|
||||
QLabel *m_labelQRCode = nullptr; // 二维码图标
|
||||
QLabel *m_labelQRCodeMsg = nullptr; // 二维码状态消息提示
|
||||
QLabel *m_labelQRCodeTip = nullptr;
|
||||
QMap<int, QMap<int,bool>> m_mapDisableDev;
|
||||
};
|
||||
|
||||
#endif // LOGINOPTIONSWIDGET_H
|
|
@ -0,0 +1,162 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
**/
|
||||
#include "bioauth.h"
|
||||
#include <QList>
|
||||
|
||||
BioAuth::BioAuth(qint32 uid, const DeviceInfoPtr deviceInfo, QObject *parent)
|
||||
: QObject(parent),
|
||||
uid(uid),
|
||||
deviceInfo(deviceInfo),
|
||||
isInAuthentication(false)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
BioAuth::BioAuth(QObject *parent)
|
||||
: QObject(parent)
|
||||
, isInAuthentication(false)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
void BioAuth::init()
|
||||
{
|
||||
serviceInterface = new QDBusInterface(BIO_DBUS_SERVICE,
|
||||
BIO_DBUS_PATH,
|
||||
BIO_DBUS_INTERFACE,
|
||||
QDBusConnection::systemBus());
|
||||
|
||||
connect(serviceInterface, SIGNAL(StatusChanged(int, int)),
|
||||
this, SLOT(onStatusChanged(int,int)));
|
||||
|
||||
connect(serviceInterface, SIGNAL(FrameWritten(int)),
|
||||
this, SLOT(onFrameWritten(int)));
|
||||
|
||||
serviceInterface->setTimeout(2147483647);
|
||||
}
|
||||
|
||||
BioAuth::~BioAuth()
|
||||
{
|
||||
// stopAuth();
|
||||
}
|
||||
|
||||
void BioAuth::setDevice(const DeviceInfoPtr deviceInfo)
|
||||
{
|
||||
this->deviceInfo = deviceInfo;
|
||||
}
|
||||
|
||||
void BioAuth::startAuth()
|
||||
{
|
||||
// stopAuth();
|
||||
if (!deviceInfo) {
|
||||
qDebug()<<"DeviceInfo not valid!!";
|
||||
return;
|
||||
}
|
||||
|
||||
/* 开始认证识别 */
|
||||
LOG() << "start biometric verification";
|
||||
QList<QVariant> args;
|
||||
args << QVariant(deviceInfo->device_id) << QVariant(uid)
|
||||
<< QVariant(0) << QVariant(-1);
|
||||
isInAuthentication = true;
|
||||
|
||||
QDBusPendingCall call = serviceInterface->asyncCallWithArgumentList("Identify", args);
|
||||
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call, this);
|
||||
connect(watcher, &QDBusPendingCallWatcher::finished, this, &BioAuth::onIdentityComplete);
|
||||
}
|
||||
|
||||
void BioAuth::startAuth(qint32 uid, const DeviceInfoPtr deviceInfo)
|
||||
{
|
||||
if (!deviceInfo) {
|
||||
return ;
|
||||
}
|
||||
this->uid = uid;
|
||||
this->deviceInfo = deviceInfo;
|
||||
startAuth();
|
||||
}
|
||||
|
||||
void BioAuth::stopAuth()
|
||||
{
|
||||
if(!isInAuthentication)
|
||||
return ;
|
||||
|
||||
if (!deviceInfo) {
|
||||
qDebug()<<"DeviceInfo not valid!!";
|
||||
return;
|
||||
}
|
||||
|
||||
QDBusReply<int> reply = serviceInterface->call("StopOps", QVariant(deviceInfo->device_id), QVariant(3000));
|
||||
|
||||
if(!reply.isValid())
|
||||
qWarning() << "StopOps error: " << reply.error();
|
||||
|
||||
isInAuthentication = false;
|
||||
}
|
||||
|
||||
bool BioAuth::isAuthenticating()
|
||||
{
|
||||
return isInAuthentication;
|
||||
}
|
||||
|
||||
void BioAuth::onIdentityComplete(QDBusPendingCallWatcher *watcher)
|
||||
{
|
||||
QDBusPendingReply<qint32, qint32> reply = *watcher;
|
||||
if(reply.isError()){
|
||||
isInAuthentication = false;
|
||||
LOG() << reply.error();
|
||||
Q_EMIT authComplete(-1, false, -1);
|
||||
return;
|
||||
}
|
||||
qint32 result = reply.argumentAt(0).toInt();
|
||||
qint32 retUid = reply.argumentAt(1).toInt();
|
||||
LOG() << "Identify complete: " << result << " " << retUid << " " << uid;
|
||||
|
||||
/* 识别生物特征成功,发送认证结果 */
|
||||
if(isInAuthentication){
|
||||
|
||||
isInAuthentication = false;
|
||||
|
||||
if(result == DBUS_RESULT_SUCCESS && retUid == uid){
|
||||
Q_EMIT authComplete(retUid, true, result);
|
||||
}else {
|
||||
Q_EMIT authComplete(uid, false, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BioAuth::onFrameWritten(int deviceId)
|
||||
{
|
||||
Q_EMIT frameWritten(deviceId);
|
||||
}
|
||||
|
||||
void BioAuth::onStatusChanged(int deviceId, int statusType)
|
||||
{
|
||||
if(statusType != STATUS_NOTIFY)
|
||||
return;
|
||||
LOG() << "status changed " << deviceId << " " << statusType;
|
||||
QDBusMessage msg = serviceInterface->call("GetNotifyMesg", QVariant(deviceId));
|
||||
if(msg.type() == QDBusMessage::ErrorMessage){
|
||||
LOG() << msg.errorMessage();
|
||||
return;
|
||||
}
|
||||
QString message = msg.arguments().at(0).toString();
|
||||
LOG() << message;
|
||||
Q_EMIT notify(message);
|
||||
Q_EMIT notifyDetail(deviceId, message);
|
||||
}
|
||||
|
|
@ -0,0 +1,238 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
**/
|
||||
#include "bioauthwidget.h"
|
||||
#include "ui_bioauthwidget.h"
|
||||
#include <QMovie>
|
||||
#include "generic.h"
|
||||
#include <unistd.h>
|
||||
#include <pwd.h>
|
||||
#include "giodbus.h"
|
||||
#include <opencv2/core/core.hpp>
|
||||
#include <opencv2/imgproc/imgproc.hpp>
|
||||
#include <opencv2/highgui/highgui.hpp>
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include "biodeviceswidget.h"
|
||||
|
||||
int BioAuthWidget::failedCount = 0;
|
||||
BioAuthWidget::BioAuthWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::BioAuthWidget),
|
||||
bioAuth(nullptr)
|
||||
{
|
||||
nMaxFailCnt = GetFailedTimes();
|
||||
ui->setupUi(this);
|
||||
ui->btnRetry->setFlat(true);
|
||||
ui->btnRetry->setVisible(false);
|
||||
ui->btnRetry->setText(tr("Retry"));
|
||||
//ui->btnMore->setVisible(false);
|
||||
}
|
||||
|
||||
BioAuthWidget::~BioAuthWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void BioAuthWidget::emitSwithToPassword()
|
||||
{
|
||||
Q_EMIT switchToPassword();
|
||||
}
|
||||
|
||||
void BioAuthWidget::on_btnPasswdAuth_clicked()
|
||||
{
|
||||
stopAuth();
|
||||
//Q_EMIT switchToPassword();
|
||||
QTimer::singleShot(100,this,SLOT(emitSwithToPassword()));
|
||||
}
|
||||
|
||||
void BioAuthWidget::on_btnMore_clicked()
|
||||
{
|
||||
Q_EMIT selectDevice();
|
||||
}
|
||||
|
||||
void BioAuthWidget::on_btnRetry_clicked()
|
||||
{
|
||||
if(bioAuth && !bioAuth->isAuthenticating()) {
|
||||
setMovie();
|
||||
bioAuth->startAuth();
|
||||
}
|
||||
}
|
||||
|
||||
void BioAuthWidget::onBioAuthNotify(const QString ¬ifyMsg)
|
||||
{
|
||||
ui->lblBioNotify->setText(notifyMsg);
|
||||
}
|
||||
|
||||
void BioAuthWidget::onBioAuthComplete(uid_t uid, bool ret, int retErrNo)
|
||||
{
|
||||
if (!device)
|
||||
return ;
|
||||
if (ret == true)
|
||||
{
|
||||
BioAuthWidget::failedCount = 0;
|
||||
}else{
|
||||
BioAuthWidget::failedCount++;
|
||||
}
|
||||
|
||||
setImage();
|
||||
dup_fd = -1;
|
||||
if(BioAuthWidget::failedCount >= nMaxFailCnt)
|
||||
{
|
||||
// ui->lblBioWarnNotify->setText(tr("Too many unsuccessful attempts,please enter password."));
|
||||
ui->lblBioWarnNotify->setText(tr("%1 too many unsuccessful attempts,please enter password.").arg(BioDevices::bioTypeToString_tr(device->biotype)));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->btnRetry->setVisible(true);
|
||||
// ui->lblBioWarnNotify->setText(tr("Authentication failure,there are still %1 remaining opportunities").arg(nMaxFailCnt - BioAuthWidget::failedCount));
|
||||
ui->lblBioWarnNotify->setText(tr("%1 authentication failure,there are still %2 remaining opportunities").arg(BioDevices::bioTypeToString_tr(device->biotype)).arg(nMaxFailCnt - BioAuthWidget::failedCount));
|
||||
}
|
||||
|
||||
Q_EMIT authComplete(uid, ret);
|
||||
}
|
||||
|
||||
void BioAuthWidget::setMovie()
|
||||
{
|
||||
if(!device || device->biotype == BIOTYPE_FACE)
|
||||
return ;
|
||||
|
||||
QString typeString = bioTypeToString(device->biotype);
|
||||
QString moviePath = QString("%1/images/%2.gif").arg(GET_STR(UKUI_BIOMETRIC)).arg(typeString);
|
||||
QMovie *movie = new QMovie(moviePath);
|
||||
movie->setScaledSize(QSize(ui->lblBioImage->width(), ui->lblBioImage->height()));
|
||||
|
||||
ui->lblBioImage->setMovie(movie);
|
||||
movie->start();
|
||||
|
||||
ui->btnRetry->setVisible(false);
|
||||
|
||||
qDebug() << "set movie " << moviePath;
|
||||
}
|
||||
|
||||
void BioAuthWidget::setImage()
|
||||
{
|
||||
if(!device || device->biotype == BIOTYPE_FACE)
|
||||
return ;
|
||||
QString typeString = bioTypeToString(device->biotype);
|
||||
QString pixmapPath = QString("%1/images/%2.png").arg(GET_STR(UKUI_BIOMETRIC)).arg(typeString);
|
||||
QPixmap pixmap(pixmapPath);
|
||||
pixmap = pixmap.scaled(ui->lblBioImage->width(), ui->lblBioImage->height(),
|
||||
Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||
ui->lblBioImage->setPixmap(pixmap);
|
||||
|
||||
if(BioAuthWidget::failedCount >= nMaxFailCnt)
|
||||
{
|
||||
ui->btnRetry->setVisible(false);
|
||||
}
|
||||
else{
|
||||
ui->btnRetry->setVisible(true);
|
||||
}
|
||||
|
||||
qDebug() << "set pixmap " << typeString;
|
||||
}
|
||||
|
||||
void BioAuthWidget::onFrameWritten(int deviceId)
|
||||
{
|
||||
if(dup_fd == -1){
|
||||
dup_fd = get_server_gvariant_stdout(deviceId);
|
||||
}
|
||||
|
||||
cv::Mat img;
|
||||
lseek(dup_fd, 0, SEEK_SET);
|
||||
char base64_bufferData[1024*1024];
|
||||
int rc = read(dup_fd, base64_bufferData, 1024*1024);
|
||||
printf("rc = %d\n", rc);
|
||||
|
||||
cv::Mat mat2(1, sizeof(base64_bufferData), CV_8U, base64_bufferData);
|
||||
img = cv::imdecode(mat2, cv::IMREAD_COLOR);
|
||||
cv::cvtColor(img,img,cv::COLOR_BGR2RGB);
|
||||
|
||||
QImage srcQImage = QImage((uchar*)(img.data), img.cols, img.rows, QImage::Format_RGB888);
|
||||
ui->lblBioImage->setPixmap(QPixmap::fromImage(srcQImage).scaled(ui->lblBioImage->size()));
|
||||
|
||||
ui->btnRetry->setVisible(false);
|
||||
}
|
||||
|
||||
void BioAuthWidget::hidePasswdButton()
|
||||
{
|
||||
//ui->btnPasswdAuth->hide();
|
||||
}
|
||||
|
||||
bool BioAuthWidget::isAuthenticating()
|
||||
{
|
||||
if(bioAuth){
|
||||
return bioAuth->isAuthenticating();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void BioAuthWidget::stopAuth()
|
||||
{
|
||||
if(bioAuth){
|
||||
bioAuth->stopAuth();
|
||||
}
|
||||
}
|
||||
|
||||
void BioAuthWidget::startAuth(uid_t uid, const DeviceInfoPtr device)
|
||||
{
|
||||
if (!device) {
|
||||
qDebug()<<"Device is invalid!!";
|
||||
return ;
|
||||
}
|
||||
this->uid = uid;
|
||||
this->device = device;
|
||||
|
||||
//ui->lblBioDevice->setText(tr("Current Device: ") + device.device_shortname);
|
||||
|
||||
if(bioAuth) {
|
||||
bioAuth->stopAuth();
|
||||
delete bioAuth;
|
||||
bioAuth = nullptr;
|
||||
}
|
||||
|
||||
setMovie();
|
||||
|
||||
if(BioAuthWidget::failedCount >= nMaxFailCnt)
|
||||
{
|
||||
// ui->lblBioWarnNotify->setText(tr("Too many unsuccessful attempts,please enter password."));
|
||||
ui->lblBioWarnNotify->setText(tr("%1 too many unsuccessful attempts,please enter password.").arg(BioDevices::bioTypeToString_tr(device->biotype)));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->lblBioWarnNotify->setText("");
|
||||
}
|
||||
|
||||
bioAuth = new BioAuth(uid, device, this);
|
||||
connect(bioAuth, &BioAuth::notify, this, &BioAuthWidget::onBioAuthNotify);
|
||||
connect(bioAuth, &BioAuth::authComplete, this, &BioAuthWidget::onBioAuthComplete);
|
||||
connect(bioAuth, &BioAuth::frameWritten,this,&BioAuthWidget::onFrameWritten);
|
||||
|
||||
if (device->biotype == REMOTE_QRCODE_TYPE) {
|
||||
onBioAuthNotify(tr("Please use wechat to scan the code"));
|
||||
}
|
||||
|
||||
dup_fd = -1;
|
||||
fd = -1;
|
||||
bioAuth->startAuth();
|
||||
|
||||
}
|
||||
|
||||
void BioAuthWidget::setMoreDevices(bool hasMore)
|
||||
{
|
||||
//ui->btnMore->setVisible(hasMore);
|
||||
}
|
|
@ -0,0 +1,171 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>BioAuthWidget</class>
|
||||
<widget class="QWidget" name="BioAuthWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>404</width>
|
||||
<height>282</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<property name="topMargin">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<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>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblBioImage">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>130</width>
|
||||
<height>130</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>128</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<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>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblBioWarnNotify">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblBioNotify">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="bottomMargin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnRetry">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton:hover{border:none;color:#3E6CE5;}QPushButton:pressed{border:none;}
|
||||
QPushButton{font-size:14px;}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Retry</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<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>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -0,0 +1,447 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
**/
|
||||
#include "biodevices.h"
|
||||
#include <QDBusInterface>
|
||||
#include <QSettings>
|
||||
#include <QFile>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <pwd.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "generic.h"
|
||||
|
||||
|
||||
BioDevices::BioDevices(bool isIgnoreQrCode, QObject *parent)
|
||||
: QObject(parent),
|
||||
isShowHotPlug(false),
|
||||
useFirstDevice(false),
|
||||
m_isIgnoreQrCode(isIgnoreQrCode)
|
||||
{
|
||||
connectToService();
|
||||
getDevicesList();
|
||||
|
||||
useFirstDevice = getUseFirstDevice();
|
||||
}
|
||||
|
||||
void BioDevices::connectToService()
|
||||
{
|
||||
qRegisterMetaType<DeviceInfo>();
|
||||
qDBusRegisterMetaType<DeviceInfo>();
|
||||
|
||||
serviceInterface = new QDBusInterface(BIO_DBUS_SERVICE,
|
||||
BIO_DBUS_PATH,
|
||||
BIO_DBUS_INTERFACE,
|
||||
QDBusConnection::systemBus());
|
||||
|
||||
connect(serviceInterface, SIGNAL(USBDeviceHotPlug(int, int, int)),
|
||||
this, SLOT(onUSBDeviceHotPlug(int,int,int)));
|
||||
serviceInterface->setTimeout(2147483647);
|
||||
}
|
||||
|
||||
void BioDevices::onUSBDeviceHotPlug(int deviceId, int action, int devNumNow)
|
||||
{
|
||||
qDebug() << deviceId << action << devNumNow;
|
||||
QString text = "";
|
||||
if(action == -1){
|
||||
DeviceInfoPtr device = findDevice(deviceId);
|
||||
if(device)
|
||||
text = tr("Unplugging of %1 device detected").arg(bioTypeToString_tr(device->biotype));
|
||||
}
|
||||
|
||||
getDevicesList();
|
||||
|
||||
emit deviceCountChanged(deviceInfos.size());
|
||||
|
||||
if(action == 1){
|
||||
DeviceInfoPtr device = findDevice(deviceId);
|
||||
if(device)
|
||||
text = tr("%1 device insertion detected").arg(bioTypeToString_tr(device->biotype));
|
||||
}
|
||||
|
||||
if(isShowHotPlug && text != ""){
|
||||
QDBusInterface iface("org.freedesktop.Notifications",
|
||||
"/org/freedesktop/Notifications",
|
||||
"org.freedesktop.Notifications",
|
||||
QDBusConnection::sessionBus());
|
||||
QList<QVariant> args;
|
||||
args<<(tr("ukui-biometric-manager"))
|
||||
<<((unsigned int) 0)
|
||||
<<"biometric-manager"
|
||||
<<tr("biometric")
|
||||
<<text
|
||||
<<QStringList()
|
||||
<<QVariantMap()
|
||||
<<(int)-1;
|
||||
iface.callWithArgumentList(QDBus::AutoDetect,"Notify",args);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取设备列表
|
||||
*/
|
||||
void BioDevices::getDevicesList()
|
||||
{
|
||||
/* 返回值为 i -- int 和 av -- array of variant */
|
||||
QDBusMessage msg = serviceInterface->call("GetDevList");
|
||||
if(msg.type() == QDBusMessage::ErrorMessage){
|
||||
LOG() << msg.errorMessage();
|
||||
return;
|
||||
}
|
||||
/* 设备数量 */
|
||||
int deviceNum = msg.arguments().at(0).toInt();
|
||||
bool bEnableBioAuth = GetBioAuthEnable();
|
||||
|
||||
/* 读取设备详细信息,并存储到列表中 */
|
||||
QDBusArgument argument = msg.arguments().at(1).value<QDBusArgument>();
|
||||
QList<QVariant> infos;
|
||||
argument >> infos;
|
||||
|
||||
deviceInfos.clear();
|
||||
|
||||
for(int i = 0; i < deviceNum; i++) {
|
||||
DeviceInfoPtr pDeviceInfo = std::make_shared<DeviceInfo>();
|
||||
infos.at(i).value<QDBusArgument>() >> *pDeviceInfo;
|
||||
|
||||
if(pDeviceInfo->device_available > 0) { //设备可用
|
||||
if (pDeviceInfo->biotype == REMOTE_QRCODE_TYPE && m_isIgnoreQrCode)
|
||||
continue;
|
||||
if (!bEnableBioAuth && pDeviceInfo->biotype <= BIOTYPE_VOICEPRINT)
|
||||
continue;
|
||||
deviceInfos.push_back(pDeviceInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int BioDevices::count()
|
||||
{
|
||||
return deviceInfos.size();
|
||||
}
|
||||
|
||||
int BioDevices::GetUserDevCount(int uid)
|
||||
{
|
||||
int count = 0;
|
||||
QDBusMessage msg = serviceInterface->call("GetDevList");
|
||||
if(msg.type() == QDBusMessage::ErrorMessage){
|
||||
LOG() << msg.errorMessage();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int deviceNum = msg.arguments().at(0).toInt();
|
||||
|
||||
QDBusArgument argument = msg.arguments().at(1).value<QDBusArgument>();
|
||||
QList<QVariant> infos;
|
||||
argument >> infos;
|
||||
|
||||
for(int i = 0; i < deviceNum; i++) {
|
||||
DeviceInfoPtr pDeviceInfo = std::make_shared<DeviceInfo>();
|
||||
infos.at(i).value<QDBusArgument>() >> *pDeviceInfo;
|
||||
if(pDeviceInfo->device_available > 0 && GetUserDevFeatureCount(uid,pDeviceInfo->device_id)>0) //设备可用
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
|
||||
}
|
||||
|
||||
int BioDevices::GetUserDevFeatureCount(int uid,int drvid)
|
||||
{
|
||||
// stop last option
|
||||
serviceInterface->call("StopOps", QVariant(drvid), QVariant(3000));
|
||||
QDBusMessage FeatureResult = serviceInterface->call(QStringLiteral("GetFeatureList"),drvid,uid,0,-1);
|
||||
if(FeatureResult.type() == QDBusMessage::ErrorMessage)
|
||||
{
|
||||
qWarning() << "GetFeatureList error:" << FeatureResult.errorMessage();
|
||||
return 0;
|
||||
}
|
||||
return FeatureResult.arguments().takeFirst().toInt();
|
||||
}
|
||||
|
||||
int BioDevices::getFeatureCount(int uid, int indexStart, int indexEnd)
|
||||
{
|
||||
int res = 0;
|
||||
for(int i = 0; i < deviceInfos.count(); i++) {
|
||||
DeviceInfoPtr deviceInfo = deviceInfos.at(i);
|
||||
QDBusReply<int> reply = serviceInterface->call("StopOps", QVariant(deviceInfo->device_id), QVariant(3000));
|
||||
QDBusMessage featurecount = serviceInterface->call("GetFeatureList",deviceInfo->device_id,uid,indexStart,indexEnd);
|
||||
if(featurecount.type() == QDBusMessage::ErrorMessage)
|
||||
{
|
||||
qWarning() << "GetFeatureList error:" << featurecount.errorMessage();
|
||||
}else{
|
||||
res += featurecount.arguments().takeFirst().toInt();
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
QMap<int, QList<DeviceInfo>> BioDevices::getAllDevices()
|
||||
{
|
||||
QMap<int, QList<DeviceInfo>> devices;
|
||||
|
||||
for(auto deviceInfo : deviceInfos) {
|
||||
if (deviceInfo->biotype == REMOTE_QRCODE_TYPE) // 终端不使用扫码
|
||||
continue;
|
||||
devices[deviceInfo->biotype].push_back(*deviceInfo);
|
||||
}
|
||||
|
||||
return devices;
|
||||
}
|
||||
|
||||
QMap<int, QList<DeviceInfo>> BioDevices::getUserDevices(int uid)
|
||||
{
|
||||
QMap<int, QList<DeviceInfo>> devices;
|
||||
bool isQRCodeEnable = GetQRCodeEnable();
|
||||
for(auto deviceInfo : deviceInfos) {
|
||||
if(GetUserDevFeatureCount(uid,deviceInfo->device_id) > 0) {
|
||||
if (!isQRCodeEnable && deviceInfo->biotype == REMOTE_QRCODE_TYPE) // 关闭了二维码功能
|
||||
continue;
|
||||
devices[deviceInfo->biotype].push_back(*deviceInfo);
|
||||
}
|
||||
}
|
||||
|
||||
return devices;
|
||||
}
|
||||
|
||||
QList<DeviceInfo> BioDevices::getDevices(int type)
|
||||
{
|
||||
QList<DeviceInfo> devices;
|
||||
|
||||
for(auto deviceInfo : deviceInfos) {
|
||||
if (deviceInfo->biotype == type)
|
||||
devices.push_back(*deviceInfo);
|
||||
}
|
||||
|
||||
return devices;
|
||||
}
|
||||
|
||||
void BioDevices::setIsShowHotPlug(bool isShow)
|
||||
{
|
||||
isShowHotPlug = isShow;
|
||||
}
|
||||
|
||||
bool BioDevices::getUseFirstDevice()
|
||||
{
|
||||
QSettings settings("/etc/biometric-auth/ukui-biometric.conf", QSettings::IniFormat);
|
||||
return settings.value("UseFirstDevice").toBool();
|
||||
}
|
||||
|
||||
bool BioDevices::GetHiddenSwitchButton()
|
||||
{
|
||||
QSettings sysSettings("/etc/biometric-auth/ukui-biometric.conf", QSettings::IniFormat);
|
||||
if(sysSettings.contains("HiddenSwitchButton"))
|
||||
return sysSettings.value("HiddenSwitchButton").toBool();
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
int BioDevices::getFailedTimes()
|
||||
{
|
||||
QSettings sysSettings("/etc/biometric-auth/ukui-biometric.conf", QSettings::IniFormat);
|
||||
if(sysSettings.contains("MaxFailedTimes"))
|
||||
return sysSettings.value("MaxFailedTimes").toInt();
|
||||
else
|
||||
return 3;
|
||||
}
|
||||
|
||||
bool BioDevices::GetQRCodeEnable()
|
||||
{
|
||||
bool isEnable = false;
|
||||
QSettings sysSettings("/etc/biometric-auth/ukui-biometric.conf", QSettings::IniFormat);
|
||||
sysSettings.beginGroup("Functions");
|
||||
if (sysSettings.allKeys().contains("EnableQRCode")) {
|
||||
isEnable = sysSettings.value("EnableQRCode").toBool();
|
||||
}
|
||||
sysSettings.endGroup();
|
||||
return isEnable;
|
||||
}
|
||||
|
||||
bool BioDevices::GetBioAuthEnable()
|
||||
{
|
||||
bool isEnable = false;
|
||||
QSettings sysSettings("/etc/biometric-auth/ukui-biometric.conf", QSettings::IniFormat);
|
||||
if (sysSettings.allKeys().contains("EnableAuth")) {
|
||||
isEnable = sysSettings.value("EnableAuth").toBool();
|
||||
}
|
||||
return isEnable;
|
||||
}
|
||||
|
||||
DeviceInfoPtr BioDevices::getDefaultDevice(uid_t uid)
|
||||
{
|
||||
if(deviceInfos.size() <= 0)
|
||||
return nullptr;
|
||||
|
||||
QString defaultDeviceName;
|
||||
|
||||
struct passwd *pwd = getpwuid(uid);
|
||||
QString userConfigFile = QString(pwd->pw_dir) + "/.biometric_auth/ukui_biometric.conf";
|
||||
QSettings userConfig(userConfigFile, QSettings::IniFormat);
|
||||
qDebug() << userConfig.fileName();
|
||||
defaultDeviceName = userConfig.value(DEFAULT_DEVICE).toString();
|
||||
qDebug() << defaultDeviceName;
|
||||
|
||||
if(defaultDeviceName.isEmpty() || !findDevice(defaultDeviceName)) {
|
||||
QSettings sysConfig(GET_STR(CONFIG_FILE), QSettings::IniFormat);
|
||||
defaultDeviceName = sysConfig.value(DEFAULT_DEVICE).toString();
|
||||
}
|
||||
|
||||
if(defaultDeviceName.isEmpty() || !findDevice(defaultDeviceName)){
|
||||
QString userConfigFile = QString(pwd->pw_dir) + "/.biometric_auth/ukui_biometric.conf";
|
||||
QSettings userConfig(userConfigFile, QSettings::IniFormat);
|
||||
defaultDeviceName = userConfig.value(DEFAULT_DEVICE).toString();
|
||||
|
||||
|
||||
}
|
||||
qDebug() << "default device: " << defaultDeviceName;
|
||||
// 终端不默认使用第一个设备
|
||||
if(defaultDeviceName.isEmpty()){
|
||||
// if(!useFirstDevice)
|
||||
// return nullptr;
|
||||
// else
|
||||
// return getFirstDevice(uid);
|
||||
return nullptr;
|
||||
}
|
||||
bool defValid = false;
|
||||
DeviceInfoPtr ptrDevInfo = findDevice(defaultDeviceName);
|
||||
if (ptrDevInfo) {
|
||||
if (GetUserDevFeatureCount(uid,ptrDevInfo->device_id) > 0) {
|
||||
defValid = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!defValid) {
|
||||
// if(!useFirstDevice)
|
||||
// ptrDevInfo = nullptr;
|
||||
// else
|
||||
// ptrDevInfo = getFirstDevice(uid);
|
||||
ptrDevInfo = nullptr;
|
||||
}
|
||||
|
||||
return ptrDevInfo;
|
||||
}
|
||||
|
||||
int BioDevices::GetLastDevice(const QString &userName)
|
||||
{
|
||||
int nLastDevId = -1;
|
||||
QSettings sysSettings(QString(SHARE_BIOMETRIC_CONFIG_PATH).arg(userName), QSettings::IniFormat);
|
||||
sysSettings.beginGroup("Common");
|
||||
if (sysSettings.allKeys().contains("LastDeviceId")) {
|
||||
nLastDevId = sysSettings.value("LastDeviceId").toInt();
|
||||
}
|
||||
sysSettings.endGroup();
|
||||
return nLastDevId;
|
||||
}
|
||||
|
||||
void BioDevices::SetLastDevice(const QString &userName, int drvid)
|
||||
{
|
||||
if (drvid < 0) {
|
||||
return;
|
||||
}
|
||||
QString desConfPath = QString(SHARE_BIOMETRIC_CONFIG_PATH).arg(userName);
|
||||
QFile fileConf(desConfPath);
|
||||
if (fileConf.exists()) {
|
||||
QSettings sysSettings(desConfPath, QSettings::IniFormat);
|
||||
sysSettings.beginGroup("Common");
|
||||
sysSettings.setValue("LastDeviceId", drvid);
|
||||
sysSettings.endGroup();
|
||||
} else {
|
||||
QSettings sysSettings(desConfPath, QSettings::IniFormat);
|
||||
sysSettings.beginGroup("Common");
|
||||
sysSettings.setValue("LastDeviceId", drvid);
|
||||
sysSettings.endGroup();
|
||||
sysSettings.sync();
|
||||
QFile file(desConfPath);
|
||||
file.setPermissions(QFile::WriteUser | QFile::ReadUser | QFile::WriteOther | QFile::ReadOther);
|
||||
}
|
||||
}
|
||||
|
||||
DeviceInfoPtr BioDevices::findDevice(const int id)
|
||||
{
|
||||
for(auto deviceInfo : deviceInfos) {
|
||||
if(deviceInfo->device_id == id)
|
||||
return deviceInfo;
|
||||
}
|
||||
//qDebug() << deviceName << "doesn't exists";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
DeviceInfoPtr BioDevices::findDevice(const QString &deviceName)
|
||||
{
|
||||
for(auto deviceInfo : deviceInfos) {
|
||||
if(deviceInfo->device_shortname == deviceName)
|
||||
return deviceInfo;
|
||||
}
|
||||
qDebug() << deviceName << "doesn't exists";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
DeviceInfoPtr BioDevices::getFirstDevice(int uid)
|
||||
{
|
||||
for (DeviceInfoPtr devInfo : deviceInfos) {
|
||||
if (devInfo && GetUserDevFeatureCount(uid, devInfo->device_id) > 0) {
|
||||
return devInfo;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QString BioDevices::bioTypeToString_tr(int type)
|
||||
{
|
||||
switch(type) {
|
||||
case BIOTYPE_FINGERPRINT:
|
||||
return tr("FingerPrint");
|
||||
case BIOTYPE_FINGERVEIN:
|
||||
return tr("FingerVein");
|
||||
case BIOTYPE_IRIS:
|
||||
return tr("Iris");
|
||||
case BIOTYPE_FACE:
|
||||
return tr("Face");
|
||||
case BIOTYPE_VOICEPRINT:
|
||||
return tr("VoicePrint");
|
||||
case REMOTE_QRCODE_TYPE:
|
||||
return tr("QRCode");
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
DeviceList BioDevices::GetDevList()
|
||||
{
|
||||
return deviceInfos;
|
||||
}
|
||||
|
||||
StatusReslut BioDevices::UpdateStatus(int drvid)
|
||||
{
|
||||
StatusReslut status;
|
||||
QDBusMessage result = serviceInterface->call(QStringLiteral("UpdateStatus"), drvid);
|
||||
if(result.type() == QDBusMessage::ErrorMessage)
|
||||
{
|
||||
qWarning() << "UpdateStatus error:" << result.errorMessage();
|
||||
status.result = -1;
|
||||
return status;
|
||||
}
|
||||
|
||||
status.result = result.arguments().at(0).toInt();
|
||||
status.enable = result.arguments().at(1).toInt();
|
||||
status.devNum = result.arguments().at(2).toInt();
|
||||
status.devStatus = result.arguments().at(3).toInt();
|
||||
status.opsStatus = result.arguments().at(4).toInt();
|
||||
status.notifyMessageId = result.arguments().at(5).toInt();
|
||||
|
||||
return status;
|
||||
}
|
|
@ -0,0 +1,141 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
**/
|
||||
#include "biodeviceswidget.h"
|
||||
#include "ui_biodeviceswidget.h"
|
||||
|
||||
BioDevicesWidget::BioDevicesWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::BioDevicesWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(&bioDevices, &BioDevices::deviceCountChanged,
|
||||
this, &BioDevicesWidget::onDeviceCountChanged);
|
||||
}
|
||||
|
||||
BioDevicesWidget::~BioDevicesWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void BioDevicesWidget::init(uid_t uid)
|
||||
{
|
||||
this->uid = uid;
|
||||
devicesMap = bioDevices.getUserDevices(uid);
|
||||
|
||||
ui->cmbDeviceTypes->clear();
|
||||
|
||||
for(auto i : devicesMap.keys()) {
|
||||
ui->cmbDeviceTypes->addItem(BioDevices::bioTypeToString_tr(i), i);
|
||||
}
|
||||
|
||||
/* set the default device as current device */
|
||||
DeviceInfoPtr device = bioDevices.getDefaultDevice(uid);
|
||||
if(device) {
|
||||
int index = ui->cmbDeviceTypes->findData(device->biotype);
|
||||
QList<DeviceInfo> &deviceList = devicesMap[index];
|
||||
auto iter = std::find_if(deviceList.constBegin(), deviceList.constEnd(),
|
||||
[&](const DeviceInfo &deviceInfo){
|
||||
return deviceInfo.device_shortname == device->device_shortname;
|
||||
});
|
||||
int row = iter - deviceList.constBegin();
|
||||
//qDebug() << "row==" <<row;
|
||||
//qDebug() << "type=" <<index;
|
||||
ui->cmbDeviceTypes->setCurrentIndex(index);
|
||||
ui->lwDevices->setCurrentIndex(row);
|
||||
}
|
||||
Q_EMIT deviceCountChanged(bioDevices.count());
|
||||
}
|
||||
|
||||
//void BioDevicesWidget::on_btnBack_clicked()
|
||||
//{
|
||||
// Q_EMIT back();
|
||||
//}
|
||||
|
||||
//void BioDevicesWidget::on_btnOK_clicked()
|
||||
//{
|
||||
// int row = ui->lwDevices->currentIndex();
|
||||
// int type = ui->cmbDeviceTypes->itemData(ui->cmbDeviceTypes->currentIndex()).toInt();
|
||||
|
||||
// Q_EMIT deviceChanged(devicesMap[type].at(row));
|
||||
//}
|
||||
|
||||
void BioDevicesWidget::on_lwDevices_currentIndexChanged()
|
||||
{
|
||||
if(isVisible() == false){
|
||||
return ;
|
||||
}
|
||||
qDebug() << "index changed";
|
||||
int row = ui->lwDevices->currentIndex();
|
||||
int type = ui->cmbDeviceTypes->itemData(ui->cmbDeviceTypes->currentIndex()).toInt();
|
||||
qDebug() << "row==" <<row;
|
||||
qDebug() << "type=" <<type;
|
||||
if(row < 0 )
|
||||
return;
|
||||
Q_EMIT deviceChanged(devicesMap[type].at(row));
|
||||
}
|
||||
void BioDevicesWidget::setCurrentDevice(DeviceInfoPtr device)
|
||||
{
|
||||
if(device) {
|
||||
int index = ui->cmbDeviceTypes->findData(device->biotype);
|
||||
QList<DeviceInfo> &deviceList = devicesMap[index];
|
||||
auto iter = std::find_if(deviceList.constBegin(), deviceList.constEnd(),
|
||||
[&](const DeviceInfo &deviceInfo){
|
||||
return deviceInfo.device_shortname == device->device_shortname;
|
||||
});
|
||||
int row = iter - deviceList.constBegin();
|
||||
qDebug() << "row==" <<row;
|
||||
qDebug() << "type=" <<index;
|
||||
ui->cmbDeviceTypes->setCurrentIndex(index);
|
||||
ui->lwDevices->setCurrentIndex(row);
|
||||
}
|
||||
Q_EMIT deviceCountChanged(bioDevices.count());
|
||||
}
|
||||
|
||||
void BioDevicesWidget::on_cmbDeviceTypes_currentIndexChanged(int index)
|
||||
{
|
||||
qDebug() << "type changed";
|
||||
//qDebug() << "index=" <<index;
|
||||
ui->lwDevices->clear();
|
||||
|
||||
int i = ui->cmbDeviceTypes->itemData(index).toInt();
|
||||
for(auto device : devicesMap[i])
|
||||
ui->lwDevices->addItem(device.device_shortname);
|
||||
if(ui->lwDevices->currentIndex()<0)
|
||||
ui->lwDevices->setCurrentIndex(0);
|
||||
|
||||
}
|
||||
|
||||
void BioDevicesWidget::onDeviceCountChanged()
|
||||
{
|
||||
int type = ui->cmbDeviceTypes->itemData(ui->cmbDeviceTypes->currentIndex()).toInt();
|
||||
init(uid);
|
||||
int index = ui->cmbDeviceTypes->findData(type);
|
||||
ui->cmbDeviceTypes->setCurrentIndex(index >= 0 ? index : 0);
|
||||
|
||||
Q_EMIT deviceCountChanged(bioDevices.count());
|
||||
}
|
||||
|
||||
int GetFailedTimes()
|
||||
{
|
||||
QSettings sysSettings(UKUI_BIOMETRIC_SYS_CONFIG_PATH, QSettings::IniFormat);
|
||||
if(sysSettings.contains("MaxFailedTimes"))
|
||||
return sysSettings.value("MaxFailedTimes").toInt();
|
||||
else
|
||||
return 3;
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>BioDevicesWidget</class>
|
||||
<widget class="QWidget" name="BioDevicesWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>530</width>
|
||||
<height>99</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QComboBox" name="cmbDeviceTypes">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="lwDevices">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>36</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>36</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
**/
|
||||
#include "biotypes.h"
|
||||
#include <QDBusInterface>
|
||||
|
||||
|
||||
QDBusArgument &operator<<(QDBusArgument &argument, const DeviceInfo &deviceInfo)
|
||||
{
|
||||
argument.beginStructure();
|
||||
argument << deviceInfo.device_id << deviceInfo.device_shortname
|
||||
<< deviceInfo.device_fullname << deviceInfo.driver_enable
|
||||
<< deviceInfo.device_available
|
||||
<< deviceInfo.biotype << deviceInfo.stotype
|
||||
<< deviceInfo.eigtype << deviceInfo.vertype
|
||||
<< deviceInfo.idtype << deviceInfo.bustype
|
||||
<< deviceInfo.dev_status << deviceInfo.ops_status;
|
||||
argument.endStructure();
|
||||
return argument;
|
||||
}
|
||||
|
||||
const QDBusArgument &operator>>(const QDBusArgument &argument, DeviceInfo &deviceInfo)
|
||||
{
|
||||
argument.beginStructure();
|
||||
argument >> deviceInfo.device_id >> deviceInfo.device_shortname
|
||||
>> deviceInfo.device_fullname >> deviceInfo.driver_enable
|
||||
>> deviceInfo.device_available
|
||||
>> deviceInfo.biotype >> deviceInfo.stotype
|
||||
>> deviceInfo.eigtype >> deviceInfo.vertype
|
||||
>> deviceInfo.idtype >> deviceInfo.bustype
|
||||
>> deviceInfo.dev_status >> deviceInfo.ops_status;
|
||||
argument.endStructure();
|
||||
return argument;
|
||||
}
|
||||
|
||||
bool DeviceInfo::operator==(const DeviceInfo& deviceInfo) const
|
||||
{
|
||||
if(this->device_shortname == deviceInfo.device_shortname &&
|
||||
this->device_available == deviceInfo.device_available)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
QDebug& operator<<(QDebug &stream, const DeviceInfo &deviceInfo)
|
||||
{
|
||||
stream << deviceInfo.device_id << deviceInfo.device_shortname
|
||||
<< deviceInfo.biotype << deviceInfo.device_available;
|
||||
return stream;
|
||||
}
|
||||
|
||||
QDebug operator <<(QDebug stream, const DeviceInfo &deviceInfo)
|
||||
{
|
||||
stream << "["
|
||||
<< deviceInfo.device_id
|
||||
<< deviceInfo.device_shortname
|
||||
<< deviceInfo.device_fullname
|
||||
<< deviceInfo.biotype
|
||||
<< deviceInfo.driver_enable
|
||||
<< deviceInfo.device_available
|
||||
<< "]";
|
||||
return stream;
|
||||
}
|
||||
|
||||
QString bioTypeToString(int type)
|
||||
{
|
||||
switch(type) {
|
||||
case BIOTYPE_FINGERPRINT:
|
||||
return ("FingerPrint");
|
||||
case BIOTYPE_FINGERVEIN:
|
||||
return ("FingerVein");
|
||||
case BIOTYPE_IRIS:
|
||||
return ("Iris");
|
||||
case BIOTYPE_FACE:
|
||||
return ("Face");
|
||||
case BIOTYPE_VOICEPRINT:
|
||||
return ("VoicePrint");
|
||||
}
|
||||
return QString();
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
#include "giodbus.h"
|
||||
#include <gio/gio.h>
|
||||
#include <gio-unix-2.0/gio/gunixfdlist.h>
|
||||
#include <glib.h>
|
||||
|
||||
int get_server_gvariant_stdout (int drvid)
|
||||
{
|
||||
GDBusMessage *method_call_message;
|
||||
GDBusMessage *method_reply_message;
|
||||
GUnixFDList *fd_list;
|
||||
GError **error = NULL;
|
||||
|
||||
gint fd,dup_fd;
|
||||
const gchar * response;
|
||||
fd = -1;
|
||||
dup_fd = -1;
|
||||
method_call_message = NULL;
|
||||
method_reply_message = NULL;
|
||||
GDBusConnection *con = g_bus_get_sync(G_BUS_TYPE_SYSTEM,NULL,NULL);
|
||||
method_call_message = g_dbus_message_new_method_call ("org.ukui.Biometric",
|
||||
"/org/ukui/Biometric",
|
||||
"org.ukui.Biometric",
|
||||
"GetFrameFd");
|
||||
|
||||
g_dbus_message_set_body (method_call_message, g_variant_new ("(i)", drvid));
|
||||
method_reply_message = g_dbus_connection_send_message_with_reply_sync (con,
|
||||
method_call_message,
|
||||
G_DBUS_SEND_MESSAGE_FLAGS_NONE,
|
||||
-1,
|
||||
NULL, /* out_serial */
|
||||
NULL, /* cancellable */
|
||||
error);
|
||||
if (method_reply_message == NULL)
|
||||
goto out;
|
||||
|
||||
if (g_dbus_message_get_message_type (method_reply_message) == G_DBUS_MESSAGE_TYPE_ERROR)
|
||||
{
|
||||
g_dbus_message_to_gerror (method_reply_message, error);
|
||||
goto out;
|
||||
}
|
||||
//g_print("%s",g_dbus_message_print(method_reply_message,0));
|
||||
|
||||
fd_list = g_dbus_message_get_unix_fd_list(method_reply_message);
|
||||
fd = g_unix_fd_list_get(fd_list,0,error);
|
||||
//g_print("get fd : %d\n", fd);
|
||||
dup_fd = dup(fd);
|
||||
//g_print("dup fd : %d\n", dup_fd);
|
||||
|
||||
out:
|
||||
g_object_unref (method_call_message);
|
||||
g_object_unref (method_reply_message);
|
||||
return fd;
|
||||
|
||||
}
|
|
@ -0,0 +1,869 @@
|
|||
#include "loginoptionswidget.h"
|
||||
|
||||
#include <pwd.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include "giodbus.h"
|
||||
#include "generic.h"
|
||||
#include "biotypes.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QPainterPath>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QButtonGroup>
|
||||
#include <QToolButton>
|
||||
#include <QTimer>
|
||||
#include <QPixmap>
|
||||
#include <QPainter>
|
||||
#include <QtSvg/QSvgRenderer>
|
||||
#include <QImage>
|
||||
#include <QApplication>
|
||||
#include <QFont>
|
||||
#include <QDebug>
|
||||
|
||||
LoginOptionsWidget::LoginOptionsWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_biomericProxy(new BioAuth(this))
|
||||
, m_bioDevices(new BioDevices())
|
||||
{
|
||||
initUI();
|
||||
initConnections();
|
||||
m_mapDisableDev.clear();
|
||||
}
|
||||
|
||||
LoginOptionsWidget::~LoginOptionsWidget()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void LoginOptionsWidget::initUI()
|
||||
{
|
||||
// 初始化UI
|
||||
m_layoutMain = new QVBoxLayout();
|
||||
m_layoutMain->setContentsMargins(0,0,0,30);
|
||||
m_layoutMain->setSpacing(12);
|
||||
m_layoutMain->setAlignment(Qt::AlignTop);
|
||||
m_layoutOptBtns = new QHBoxLayout();
|
||||
m_layoutOptBtns->setContentsMargins(0,0,0,0);
|
||||
m_layoutOptBtns->setSpacing(16);
|
||||
m_layoutImage = new QHBoxLayout();
|
||||
m_layoutImage->setContentsMargins(0,0,0,0);
|
||||
m_layoutImage->setSpacing(0);
|
||||
m_layoutImage->setAlignment(Qt::AlignCenter);
|
||||
|
||||
m_labelOptTitle = new QLabel();
|
||||
m_labelOptTitle->setAlignment(Qt::AlignCenter);
|
||||
m_labelOptTitle->setText(tr("Login Options"));
|
||||
m_layoutMain->addWidget(m_labelOptTitle);
|
||||
|
||||
m_btnGroup = new QButtonGroup(this);
|
||||
m_btnGroup->setExclusive(true);
|
||||
|
||||
m_layoutOptBtns->setAlignment(Qt::AlignCenter);
|
||||
m_layoutMain->addLayout(m_layoutOptBtns);
|
||||
|
||||
m_widgetImage = new QWidget();
|
||||
m_widgetImage->setFixedSize(154,154);
|
||||
m_layoutImage->addWidget(m_widgetImage);
|
||||
m_widgetImage->hide();
|
||||
// 人脸识别
|
||||
m_labelFace = new QLabel(m_widgetImage);
|
||||
m_labelFace->setObjectName("faceLabel");
|
||||
m_labelFace->setAlignment(Qt::AlignCenter);
|
||||
m_labelFace->setFixedSize(154,154);
|
||||
QImage img;
|
||||
setFaceImg(img);
|
||||
m_labelFace->hide();
|
||||
// 二维码窗口
|
||||
m_labelQRCode = new QLabel(m_widgetImage);
|
||||
m_labelQRCode->setObjectName("qrCodeLabel");
|
||||
m_labelQRCode->setAlignment(Qt::AlignCenter);
|
||||
m_labelQRCode->setFixedSize(154,154);
|
||||
m_labelQRCode->hide();
|
||||
m_layoutMain->addLayout(m_layoutImage);
|
||||
QVBoxLayout *layoutQRCode = new QVBoxLayout();
|
||||
layoutQRCode->setAlignment(Qt::AlignCenter);
|
||||
layoutQRCode->setSpacing(10);
|
||||
m_labelQRCode->setLayout(layoutQRCode);
|
||||
m_labelQRCodeTip = new QLabel();
|
||||
m_labelQRCodeTip->setFixedSize(22,22);
|
||||
m_labelQRCodeTip->setPixmap(QIcon::fromTheme("ukui-dialog-warning").pixmap(QSize(22,22)));
|
||||
layoutQRCode->addWidget(m_labelQRCodeTip, 0, Qt::AlignHCenter);
|
||||
m_labelQRCodeMsg = new QLabel();
|
||||
m_labelQRCodeMsg->setFixedHeight(24);
|
||||
QFont font = m_labelQRCodeMsg->font();
|
||||
font.setPixelSize(16);
|
||||
m_labelQRCodeMsg->setStyleSheet("QLabel{background-color:rgba(255,255,255,0);color:rgb(255,0,0)}");
|
||||
m_labelQRCodeMsg->setFont(font);
|
||||
layoutQRCode->addWidget(m_labelQRCodeMsg, 0, Qt::AlignHCenter);
|
||||
|
||||
this->setLayout(m_layoutMain);
|
||||
}
|
||||
|
||||
void LoginOptionsWidget::initConnections()
|
||||
{
|
||||
if(m_biomericProxy) {
|
||||
connect(m_biomericProxy, &BioAuth::notifyDetail,
|
||||
this, &LoginOptionsWidget::onStatusChanged);
|
||||
|
||||
connect(m_biomericProxy, &BioAuth::frameWritten,
|
||||
this, &LoginOptionsWidget::onFrameWritten);
|
||||
|
||||
connect(m_biomericProxy, &BioAuth::authComplete,
|
||||
this, &LoginOptionsWidget::onIdentifyComplete);
|
||||
}
|
||||
if (m_bioDevices) {
|
||||
connect(m_bioDevices, &BioDevices::deviceCountChanged,
|
||||
this, &LoginOptionsWidget::onUSBDeviceCountChange);
|
||||
readDevicesInfo();
|
||||
}
|
||||
connect(m_btnGroup, SIGNAL(buttonClicked(int)), this, SLOT(onOptionSelected(int)));
|
||||
}
|
||||
|
||||
bool LoginOptionsWidget::getCurLoginOpt(int& nLoginOptType, int& nDrvId)
|
||||
{
|
||||
if (m_curDevInfo) {
|
||||
nLoginOptType = convertDeviceType(m_curDevInfo->biotype);
|
||||
nDrvId = m_curDevInfo->device_id;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned LoginOptionsWidget::getLoginOptCount()
|
||||
{
|
||||
return m_mapDevices.size();
|
||||
}
|
||||
|
||||
DeviceInfoPtr LoginOptionsWidget::getFirstDevInfo()
|
||||
{
|
||||
DeviceInfoPtr devInfo = nullptr;
|
||||
int nDrvId = m_bioDevices->GetLastDevice(getpwuid(getuid())->pw_name);
|
||||
if (nDrvId >= 0) {
|
||||
qDebug()<<"GetLastDevice:"<<nDrvId;
|
||||
DeviceMap::iterator itDevInfo = m_mapDevices.begin();
|
||||
for (; itDevInfo != m_mapDevices.end(); itDevInfo++) {
|
||||
for (auto devinfo : itDevInfo.value()) {
|
||||
if (devinfo && devinfo->device_id == nDrvId) {
|
||||
if (!isDeviceDisable(devinfo->device_id)) {
|
||||
devInfo = devinfo;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (devInfo) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!devInfo) {
|
||||
DeviceMap::iterator itDevInfo = m_mapDevices.begin();
|
||||
for (; itDevInfo != m_mapDevices.end(); itDevInfo++) {
|
||||
for (auto devinfo : itDevInfo.value()) {
|
||||
if (devinfo && !isDeviceDisable(devinfo->device_id)) {
|
||||
devInfo = devinfo;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (devInfo) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return devInfo;
|
||||
}
|
||||
|
||||
void LoginOptionsWidget::addOptionButton(unsigned uLoginOptType, int nDrvId, QString strDrvName)
|
||||
{
|
||||
if (m_mapOptBtns.contains(nDrvId)) {
|
||||
return ;
|
||||
}
|
||||
QToolButton *newButton = new QToolButton();
|
||||
// newButton->setStyleSheet(QString("QToolButton{text-align:center;border: none;border-radius: 6px;outline: none;background-color: rgba(230, 230, 230, 100%);} \
|
||||
// QToolButton::hover{background-color: rgba(55, 144, 250, 40%);} \
|
||||
// QToolButton::pressed {background-color: rgba(55, 144, 250, 100%);} \
|
||||
// QToolButton::checked {background-color: rgba(55, 144, 250, 100%);} \
|
||||
// "));
|
||||
newButton->setCheckable(true);
|
||||
newButton->setChecked(false);
|
||||
newButton->setFocusPolicy(Qt::NoFocus);
|
||||
newButton->setContentsMargins(16,16,16,16);
|
||||
if (nDrvId == -1) {
|
||||
newButton->setEnabled(false);
|
||||
newButton->setChecked(true);
|
||||
} else {
|
||||
int nLength = m_btnGroup->buttons().length();
|
||||
m_btnGroup->addButton(newButton, nLength);
|
||||
m_listDriveId.append(nDrvId);
|
||||
}
|
||||
QIcon icon;
|
||||
switch (uLoginOptType) {
|
||||
case LOGINOPT_TYPE_PASSWORD:
|
||||
icon = QIcon(QString("%1/images/ukui-loginopt-password.svg").arg(GET_STR(UKUI_BIOMETRIC)));
|
||||
break;
|
||||
case LOGINOPT_TYPE_FACE:
|
||||
icon = QIcon(QString("%1/images/ukui-loginopt-face.svg").arg(GET_STR(UKUI_BIOMETRIC)));
|
||||
break;
|
||||
case LOGINOPT_TYPE_FINGERPRINT:
|
||||
icon = QIcon(QString("%1/images/ukui-loginopt-finger.svg").arg(GET_STR(UKUI_BIOMETRIC)));
|
||||
break;
|
||||
case LOGINOPT_TYPE_IRIS:
|
||||
icon = QIcon(QString("%1/images/ukui-loginopt-iris.svg").arg(GET_STR(UKUI_BIOMETRIC)));
|
||||
break;
|
||||
case LOGINOPT_TYPE_VOICEPRINT:
|
||||
icon = QIcon(QString("%1/images/ukui-loginopt-voice.svg").arg(GET_STR(UKUI_BIOMETRIC)));
|
||||
break;
|
||||
case LOGINOPT_TYPE_FINGERVEIN:
|
||||
icon = QIcon(QString("%1/images/ukui-loginopt-fingervein.svg").arg(GET_STR(UKUI_BIOMETRIC)));
|
||||
break;
|
||||
case LOGINOPT_TYPE_QRCODE:
|
||||
icon = QIcon(QString("%1/images/ukui-loginopt-qrcode.svg").arg(GET_STR(UKUI_BIOMETRIC)));
|
||||
break;
|
||||
}
|
||||
newButton->setIcon(icon);
|
||||
newButton->setToolTip(strDrvName);
|
||||
newButton->setFixedSize(36, 36);
|
||||
if (isDeviceDisable(nDrvId)) {
|
||||
newButton->setDisabled(true);
|
||||
} else {
|
||||
newButton->setDisabled(false);
|
||||
}
|
||||
|
||||
m_layoutOptBtns->addWidget(newButton);
|
||||
m_mapOptBtns[nDrvId] = newButton;
|
||||
}
|
||||
|
||||
void LoginOptionsWidget::clearOptionButtons()
|
||||
{
|
||||
QMap<int, QToolButton*>::iterator itMapBtn = m_mapOptBtns.begin();
|
||||
for ( ; itMapBtn != m_mapOptBtns.end(); itMapBtn++) {
|
||||
if (itMapBtn.value()) {
|
||||
m_btnGroup->removeButton(itMapBtn.value());
|
||||
m_layoutOptBtns->removeWidget(itMapBtn.value());
|
||||
itMapBtn.value()->deleteLater();
|
||||
}
|
||||
}
|
||||
m_listDriveId.clear();
|
||||
m_mapOptBtns.clear();
|
||||
}
|
||||
|
||||
void LoginOptionsWidget::updateOptionButtons()
|
||||
{
|
||||
clearOptionButtons();
|
||||
//addOptionButton(LOGINOPT_TYPE_PASSWORD, -1, tr("Password"));
|
||||
DeviceMap::iterator itMapDev = m_mapDevices.begin();
|
||||
for ( ; itMapDev != m_mapDevices.end(); itMapDev++) {
|
||||
for (DeviceInfoPtr devPtr : itMapDev.value()) {
|
||||
if (devPtr) {
|
||||
addOptionButton(itMapDev.key(), devPtr->device_id, BioDevices::bioTypeToString_tr(devPtr->biotype));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_mapOptBtns.size() <= 1) {
|
||||
m_labelOptTitle->hide();
|
||||
QMap<int, QToolButton*>::iterator itMapBtn = m_mapOptBtns.begin();
|
||||
for ( ; itMapBtn != m_mapOptBtns.end(); itMapBtn++) {
|
||||
if (itMapBtn.value()) {
|
||||
itMapBtn.value()->hide();
|
||||
}
|
||||
}
|
||||
if (m_mapOptBtns.size() == 0) {
|
||||
m_labelFace->hide();
|
||||
m_labelQRCode->hide();
|
||||
}
|
||||
} else {
|
||||
m_labelOptTitle->show();
|
||||
QMap<int, QToolButton*>::iterator itMapBtn = m_mapOptBtns.begin();
|
||||
for ( ; itMapBtn != m_mapOptBtns.end(); itMapBtn++) {
|
||||
if (itMapBtn.value()) {
|
||||
itMapBtn.value()->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
adjustSize();
|
||||
}
|
||||
|
||||
void LoginOptionsWidget::setUser(int uid)
|
||||
{
|
||||
bool bNeedUpdateDevInfo = false;
|
||||
if (uid != m_uid) {
|
||||
bNeedUpdateDevInfo = true;
|
||||
}
|
||||
m_uid = uid;
|
||||
if (bNeedUpdateDevInfo) {
|
||||
readDevicesInfo();
|
||||
}
|
||||
}
|
||||
|
||||
void LoginOptionsWidget::readDevicesInfo()
|
||||
{
|
||||
m_mapDevices.clear();
|
||||
bool isAuthEnable = m_bioDevices->GetBioAuthEnable();
|
||||
bool isQRCodeEnable = m_bioDevices->GetQRCodeEnable();
|
||||
DeviceList deviceList = m_bioDevices->GetDevList();
|
||||
for(auto pDeviceInfo : deviceList)
|
||||
{
|
||||
int nDevFeatureCount = 0;
|
||||
if (m_isInAuth && m_curDevInfo && m_curDevInfo->device_id == pDeviceInfo->device_id) {
|
||||
nDevFeatureCount = 1;
|
||||
} else {
|
||||
if (m_uid == -1) {
|
||||
nDevFeatureCount = 0;
|
||||
} else {
|
||||
nDevFeatureCount = m_bioDevices->GetUserDevFeatureCount(m_uid, pDeviceInfo->device_id);
|
||||
}
|
||||
}
|
||||
qDebug() << *pDeviceInfo << ",FeatureCount:"<<nDevFeatureCount;
|
||||
if(nDevFeatureCount > 0) {
|
||||
if (!isAuthEnable && pDeviceInfo->biotype <= BIOTYPE_VOICEPRINT)
|
||||
continue;
|
||||
if (!isQRCodeEnable && pDeviceInfo->biotype == REMOTE_QRCODE_TYPE)
|
||||
continue;
|
||||
int nDevType = LOGINOPT_TYPE_OTHERS;
|
||||
nDevType = convertDeviceType(pDeviceInfo->biotype);
|
||||
m_mapDevices[nDevType].push_back(pDeviceInfo);
|
||||
}
|
||||
}
|
||||
updateOptionButtons();
|
||||
updateUIStatus(false);
|
||||
//Q_EMIT notifyOptionsChange(m_mapDevices.size());
|
||||
}
|
||||
|
||||
void LoginOptionsWidget::startAuth(DeviceInfoPtr device, int uid)
|
||||
{
|
||||
if(!m_biomericProxy)
|
||||
{
|
||||
qWarning() << "BiometricProxy doesn't exist.";
|
||||
return;
|
||||
}
|
||||
|
||||
if(m_isInAuth)
|
||||
{
|
||||
qDebug() << "Identification is currently under way, stop it";
|
||||
stopAuth();
|
||||
}
|
||||
qDebug()<<"deviceInfo:"<<device->device_id;
|
||||
this->m_curDevInfo = device;
|
||||
this->m_uid = uid;
|
||||
this->m_strUserName = getpwuid(uid)->pw_name;
|
||||
this->m_isStopped = false;
|
||||
this->m_curLoginOptType = convertDeviceType(this->m_curDevInfo->biotype);
|
||||
updateUIStatus(true);
|
||||
m_bioDevices->SetLastDevice(getpwuid(getuid())->pw_name, this->m_curDevInfo->device_id);
|
||||
startAuth_();
|
||||
}
|
||||
|
||||
void LoginOptionsWidget::startAuth_()
|
||||
{
|
||||
if (!m_curDevInfo)
|
||||
return ;
|
||||
qDebug().noquote() << QString("Identify:[drvid: %1, uid: %2]").arg(m_curDevInfo->device_id).arg(m_uid);
|
||||
|
||||
m_isInAuth = true;
|
||||
m_dupFD = -1;
|
||||
|
||||
m_biomericProxy->startAuth(m_uid, m_curDevInfo);
|
||||
}
|
||||
|
||||
void LoginOptionsWidget::stopAuth()
|
||||
{
|
||||
m_isStopped = true;
|
||||
if(!m_isInAuth || !m_curDevInfo)
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_biomericProxy->stopAuth();
|
||||
if(m_retrytimer&&m_retrytimer->isActive()){
|
||||
m_retrytimer->stop();
|
||||
delete m_retrytimer;
|
||||
m_retrytimer = nullptr;
|
||||
}
|
||||
m_isInAuth = false;
|
||||
Q_EMIT updateImage(QImage());
|
||||
QImage img;
|
||||
setFaceImg(img);
|
||||
}
|
||||
|
||||
void LoginOptionsWidget::onIdentifyComplete(int uid, bool ret, int retErrNo)
|
||||
{
|
||||
if(m_isStopped == true)
|
||||
return ;
|
||||
|
||||
if(uid < 0)
|
||||
{
|
||||
readDevicesInfo();
|
||||
Q_EMIT authComplete(uid, false, -1);
|
||||
return;
|
||||
}
|
||||
qDebug() << retErrNo << uid << m_uid;
|
||||
|
||||
// 特征识别成功,而且用户id匹配
|
||||
if(retErrNo == DBUS_RESULT_SUCCESS && uid == m_uid) {
|
||||
qDebug() << "Identify success";
|
||||
Q_EMIT authComplete(uid, true, 0);
|
||||
} else if(retErrNo == -1) { // 特征识别不匹配
|
||||
qDebug() << "Identify failed";
|
||||
Q_EMIT authComplete(uid, false, 2);
|
||||
} else if(retErrNo == -2) { //识别发生错误
|
||||
StatusReslut ret = m_bioDevices->UpdateStatus(m_curDevInfo->device_id);
|
||||
qDebug()<<"StatusReslut:"<<ret.result<<","<<ret.enable<<","<<ret.devNum<<","
|
||||
<<ret.devStatus<<","<<ret.opsStatus<<","<<ret.notifyMessageId;
|
||||
//识别操作超时
|
||||
if(ret.result == 0 && (ret.opsStatus == 404 || ret.opsStatus == 304
|
||||
|| ret.opsStatus == 8)) { // 304认证超时, 8网络异常
|
||||
Q_EMIT authComplete(uid, false, 1);
|
||||
} else {
|
||||
Q_EMIT authComplete(uid, false, 2);
|
||||
}
|
||||
} else {
|
||||
Q_EMIT authComplete(uid, false, 2);
|
||||
}
|
||||
}
|
||||
|
||||
QPixmap LoginOptionsWidget::PixmapToRound(const QPixmap &src, int radius)
|
||||
{
|
||||
if (src.isNull()) {
|
||||
return QPixmap();
|
||||
}
|
||||
|
||||
QPixmap pixmapa(src);
|
||||
QPixmap pixmap(radius*2,radius*2);
|
||||
pixmap.fill(Qt::transparent);
|
||||
QPainter painter(&pixmap);
|
||||
painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
|
||||
QPainterPath path;
|
||||
path.addEllipse(0, 0, radius*2, radius*2);
|
||||
painter.setClipPath(path);
|
||||
painter.drawPixmap(0, 0, radius*2, radius*2, pixmapa);
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief scaledPixmap
|
||||
* @param width
|
||||
* @param height
|
||||
* @param url
|
||||
* @return
|
||||
* 图片缩放
|
||||
*/
|
||||
QPixmap LoginOptionsWidget::scaledPixmap(int width, int height, QString url)
|
||||
{
|
||||
QFile imgFile(url);
|
||||
if(!imgFile.exists()){
|
||||
qDebug()<< "not find the pixmap file";
|
||||
return QPixmap();
|
||||
}
|
||||
QImage image(url);
|
||||
QPixmap pixmap = QPixmap::fromImage(image);
|
||||
if(pixmap.isNull()) {
|
||||
qDebug() << "pixmap is null";
|
||||
QProcess exec;
|
||||
QString program("file " + url);
|
||||
exec.start(program);
|
||||
exec.waitForFinished(1000);
|
||||
QString output = exec.readAllStandardOutput();
|
||||
qDebug() << output;
|
||||
if(output.contains("SVG")){
|
||||
qDebug() << "image format is SVG";
|
||||
QSvgRenderer render(url);
|
||||
QImage image(width, height, QImage::Format_ARGB32);
|
||||
image.fill(Qt::transparent);
|
||||
QPainter painter(&image);
|
||||
render.render(&painter, image.rect());
|
||||
pixmap.convertFromImage(image);
|
||||
} else if(output.contains("TIFF")) {
|
||||
qDebug() << "image format is TIFF";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return pixmap.scaled(width, height, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
|
||||
}
|
||||
|
||||
void LoginOptionsWidget::onFrameWritten(int drvid)
|
||||
{
|
||||
if (m_curDevInfo->device_id != drvid || !m_isInAuth) {
|
||||
return ;
|
||||
}
|
||||
if(m_dupFD == -1){
|
||||
m_dupFD = get_server_gvariant_stdout(drvid);
|
||||
}
|
||||
|
||||
if(m_dupFD <= 0)
|
||||
return ;
|
||||
|
||||
cv::Mat img;
|
||||
lseek(m_dupFD, 0, SEEK_SET);
|
||||
char base64_bufferData[1024*1024];
|
||||
int rc = read(m_dupFD, base64_bufferData, 1024*1024);
|
||||
Q_UNUSED(rc);
|
||||
// printf("rc = %d\n", rc);
|
||||
|
||||
cv::Mat mat2(1, sizeof(base64_bufferData), CV_8U, base64_bufferData);
|
||||
img = cv::imdecode(mat2, cv::IMREAD_COLOR);
|
||||
if (!img.data)
|
||||
return ;
|
||||
cv::cvtColor(img,img,cv::COLOR_BGR2RGB);
|
||||
|
||||
QImage srcQImage = QImage((uchar*)(img.data), img.cols, img.rows, QImage::Format_RGB888);
|
||||
if (isAuthenticating()) {
|
||||
if (m_curLoginOptType == LOGINOPT_TYPE_FACE) {
|
||||
m_labelFace->setStyleSheet(QString("border-radius: %1px; border:0px solid white;background-color: rgba(255,255,255,10%);").arg(77));
|
||||
setFaceImg(srcQImage);
|
||||
m_labelFace->show();
|
||||
m_labelQRCode->hide();
|
||||
} else if (m_curLoginOptType == LOGINOPT_TYPE_QRCODE) {
|
||||
m_labelQRCode->setStyleSheet(QString("border-radius: %1px; border:0px solid white;background-color: rgba(255,255,255,100%);").arg(6));
|
||||
setQRCode(srcQImage);
|
||||
m_labelQRCode->show();
|
||||
m_labelFace->hide();
|
||||
} else {
|
||||
m_labelFace->hide();
|
||||
m_labelQRCode->hide();
|
||||
}
|
||||
} else {
|
||||
m_labelFace->hide();
|
||||
m_labelQRCode->hide();
|
||||
}
|
||||
Q_EMIT updateImage(srcQImage);
|
||||
}
|
||||
|
||||
void LoginOptionsWidget::setQRCode(QImage& imgQRCode)
|
||||
{
|
||||
if (imgQRCode.isNull()) {
|
||||
imgQRCode.load(QString("%1/images/ukui-qrcode-null.svg").arg(GET_STR(UKUI_BIOMETRIC)));
|
||||
}
|
||||
imgQRCode = imgQRCode.scaled(QSize(150, 150));
|
||||
m_labelQRCode->setAlignment(Qt::AlignCenter);
|
||||
m_labelQRCode->setPixmap(QPixmap::fromImage(imgQRCode));
|
||||
}
|
||||
|
||||
void LoginOptionsWidget::setQRCodeMsg(QString strMsg)
|
||||
{
|
||||
if (strMsg.isEmpty()) {
|
||||
m_labelQRCodeMsg->hide();
|
||||
m_labelQRCodeTip->hide();
|
||||
} else {
|
||||
m_labelQRCodeMsg->setText(strMsg);
|
||||
m_labelQRCodeMsg->show();
|
||||
m_labelQRCodeTip->show();
|
||||
}
|
||||
}
|
||||
|
||||
void LoginOptionsWidget::setFaceImg(QImage& imgFace, int nStatus)
|
||||
{
|
||||
QPixmap faceImage;
|
||||
m_labelFace->setFixedSize(154,154);
|
||||
//如果头像文件不存在,则使用默认头像
|
||||
if(!imgFace.isNull()) {
|
||||
faceImage = PixmapToRound(QPixmap::fromImage(imgFace),77);
|
||||
} else {
|
||||
switch(nStatus) {
|
||||
case 1:
|
||||
faceImage = loadSvg(QString("%1/images/ukui-loginopt-lose.svg").arg(GET_STR(UKUI_BIOMETRIC)),"black",48);
|
||||
break;
|
||||
default:
|
||||
faceImage = loadSvg(QString("%1/images/ukui-loginopt-smile.svg").arg(GET_STR(UKUI_BIOMETRIC)),"black",48);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_labelFace->setAlignment(Qt::AlignCenter);
|
||||
m_labelFace->setPixmap(faceImage);
|
||||
}
|
||||
|
||||
void LoginOptionsWidget::onStatusChanged(int drvid, const QString &message)
|
||||
{
|
||||
if(!m_isInAuth || !m_curDevInfo)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(drvid != m_curDevInfo->device_id)
|
||||
{
|
||||
return;
|
||||
}
|
||||
//Q_EMIT updateAuthMsg(message);
|
||||
}
|
||||
|
||||
void LoginOptionsWidget::setCurrentDevice(int drvid)
|
||||
{
|
||||
DeviceInfoPtr pDeviceInfo = findDeviceById(drvid);
|
||||
if(pDeviceInfo)
|
||||
{
|
||||
setCurrentDevice(pDeviceInfo);
|
||||
}
|
||||
}
|
||||
|
||||
void LoginOptionsWidget::setCurrentDevice(const QString &deviceName)
|
||||
{
|
||||
DeviceInfoPtr pDeviceInfo = findDeviceByName(deviceName);
|
||||
if(pDeviceInfo)
|
||||
{
|
||||
setCurrentDevice(pDeviceInfo);
|
||||
}
|
||||
}
|
||||
|
||||
void LoginOptionsWidget::setCurrentDevice(const DeviceInfoPtr &pDeviceInfo)
|
||||
{
|
||||
this->m_curDevInfo = pDeviceInfo;
|
||||
}
|
||||
|
||||
DeviceInfoPtr LoginOptionsWidget::findDeviceById(int drvid)
|
||||
{
|
||||
for(int type : m_mapDevices.keys())
|
||||
{
|
||||
DeviceList &deviceList = m_mapDevices[type];
|
||||
auto iter = std::find_if(deviceList.begin(), deviceList.end(),
|
||||
[&](DeviceInfoPtr ptr){
|
||||
return ptr->device_id == drvid;
|
||||
});
|
||||
if(iter != deviceList.end())
|
||||
{
|
||||
return *iter;
|
||||
}
|
||||
}
|
||||
return DeviceInfoPtr();
|
||||
}
|
||||
|
||||
DeviceInfoPtr LoginOptionsWidget::findDeviceByName(const QString &name)
|
||||
{
|
||||
for(int type : m_mapDevices.keys())
|
||||
{
|
||||
DeviceList &deviceList = m_mapDevices[type];
|
||||
auto iter = std::find_if(deviceList.begin(), deviceList.end(),
|
||||
[&](DeviceInfoPtr ptr){
|
||||
return ptr->device_shortname == name;
|
||||
});
|
||||
if(iter != deviceList.end())
|
||||
{
|
||||
return *iter;
|
||||
}
|
||||
}
|
||||
return DeviceInfoPtr();
|
||||
}
|
||||
|
||||
QString LoginOptionsWidget::GetDefaultDevice(uid_t uid)
|
||||
{
|
||||
QString defaultDeviceName;
|
||||
|
||||
struct passwd *pwd = getpwuid(uid);
|
||||
QString userConfigFile = QString(pwd->pw_dir) + "/.biometric_auth/ukui_biometric.conf";
|
||||
QSettings userConfig(userConfigFile, QSettings::IniFormat);
|
||||
qDebug() << userConfig.fileName();
|
||||
defaultDeviceName = userConfig.value(DEFAULT_DEVICE).toString();
|
||||
qDebug() << defaultDeviceName;
|
||||
|
||||
if(defaultDeviceName.isEmpty() || !findDeviceByName(defaultDeviceName)) {
|
||||
QSettings sysConfig(GET_STR(CONFIG_FILE), QSettings::IniFormat);
|
||||
defaultDeviceName = sysConfig.value(DEFAULT_DEVICE).toString();
|
||||
}
|
||||
|
||||
if(defaultDeviceName.isEmpty() || !findDeviceByName(defaultDeviceName)){
|
||||
QString userConfigFile = QString(pwd->pw_dir) + "/.biometric_auth/ukui_biometric.conf";
|
||||
QSettings userConfig(userConfigFile, QSettings::IniFormat);
|
||||
defaultDeviceName = userConfig.value(DEFAULT_DEVICE).toString();
|
||||
}
|
||||
qDebug() << "default device: " << defaultDeviceName;
|
||||
|
||||
return defaultDeviceName;
|
||||
}
|
||||
|
||||
void LoginOptionsWidget::onUSBDeviceCountChange(int newNum)
|
||||
{
|
||||
qDebug()<<"deviceNewNum:"<<newNum;
|
||||
int savedCount = 0;
|
||||
for(int type : m_mapDevices.keys())
|
||||
savedCount += m_mapDevices.value(type).count();
|
||||
|
||||
readDevicesInfo();
|
||||
|
||||
int count = 0;
|
||||
for(int type : m_mapDevices.keys())
|
||||
count += m_mapDevices.value(type).count();
|
||||
|
||||
//设备数量发生了变化
|
||||
if(count != savedCount) {
|
||||
updateOptionButtons();
|
||||
Q_EMIT notifyOptionsChange(count);
|
||||
}
|
||||
updateUIStatus(false);
|
||||
}
|
||||
|
||||
bool LoginOptionsWidget::getAuthDouble()
|
||||
{
|
||||
QSettings settings("/etc/biometric-auth/ukui-biometric.conf", QSettings::IniFormat);
|
||||
bool distribId = settings.value("DoubleAuth").toBool();
|
||||
return distribId;
|
||||
}
|
||||
|
||||
void LoginOptionsWidget::updateUIStatus(bool update)
|
||||
{
|
||||
if (m_mapOptBtns.contains(-1)) {
|
||||
QToolButton* btn = m_mapOptBtns[-1];
|
||||
if (btn) {
|
||||
btn->setChecked(true);
|
||||
}
|
||||
}
|
||||
if (m_curDevInfo) {
|
||||
if (m_mapOptBtns.contains(m_curDevInfo->device_id)) {
|
||||
QToolButton* btn = m_mapOptBtns[m_curDevInfo->device_id];
|
||||
if (btn) {
|
||||
btn->setChecked(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (update) {
|
||||
if (m_curLoginOptType == LOGINOPT_TYPE_FACE) {
|
||||
m_labelFace->setStyleSheet(QString("border-radius: %1px; border:0px solid white;background-color: rgba(255,255,255,10%);").arg(77));
|
||||
m_labelFace->show();
|
||||
m_labelQRCode->hide();
|
||||
m_widgetImage->show();
|
||||
} else if (m_curLoginOptType == LOGINOPT_TYPE_QRCODE) {
|
||||
m_labelQRCode->setStyleSheet(QString("border-radius: %1px; border:0px solid white;background-color: rgba(255,255,255,100%);").arg(6));
|
||||
QImage img;
|
||||
setQRCode(img);
|
||||
m_labelQRCode->show();
|
||||
m_labelFace->hide();
|
||||
m_widgetImage->show();
|
||||
} else {
|
||||
m_labelFace->hide();
|
||||
m_labelQRCode->hide();
|
||||
m_widgetImage->hide();
|
||||
}
|
||||
}
|
||||
QTimer::singleShot(0,this,[&,this](){
|
||||
Q_EMIT this->updateWndSize(this->m_curLoginOptType, this->m_mapOptBtns.size());
|
||||
});
|
||||
}
|
||||
|
||||
void LoginOptionsWidget::onOptionSelected(int nIndex)
|
||||
{
|
||||
if (nIndex < 0)
|
||||
return;
|
||||
if (nIndex < m_listDriveId.size()) {
|
||||
DeviceInfoPtr info = findDeviceById(m_listDriveId[nIndex]);
|
||||
if (info && !isDeviceDisable(info->device_id)) {
|
||||
Q_EMIT optionSelected(convertDeviceType(info->biotype), info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int LoginOptionsWidget::convertDeviceType(int nDevType)
|
||||
{
|
||||
int nLoginOptType = LOGINOPT_TYPE_OTHERS;
|
||||
switch (nDevType) {
|
||||
case BIOTYPE_FINGERPRINT:
|
||||
nLoginOptType = LOGINOPT_TYPE_FINGERPRINT;
|
||||
break;
|
||||
case BIOTYPE_FINGERVEIN:
|
||||
nLoginOptType = LOGINOPT_TYPE_FINGERVEIN;
|
||||
break;
|
||||
case BIOTYPE_IRIS:
|
||||
nLoginOptType = LOGINOPT_TYPE_IRIS;
|
||||
break;
|
||||
case BIOTYPE_FACE:
|
||||
nLoginOptType = LOGINOPT_TYPE_FACE;
|
||||
break;
|
||||
case BIOTYPE_VOICEPRINT:
|
||||
nLoginOptType = LOGINOPT_TYPE_VOICEPRINT;
|
||||
break;
|
||||
case REMOTE_QRCODE_TYPE:
|
||||
nLoginOptType = LOGINOPT_TYPE_QRCODE;
|
||||
break;
|
||||
default:
|
||||
nLoginOptType = LOGINOPT_TYPE_OTHERS;
|
||||
break;
|
||||
}
|
||||
return nLoginOptType;
|
||||
}
|
||||
|
||||
void LoginOptionsWidget::setDeviceDisable(int nDevId, bool bDisable)
|
||||
{
|
||||
if (bDisable) {
|
||||
m_mapDisableDev[m_uid][nDevId] = true;
|
||||
QMap<int, QToolButton*>::iterator itMapBtn = m_mapOptBtns.begin();
|
||||
for ( ; itMapBtn != m_mapOptBtns.end(); itMapBtn++) {
|
||||
if (itMapBtn.key() == nDevId && itMapBtn.value()) {
|
||||
itMapBtn.value()->setDisabled(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
m_mapDisableDev[m_uid][nDevId] = false;
|
||||
QMap<int, QToolButton*>::iterator itMapBtn = m_mapOptBtns.begin();
|
||||
for ( ; itMapBtn != m_mapOptBtns.end(); itMapBtn++) {
|
||||
if (itMapBtn.key() == nDevId && itMapBtn.value()) {
|
||||
itMapBtn.value()->setDisabled(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool LoginOptionsWidget::isDeviceDisable(int nDevId)
|
||||
{
|
||||
if (m_mapDisableDev[m_uid].contains(nDevId)) {
|
||||
return m_mapDisableDev[m_uid][nDevId];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
QPixmap LoginOptionsWidget::loadSvg(QString path, QString color, int size)
|
||||
{
|
||||
int origSize = size;
|
||||
const auto ratio = qApp->devicePixelRatio();
|
||||
if ( 2 == ratio) {
|
||||
size += origSize;
|
||||
} else if (3 == ratio) {
|
||||
size += origSize;
|
||||
}
|
||||
QPixmap pixmap(size, size);
|
||||
QSvgRenderer renderer(path);
|
||||
pixmap.fill(Qt::transparent);
|
||||
|
||||
QPainter painter;
|
||||
painter.begin(&pixmap);
|
||||
renderer.render(&painter);
|
||||
painter.end();
|
||||
|
||||
pixmap.setDevicePixelRatio(ratio);
|
||||
return drawSymbolicColoredPixmap(pixmap, color);
|
||||
}
|
||||
|
||||
QPixmap LoginOptionsWidget::drawSymbolicColoredPixmap(QPixmap &source, QString cgColor)
|
||||
{
|
||||
QImage img = source.toImage();
|
||||
for (int x = 0; x < img.width(); x++) {
|
||||
for (int y = 0; y < img.height(); y++) {
|
||||
auto color = img.pixelColor(x, y);
|
||||
if (color.alpha() > 0) {
|
||||
if ( "white" == cgColor) {
|
||||
color.setRed(255);
|
||||
color.setGreen(255);
|
||||
color.setBlue(255);
|
||||
img.setPixelColor(x, y, color);
|
||||
} else if( "black" == cgColor) {
|
||||
color.setRed(0);
|
||||
color.setGreen(0);
|
||||
color.setBlue(0);
|
||||
img.setPixelColor(x, y, color);
|
||||
} else if ("gray"== cgColor) {
|
||||
color.setRed(152);
|
||||
color.setGreen(163);
|
||||
color.setBlue(164);
|
||||
img.setPixelColor(x, y, color);
|
||||
} else if ("blue" == cgColor){
|
||||
color.setRed(61);
|
||||
color.setGreen(107);
|
||||
color.setBlue(229);
|
||||
img.setPixelColor(x, y, color);
|
||||
} else {
|
||||
return source;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return QPixmap::fromImage(img);
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
**/
|
||||
|
||||
#include "generic.h"
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QByteArray>
|
||||
|
||||
void outputMessage(QtMsgType type, const QMessageLogContext &context, const QString &msg)
|
||||
{
|
||||
Q_UNUSED(context)
|
||||
|
||||
if(!enableDebug)
|
||||
return;
|
||||
|
||||
QDateTime dateTime = QDateTime::currentDateTime();
|
||||
QByteArray time = QString("[%1] ").arg(dateTime.toString("MM-dd hh:mm:ss.zzz")).toLocal8Bit();
|
||||
QByteArray localMsg = msg.toLocal8Bit();
|
||||
QByteArray prefix = logPrefix.toLocal8Bit();
|
||||
switch(type) {
|
||||
case QtDebugMsg:
|
||||
fprintf(stderr, "%s %s [Debug]: %s\n", prefix.constData(),
|
||||
time.constData(), localMsg.constData());
|
||||
break;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
|
||||
case QtInfoMsg:
|
||||
fprintf(stderr, "%s %s [Info]: %s\n", prefix.constData(),
|
||||
time.constData(), localMsg.constData());
|
||||
break;
|
||||
#endif
|
||||
case QtWarningMsg:
|
||||
fprintf(stderr, "%s %s [Warnning]: %s\n", prefix.constData(),
|
||||
time.constData(), localMsg.constData());
|
||||
break;
|
||||
case QtCriticalMsg:
|
||||
fprintf(stderr, "%s %s [Critical]: %s\n", prefix.constData(),
|
||||
time.constData(), localMsg.constData());
|
||||
break;
|
||||
case QtFatalMsg:
|
||||
fprintf(stderr, "%s %s [Fatal]: %s\n", prefix.constData(),
|
||||
time.constData(), localMsg.constData());
|
||||
abort();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
**/
|
||||
#ifndef GENERIC_H
|
||||
#define GENERIC_H
|
||||
|
||||
#define BIO_ERROR -1
|
||||
#define BIO_FAILED 0
|
||||
#define BIO_SUCCESS 1
|
||||
#define BIO_IGNORE 2
|
||||
|
||||
#define BIOMETRIC_PAM_DOUBLE "BIOMETRIC_PAM_DOUBLE"
|
||||
#define BIOMETRIC_PAM "BIOMETRIC_PAM"
|
||||
#define BIOMETRIC_PAM_QRCODE "BIOMETRIC_PAM_QRCODE"
|
||||
#define BIOMETRIC_IGNORE "BIOMETRIC_IGNORE"
|
||||
#define BIOMETRIC_SUCCESS "BIOMETRIC_SUCCESS"
|
||||
#define BIOMETRIC_FAILED "BIOMETRIC_FAILED"
|
||||
|
||||
#define BIO_COM_FILE "/tmp/bio_com"
|
||||
|
||||
#define STR(s) #s
|
||||
#define GET_STR(s) STR(s)
|
||||
|
||||
|
||||
#define _MULTI_THREADED
|
||||
|
||||
#define AGENT_NAME "polkit-ukui-authentication-agent"
|
||||
#define POLKIT_LISTENER_ID "/org/ukui/PolicyKit1/AuthenticationAgent"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "qlogging.h"
|
||||
|
||||
extern bool enableDebug;
|
||||
extern QString logPrefix;
|
||||
void outputMessage(QtMsgType type, const QMessageLogContext &context, const QString &msg);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,12 @@
|
|||
file(GLOB images LIST_DIRECTORIES false *.png *.gif *.svg)
|
||||
|
||||
file(GLOB children *)
|
||||
set(dirlist "")
|
||||
foreach(child ${children})
|
||||
if(IS_DIRECTORY ${child})
|
||||
list(APPEND dirlist ${child})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
install(FILES ${images} DESTINATION ${UKUI_BIOMETRIC_DIR}/images)
|
||||
install(DIRECTORY ${dirlist} DESTINATION ${UKUI_BIOMETRIC_DIR}/images)
|
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 2.6 KiB |