init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled

This commit is contained in:
allhaileris
2026-02-16 15:50:16 +03:00
commit afb81b8278
13816 changed files with 3689732 additions and 0 deletions

View File

@@ -0,0 +1,95 @@
cmake_minimum_required(VERSION 3.16)
project(fcitx5-qt VERSION 5.1.6)
set(FCITX5_QT_VERSION ${PROJECT_VERSION})
set(REQUIRED_QT4_VERSION 4.8.0)
set(REQUIRED_QT5_VERSION 5.5.0)
set(REQUIRED_QT6_VERSION 6.0.0)
find_package(ECM 1.4.0 REQUIRED)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
option(ENABLE_QT4 "Enable Qt 4" Off)
option(ENABLE_QT5 "Enable Qt 5" On)
option(ENABLE_QT6 "Enable Qt 6" On)
option(ENABLE_X11 "Enable X11 support" On)
option(BUILD_ONLY_PLUGIN "Build only plugin" Off)
option(BUILD_STATIC_PLUGIN "Build plugin as static" Off)
option(WITH_FCITX_PLUGIN_NAME "Enable plugin name with fcitx" On)
option(ENABLE_QT6_WAYLAND_WORKAROUND "Enable Qt6 Wayland workaround" On)
if (BUILD_ONLY_PLUGIN)
set(LIBRARY_TYPE OBJECT)
else()
set(LIBRARY_TYPE SHARED)
add_definitions(-DFCITX_GETTEXT_DOMAIN=\"fcitx5-qt\")
if (BUILD_STATIC_PLUGIN)
message(FATAL_ERROR "BUILD_STATIC_PLUGIN requires BUILD_ONLY_PLUGIN")
endif()
endif()
if (BUILD_ONLY_PLUGIN AND BUILD_STATIC_PLUGIN)
set(PLUGIN_LIBRARY_TYPE STATIC)
else()
set(PLUGIN_LIBRARY_TYPE MODULE)
endif()
add_definitions(-DFCITX5_QT_VERSION=\"${FCITX5_QT_VERSION}\")
include(GNUInstallDirs)
include(FeatureSummary)
include(GenerateExportHeader)
include(ECMSetupVersion)
include(ECMGenerateHeaders)
include(ECMUninstallTarget)
if (ENABLE_X11)
find_package(XCB REQUIRED COMPONENTS XCB)
endif()
find_package(XKBCommon 0.5.0 REQUIRED COMPONENTS XKBCommon)
if (NOT BUILD_ONLY_PLUGIN)
find_package(Fcitx5Utils 5.0.16 REQUIRED)
endif()
if (ENABLE_X11)
find_package(X11 REQUIRED)
add_library(X11Import UNKNOWN IMPORTED)
set_target_properties(X11Import PROPERTIES
IMPORTED_LOCATION "${X11_X11_LIB}"
INTERFACE_INCLUDE_DIRECTORIES "${X11_X11_INCLUDE_PATH}")
endif()
if (BUILD_ONLY_PLUGIN)
# Dup a little bit option here.
include(CompilerSettings)
else()
include("${FCITX_INSTALL_CMAKECONFIG_DIR}/Fcitx5Utils/Fcitx5CompilerSettings.cmake")
find_package(Gettext REQUIRED)
endif()
set(Fcitx5Qt6_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR}/Fcitx5Qt6)
set(Fcitx5Qt5_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR}/Fcitx5Qt5)
set(Fcitx5Qt4_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR}/Fcitx5Qt4)
if(ENABLE_QT4)
add_subdirectory(qt4)
endif()
if(ENABLE_QT5)
add_subdirectory(qt5)
endif()
if(ENABLE_QT6)
add_subdirectory(qt6)
endif()
if(NOT BUILD_ONLY_PLUGIN)
add_subdirectory(po)
endif()
enable_testing()
add_subdirectory(test)
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)

View File

@@ -0,0 +1,26 @@
Copyright (c) <year> <owner>. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -0,0 +1,468 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies of this license
document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts as the
successor of the GNU Library Public License, version 2, hence the version
number 2.1.]
Preamble
The licenses for most software are designed to take away your freedom to share
and change it. By contrast, the GNU General Public Licenses are intended to
guarantee your freedom to share and change free software--to make sure the
software is free for all its users.
This license, the Lesser General Public License, applies to some specially
designated software packages--typically libraries--of the Free Software Foundation
and other authors who decide to use it. You can use it too, but we suggest
you first think carefully about whether this license or the ordinary General
Public License is the better strategy to use in any particular case, based
on the explanations below.
When we speak of free software, we are referring to freedom of use, 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 this service if you
wish); that you receive source code or can get it if you want it; that you
can change the software and use pieces of it in new free programs; and that
you are informed that you can do these things.
To protect your rights, we need to make restrictions that forbid distributors
to deny you these rights or to ask you to surrender these rights. These restrictions
translate to certain responsibilities for you if you distribute copies of
the library or if you modify it.
For example, if you distribute copies of the library, whether gratis or for
a fee, you must give the recipients all the rights that we gave you. You must
make sure that they, too, receive or can get the source code. If you link
other code with the library, you must provide complete object files to the
recipients, so that they can relink them with the library after making changes
to the library and recompiling it. And you must show them these terms so they
know their rights.
We protect your rights with a two-step method: (1) we copyright the library,
and (2) we offer you this license, which gives you legal permission to copy,
distribute and/or modify the library.
To protect each distributor, we want to make it very clear that there is no
warranty for the free library. Also, if the library is modified by someone
else and passed on, the recipients should know that what they have is not
the original version, so that the original author's reputation will not be
affected by problems that might be introduced by others.
Finally, software patents pose a constant threat to the existence of any free
program. We wish to make sure that a company cannot effectively restrict the
users of a free program by obtaining a restrictive license from a patent holder.
Therefore, we insist that any patent license obtained for a version of the
library must be consistent with the full freedom of use specified in this
license.
Most GNU software, including some libraries, is covered by the ordinary GNU
General Public License. This license, the GNU Lesser General Public License,
applies to certain designated libraries, and is quite different from the ordinary
General Public License. We use this license for certain libraries in order
to permit linking those libraries into non-free programs.
When a program is linked with a library, whether statically or using a shared
library, the combination of the two is legally speaking a combined work, a
derivative of the original library. The ordinary General Public License therefore
permits such linking only if the entire combination fits its criteria of freedom.
The Lesser General Public License permits more lax criteria for linking other
code with the library.
We call this license the "Lesser" General Public License because it does Less
to protect the user's freedom than the ordinary General Public License. It
also provides other free software developers Less of an advantage over competing
non-free programs. These disadvantages are the reason we use the ordinary
General Public License for many libraries. However, the Lesser license provides
advantages in certain special circumstances.
For example, on rare occasions, there may be a special need to encourage the
widest possible use of a certain library, so that it becomes a de-facto standard.
To achieve this, non-free programs must be allowed to use the library. A more
frequent case is that a free library does the same job as widely used non-free
libraries. In this case, there is little to gain by limiting the free library
to free software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free programs
enables a greater number of people to use a large body of free software. For
example, permission to use the GNU C Library in non-free programs enables
many more people to use the whole GNU operating system, as well as its variant,
the GNU/Linux operating system.
Although the Lesser General Public License is Less protective of the users'
freedom, it does ensure that the user of a program that is linked with the
Library has the freedom and the wherewithal to run that program using a modified
version of the Library.
The precise terms and conditions for copying, distribution and modification
follow. Pay close attention to the difference between a "work based on the
library" and a "work that uses the library". The former contains code derived
from the library, whereas the latter must be combined with the library in
order to run.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other program
which contains a notice placed by the copyright holder or other authorized
party saying it may be distributed under the terms of this Lesser General
Public License (also called "this License"). Each licensee is addressed as
"you".
A "library" means a collection of software functions and/or data prepared
so as to be conveniently linked with application programs (which use some
of those functions and data) to form executables.
The "Library", below, refers to any such software library or work which has
been distributed under these terms. A "work based on the Library" means either
the Library or any derivative work under copyright law: that is to say, a
work containing the Library or a portion of it, either verbatim or with modifications
and/or translated straightforwardly into another language. (Hereinafter, translation
is included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for making modifications
to it. For a library, complete source code means all the source code for all
modules it contains, plus any associated interface definition files, plus
the scripts used to control compilation and installation of the library.
Activities other than copying, distribution and modification are not covered
by this License; they are outside its scope. The act of running a program
using the Library is not restricted, and output from such a program is covered
only if its contents constitute a work based on the Library (independent of
the use of the Library in a tool for writing it). Whether that is true depends
on what the Library does and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's complete source
code as you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and disclaimer
of warranty; keep intact all the notices that refer to this License and to
the absence of any warranty; and distribute a copy of this License along with
the Library.
You may charge a fee for the physical act of transferring a copy, and you
may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Library or any portion of it,
thus forming a work based on the Library, and copy and distribute such modifications
or work under the terms of Section 1 above, provided that you also meet all
of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices stating that
you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no charge to all
third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a table of
data to be supplied by an application program that uses the facility, other
than as an argument passed when the facility is invoked, then you must make
a good faith effort to ensure that, in the event an application does not supply
such function or table, the facility still operates, and performs whatever
part of its purpose remains meaningful.
(For example, a function in a library to compute square roots has a purpose
that is entirely well-defined independent of the application. Therefore, Subsection
2d requires that any application-supplied function or table used by this function
must be optional: if the application does not supply it, the square root function
must still compute square roots.)
These requirements apply to the modified work as a whole. If identifiable
sections of that work are not derived from the Library, and can be reasonably
considered independent and separate works in themselves, then this License,
and its terms, do not apply to those sections when you distribute them as
separate works. But when you distribute the same sections as part of a whole
which is a work based on the Library, the distribution of the whole must be
on the terms of this License, whose permissions for other licensees extend
to the entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest your
rights to work written entirely by you; rather, the intent is to exercise
the right to control the distribution of derivative or collective works based
on the Library.
In addition, mere aggregation of another work not based on the Library with
the Library (or with a work based on the Library) on a volume of a storage
or distribution medium does not bring the other work under the scope of this
License.
3. You may opt to apply the terms of the ordinary GNU General Public License
instead of this License to a given copy of the Library. To do this, you must
alter all the notices that refer to this License, so that they refer to the
ordinary GNU General Public License, version 2, instead of to this License.
(If a newer version than version 2 of the ordinary GNU General Public License
has appeared, then you can specify that version instead if you wish.) Do not
make any other change in these notices.
Once this change is made in a given copy, it is irreversible for that copy,
so the ordinary GNU General Public License applies to all subsequent copies
and derivative works made from that copy.
This option is useful when you wish to copy part of the code of the Library
into a program that is not a library.
4. You may copy and distribute the Library (or a portion or derivative of
it, under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you accompany it with the complete corresponding
machine-readable source code, which must be distributed under the terms of
Sections 1 and 2 above on a medium customarily used for software interchange.
If distribution of object code is made by offering access to copy from a designated
place, then offering equivalent access to copy the source code from the same
place satisfies the requirement to distribute the source code, even though
third parties are not compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the Library, but
is designed to work with the Library by being compiled or linked with it,
is called a "work that uses the Library". Such a work, in isolation, is not
a derivative work of the Library, and therefore falls outside the scope of
this License.
However, linking a "work that uses the Library" with the Library creates an
executable that is a derivative of the Library (because it contains portions
of the Library), rather than a "work that uses the library". The executable
is therefore covered by this License. Section 6 states terms for distribution
of such executables.
When a "work that uses the Library" uses material from a header file that
is part of the Library, the object code for the work may be a derivative work
of the Library even though the source code is not. Whether this is true is
especially significant if the work can be linked without the Library, or if
the work is itself a library. The threshold for this to be true is not precisely
defined by law.
If such an object file uses only numerical parameters, data structure layouts
and accessors, and small macros and small inline functions (ten lines or less
in length), then the use of the object file is unrestricted, regardless of
whether it is legally a derivative work. (Executables containing this object
code plus portions of the Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may distribute
the object code for the work under the terms of Section 6. Any executables
containing that work also fall under Section 6, whether or not they are linked
directly with the Library itself.
6. As an exception to the Sections above, you may also combine or link a "work
that uses the Library" with the Library to produce a work containing portions
of the Library, and distribute that work under terms of your choice, provided
that the terms permit modification of the work for the customer's own use
and reverse engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the Library
is used in it and that the Library and its use are covered by this License.
You must supply a copy of this License. If the work during execution displays
copyright notices, you must include the copyright notice for the Library among
them, as well as a reference directing the user to the copy of this License.
Also, you must do one of these things:
a) Accompany the work with the complete corresponding machine-readable source
code for the Library including whatever changes were used in the work (which
must be distributed under Sections 1 and 2 above); and, if the work is an
executable linked with the Library, with the complete machine-readable "work
that uses the Library", as object code and/or source code, so that the user
can modify the Library and then relink to produce a modified executable containing
the modified Library. (It is understood that the user who changes the contents
of definitions files in the Library will not necessarily be able to recompile
the application to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the Library. A
suitable mechanism is one that (1) uses at run time a copy of the library
already present on the user's computer system, rather than copying library
functions into the executable, and (2) will operate properly with a modified
version of the library, if the user installs one, as long as the modified
version is interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at least three years,
to give the same user the materials specified in Subsection 6a, above, for
a charge no more than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy from a designated
place, offer equivalent access to copy the above specified materials from
the same place.
e) Verify that the user has already received a copy of these materials or
that you have already sent this user a copy.
For an executable, the required form of the "work that uses the Library" must
include any data and utility programs needed for reproducing the executable
from it. However, as a special exception, the materials to be distributed
need not include anything that is normally distributed (in either source or
binary form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component itself
accompanies the executable.
It may happen that this requirement contradicts the license restrictions of
other proprietary libraries that do not normally accompany the operating system.
Such a contradiction means you cannot use both them and the Library together
in an executable that you distribute.
7. You may place library facilities that are a work based on the Library side-by-side
in a single library together with other library facilities not covered by
this License, and distribute such a combined library, provided that the separate
distribution of the work based on the Library and of the other library facilities
is otherwise permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work based on the
Library, uncombined with any other library facilities. This must be distributed
under the terms of the Sections above.
b) Give prominent notice with the combined library of the fact that part of
it is a work based on the Library, and explaining where to find the accompanying
uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute the Library
except as expressly provided under this License. Any attempt otherwise to
copy, modify, sublicense, link with, or distribute the Library is void, and
will automatically terminate your rights under this License. However, parties
who have received copies, or rights, from you under this License will not
have their licenses terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not signed
it. However, nothing else grants you permission to modify or distribute the
Library or its derivative works. These actions are prohibited by law if you
do not accept this License. Therefore, by modifying or distributing the Library
(or any work based on the Library), you indicate your acceptance of this License
to do so, and all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the Library),
the recipient automatically receives a license from the original licensor
to copy, distribute, link with or modify the Library subject to these terms
and conditions. You may not impose any further restrictions on the recipients'
exercise of the rights granted herein. You are not responsible for enforcing
compliance by third parties with this License.
11. If, as a consequence of a court judgment or allegation of patent infringement
or for any other reason (not limited to patent issues), 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 distribute so as to satisfy simultaneously your
obligations under this License and any other pertinent obligations, then as
a consequence you may not distribute the Library at all. For example, if a
patent license would not permit royalty-free redistribution of the Library
by all those who receive copies directly or indirectly through you, then the
only way you could satisfy both it and this License would be to refrain entirely
from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents
or other property right claims or to contest validity of any such claims;
this section has the sole purpose of protecting the integrity of the free
software distribution system which is implemented by public license practices.
Many people have made generous contributions to the wide range of software
distributed through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing to
distribute software through any other system and a licensee cannot impose
that choice.
This section is intended to make thoroughly clear what is believed to be a
consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in certain
countries either by patents or by copyrighted interfaces, the original copyright
holder who places the Library under this License may add an explicit geographical
distribution limitation excluding those countries, so that distribution is
permitted only in or among countries not thus excluded. In such case, this
License incorporates the limitation as if written in the body of this License.
13. The Free Software Foundation may publish revised and/or new versions of
the Lesser 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 Library specifies
a version number of this License which applies to it and "any later version",
you have the option of following the terms and conditions either of that version
or of any later version published by the Free Software Foundation. If the
Library does not specify a license version number, you may choose any version
ever published by the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free programs
whose distribution conditions are incompatible with these, write to the author
to ask for permission. For software which is copyrighted by the Free Software
Foundation, write to the Free Software Foundation; we sometimes make exceptions
for this. Our decision will be guided by the two goals of preserving the free
status of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY
"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 LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
THE LIBRARY 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 LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH
HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest possible
use to the public, we recommend making it free software that everyone can
redistribute and change. You can do so by permitting redistribution under
these terms (or, alternatively, under the terms of the ordinary General Public
License).
To apply these terms, attach the following notices to the library. It is safest
to attach them to the start of each source file to most effectively convey
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 library's name and an idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 2.1 of the License, or (at your option)
any later version.
This library 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 Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License along
with this library; if not, write to the Free Software Foundation, Inc., 51
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your school,
if any, to sign a "copyright disclaimer" for the library, if necessary. Here
is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in
the library `Frob' (a library for tweaking knobs) written
by James Random Hacker.
< signature of Ty Coon > , 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

2
Telegram/ThirdParty/fcitx5-qt/Messages.sh vendored Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/bash#!/bin/bash
gen_pot cxx:desktop:ui fcitx5-qt po .

View File

@@ -0,0 +1,9 @@
Fcitx Qt Library
================================================
[![Jenkins Build Status](https://img.shields.io/jenkins/s/https/jenkins.fcitx-im.org/job/fcitx5-qt.svg)](https://jenkins.fcitx-im.org/job/fcitx5-qt/)
[![Coverity Scan Status](https://img.shields.io/coverity/scan/12701.svg)](https://scan.coverity.com/projects/fcitx-fcitx5-qt)
Files under qt4/ which include Fcitx5Qt4DBusAddons Library and Input context plugin are released under BSD (See COPYING.BSD).
Files under qt5/dbusaddons/ and qt5/platforminputcontext, which include Fcitx5Qt5DBusAddons Library and Qt5 Platform input context plugin, are released under BSD.
All other files are released under LGPL2.1+.

View File

@@ -0,0 +1,23 @@
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_C_STANDARD_REQUIRED TRUE)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_FLAGS "-Wall -Wextra ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-Wall -Wextra ${CMAKE_CXX_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined -Wl,--as-needed ${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined -Wl,--as-needed ${CMAKE_MODULE_LINKER_FLAGS}")
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN On)
# RPATH
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_FULL_LIBDIR}" _isSystemPlatformLibDir)
list(FIND CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_FULL_LIBDIR}" _isSystemCxxLibDir)
if("${_isSystemPlatformLibDir}" STREQUAL "-1" AND "${_isSystemCxxLibDir}" STREQUAL "-1")
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
endif("${_isSystemPlatformLibDir}" STREQUAL "-1" AND "${_isSystemCxxLibDir}" STREQUAL "-1")

View File

@@ -0,0 +1,44 @@
include(ECMFindModuleHelpersStub)
ecm_find_package_version_check(XKBCommon)
# Note that this list needs to be ordered such that any component
# appears after its dependencies
set(XKBCommon_known_components
XKBCommon
X11)
set(XKBCommon_XKBCommon_component_deps)
set(XKBCommon_XKBCommon_pkg_config "xkbcommon")
set(XKBCommon_XKBCommon_lib "xkbcommon")
set(XKBCommon_XKBCommon_header "xkbcommon/xkbcommon.h")
set(XKBCommon_X11_component_deps XKBCommon)
set(XKBCommon_X11_pkg_config "xkbcommon-x11")
set(XKBCommon_X11_lib "xkbcommon-x11")
set(XKBCommon_X11_header "xkbcommon/xkbcommon-x11.h")
ecm_find_package_parse_components(XKBCommon
RESULT_VAR XKBCommon_components
KNOWN_COMPONENTS ${XKBCommon_known_components}
)
ecm_find_package_handle_library_components(XKBCommon
COMPONENTS ${XKBCommon_components}
)
find_package_handle_standard_args(XKBCommon
FOUND_VAR
XKBCommon_FOUND
REQUIRED_VARS
XKBCommon_LIBRARIES
VERSION_VAR
XKBCommon_VERSION
HANDLE_COMPONENTS
)
include(FeatureSummary)
set_package_properties(XKBCommon PROPERTIES
URL "http://xkbcommon.org"
DESCRIPTION "Keyboard handling library using XKB data"
)

View File

@@ -0,0 +1,62 @@
/*
* SPDX-FileCopyrightText: 2012~2017 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#ifndef _COMMON_FCITXFLAGS_H_
#define _COMMON_FCITXFLAGS_H_
#include <cstdint>
namespace fcitx {
// This need to keep sync with fcitx5.
enum FcitxCapabilityFlag : uint64_t {
FcitxCapabilityFlag_Preedit = (1 << 1),
FcitxCapabilityFlag_Password = (1 << 3),
FcitxCapabilityFlag_FormattedPreedit = (1 << 4),
FcitxCapabilityFlag_ClientUnfocusCommit = (1 << 5),
FcitxCapabilityFlag_SurroundingText = (1 << 6),
FcitxCapabilityFlag_Email = (1 << 7),
FcitxCapabilityFlag_Digit = (1 << 8),
FcitxCapabilityFlag_Uppercase = (1 << 9),
FcitxCapabilityFlag_Lowercase = (1 << 10),
FcitxCapabilityFlag_NoAutoUpperCase = (1 << 11),
FcitxCapabilityFlag_Url = (1 << 12),
FcitxCapabilityFlag_Dialable = (1 << 13),
FcitxCapabilityFlag_Number = (1 << 14),
FcitxCapabilityFlag_NoSpellCheck = (1 << 17),
FcitxCapabilityFlag_Alpha = (1 << 21),
FcitxCapabilityFlag_GetIMInfoOnFocus = (1 << 23),
FcitxCapabilityFlag_RelativeRect = (1 << 24),
FcitxCapabilityFlag_Multiline = (1ull << 35),
FcitxCapabilityFlag_Sensitive = (1ull << 36),
FcitxCapabilityFlag_KeyEventOrderFix = (1ull << 37),
FcitxCapabilityFlag_ReportKeyRepeat = (1ull << 38),
FcitxCapabilityFlag_ClientSideInputPanel = (1ull << 39),
FcitxCapabilityFlag_Disable = (1ull << 40),
};
enum FcitxTextFormatFlag : int {
FcitxTextFormatFlag_Underline = (1 << 3), /**< underline is a flag */
FcitxTextFormatFlag_HighLight = (1 << 4), /**< highlight the preedit */
FcitxTextFormatFlag_DontCommit = (1 << 5),
FcitxTextFormatFlag_Bold = (1 << 6),
FcitxTextFormatFlag_Strike = (1 << 7),
FcitxTextFormatFlag_Italic = (1 << 8),
FcitxTextFormatFlag_None = 0,
};
enum FcitxKeyStates {
FcitxKeyState_Alt = 1 << 3,
FcitxKeyState_Shift = 1 << 0,
FcitxKeyState_Ctrl = 1 << 2,
};
enum class FcitxCandidateLayoutHint { NotSet, Vertical, Horizontal };
} // namespace fcitx
#endif // _COMMON_FCITXFLAGS_H_

View File

@@ -0,0 +1,2 @@
fcitx5_install_translation(fcitx5-qt)

View File

@@ -0,0 +1,12 @@
ca
da
de
es
fr
he
ja
ko
ru
zh_CN
zh_TW

254
Telegram/ThirdParty/fcitx5-qt/po/ca.po vendored Normal file
View File

@@ -0,0 +1,254 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the fcitx5-qt package.
#
# Translators:
# Robert Antoni Buj i Gelonch <rbuj@fedoraproject.org>, 2017
# csslayer <wengxt@gmail.com>, 2022
#
msgid ""
msgstr ""
"Project-Id-Version: fcitx5-qt\n"
"Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n"
"POT-Creation-Date: 2023-11-18 20:24+0000\n"
"PO-Revision-Date: 2017-12-20 02:52+0000\n"
"Last-Translator: csslayer <wengxt@gmail.com>, 2022\n"
"Language-Team: Catalan (https://app.transifex.com/fcitx/teams/12005/ca/)\n"
"Language: ca\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: qt5/quickphrase-editor/editor.cpp:260
msgid "%1 is a system file, do you want to delete all phrases instead?"
msgstr "%1 és un fitxer de sistema, voleu eliminar en canvi totes les frases?"
#. i18n: file: qt5/quickphrase-editor/editor.ui:52
#. i18n: ectx: property (text), widget (QPushButton, addButton)
#: rc.cpp:12
#, kde-format
msgid "&Add"
msgstr "&Afegeix"
#: qt5/guiwrapper/mainwindow.cpp:29 qt6/guiwrapper/mainwindow.cpp:29
msgid "&Apply"
msgstr "&Aplica"
#. i18n: file: qt5/quickphrase-editor/editor.ui:63
#. i18n: ectx: property (text), widget (QPushButton, batchEditButton)
#: rc.cpp:15
#, kde-format
msgid "&Batch Edit"
msgstr "Edita per &lots"
#: qt5/guiwrapper/mainwindow.cpp:31 qt6/guiwrapper/mainwindow.cpp:31
msgid "&Close"
msgstr "Tan&ca"
#. i18n: file: qt5/quickphrase-editor/editor.ui:74
#. i18n: ectx: property (text), widget (QPushButton, deleteButton)
#: rc.cpp:18
#, kde-format
msgid "&Delete"
msgstr "&Elimina"
#. i18n: file: qt5/quickphrase-editor/editor.ui:103
#. i18n: ectx: property (text), widget (QPushButton, importButton)
#: rc.cpp:24
#, kde-format
msgid "&Import"
msgstr "&Importa"
#: qt5/guiwrapper/mainwindow.cpp:28 qt6/guiwrapper/mainwindow.cpp:28
msgid "&Ok"
msgstr "D'ac&ord"
#. i18n: file: qt5/quickphrase-editor/editor.ui:45
#. i18n: ectx: property (text), widget (QPushButton, operationButton)
#: rc.cpp:9
#, kde-format
msgid "&Operation"
msgstr "&Operació"
#: qt5/guiwrapper/mainwindow.cpp:30 qt6/guiwrapper/mainwindow.cpp:30
msgid "&Reset"
msgstr "%Restableix"
#: qt5/guiwrapper/wrapperapp.cpp:31 qt6/guiwrapper/wrapperapp.cpp:31
msgid "A launcher for Fcitx Gui plugin."
msgstr "Un llançador per al connector de la interfície gràfica de Fcitx."
#: qt5/quickphrase-editor/editor.cpp:33
msgid "Add File"
msgstr "Afegeix un fitxer"
#: qt5/quickphrase-editor/editor.cpp:272
msgid "Are you sure to delete %1?"
msgstr "Segur que voleu eliminar %1?"
#. i18n: file: qt5/quickphrase-editor/batchdialog.ui:14
#. i18n: ectx: property (windowTitle), widget (QDialog, BatchDialog)
#: rc.cpp:3
#, kde-format
msgid "Batch editing"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:238
msgid "Cannot create file %1."
msgstr "No es pot crear el fitxer %1."
#: qt5/quickphrase-editor/editor.cpp:259
msgid "Cannot remove system file"
msgstr "No es pot eliminar el fitxer de sistema"
#: qt5/guiwrapper/wrapperapp.cpp:37 qt6/guiwrapper/wrapperapp.cpp:37
msgid "Config path"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:271
msgid "Confirm deletion"
msgstr "Confirma l'eliminació"
#: qt5/quickphrase-editor/editor.cpp:221
msgid "Create new file"
msgstr "Crea un fitxer nou"
#. i18n: file: qt5/quickphrase-editor/editor.ui:85
#. i18n: ectx: property (text), widget (QPushButton, clearButton)
#: rc.cpp:21
#, kde-format
msgid "De&lete All"
msgstr "E&limina-ho tot"
#: qt5/quickphrase-editor/filelistmodel.cpp:29
msgid "Default"
msgstr "Per defecte"
#. i18n: file: qt5/quickphrase-editor/editor.ui:114
#. i18n: ectx: property (text), widget (QPushButton, exportButton)
#: rc.cpp:27
#, kde-format
msgid "E&xport"
msgstr "E&xporta"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:355
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:324
msgid "Empty"
msgstr "Buit"
#: qt5/quickphrase-editor/editor.cpp:280
msgid "Error while deleting %1."
msgstr "S'ha produït un error quan s'estava eliminant %1."
#: qt5/guiwrapper/mainwindow.cpp:106 qt6/guiwrapper/mainwindow.cpp:106
msgid "Failed to notify Fcitx"
msgstr ""
#: qt5/guiwrapper/mainwindow.cpp:107 qt6/guiwrapper/mainwindow.cpp:107
msgid "Failed to notify Fcitx about the configuration change."
msgstr ""
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:3
msgid "Fcitx 5 Qt5 Gui Wrapper"
msgstr ""
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:3
msgid "Fcitx 5 Qt6 Gui Wrapper"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:237 qt5/quickphrase-editor/editor.cpp:279
msgid "File Operation Failed"
msgstr "Ha fallat l'operació de fitxer"
#: qt5/quickphrase-editor/editor.cpp:226
msgid "File name should not contain '/'."
msgstr "El nom de fitxer no hauria de contenir «/»."
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:4
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:4
msgid "Input Method Configuration helper"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:225
msgid "Invalid filename"
msgstr "Nom de fitxer no vàlid"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:179
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:148
msgid "Key code mode"
msgstr ""
#: qt5/quickphrase-editor/model.cpp:73
msgid "Keyword"
msgstr "Paraula clau"
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:5
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:5
msgid "Load configuration plugin for Fcitx Addon"
msgstr ""
#: qt5/guiwrapper/wrapperapp.cpp:34 qt6/guiwrapper/wrapperapp.cpp:34
msgid "Parent window ID"
msgstr ""
#: qt5/quickphrase-editor/model.cpp:75
msgid "Phrase"
msgstr "Frase"
#: qt5/quickphrase-editor/editor.cpp:221
msgid "Please input a filename for newfile"
msgstr "Si us plau, introduïu un nom de fitxer per al fitxer nou"
#: qt5/quickphrase-editor/editor.cpp:101
msgid "Quick Phrase Editor"
msgstr "Editor ràpid de frases"
#: qt5/quickphrase-editor/editor.cpp:37
msgid "Refresh List"
msgstr "Refresca la llista"
#: qt5/quickphrase-editor/editor.cpp:35
msgid "Remove File"
msgstr "Elimina un fitxer"
#: qt5/quickphrase-editor/editor.cpp:85
msgid "Save Changes"
msgstr "Desa els canvis"
#: qt5/guiwrapper/wrapperapp.cpp:35 qt6/guiwrapper/wrapperapp.cpp:35
msgid "Test if config exists"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:86
msgid ""
"The content has changed.\n"
"Do you want to save the changes or discard them?"
msgstr ""
"El contingut ha canviat.\n"
"Voleu desar els canvis o descartar-los?"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:392
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:361
msgid "The key you just pressed is not supported by Qt."
msgstr "La tecla que acabeu de prémer no té suport de Qt."
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:393
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:362
msgid "Unsupported Key"
msgstr "Tecla sense suport"
#. i18n: file: qt5/quickphrase-editor/batchdialog.ui:50
#. i18n: ectx: property (text), widget (QLabel, infoLabel)
#: rc.cpp:6
#, kde-format
msgid "Use <Keyword> <Phrase> format on every line."
msgstr "Useu el format <Paraula clau><Frase> a cada línia."
#: qt5/guiwrapper/wrapperapp.cpp:37 qt6/guiwrapper/wrapperapp.cpp:37
msgid "path"
msgstr "camí"
#: qt5/guiwrapper/wrapperapp.cpp:34 qt6/guiwrapper/wrapperapp.cpp:34
msgid "winid"
msgstr ""

254
Telegram/ThirdParty/fcitx5-qt/po/da.po vendored Normal file
View File

@@ -0,0 +1,254 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the fcitx5-qt package.
#
# Translators:
# scootergrisen, 2020
# csslayer <wengxt@gmail.com>, 2022
#
msgid ""
msgstr ""
"Project-Id-Version: fcitx5-qt\n"
"Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n"
"POT-Creation-Date: 2023-11-18 20:24+0000\n"
"PO-Revision-Date: 2017-12-20 02:52+0000\n"
"Last-Translator: csslayer <wengxt@gmail.com>, 2022\n"
"Language-Team: Danish (https://app.transifex.com/fcitx/teams/12005/da/)\n"
"Language: da\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: qt5/quickphrase-editor/editor.cpp:260
msgid "%1 is a system file, do you want to delete all phrases instead?"
msgstr "%1 er en systemfil. Vil du slette alle fraser i stedet?"
#. i18n: file: qt5/quickphrase-editor/editor.ui:52
#. i18n: ectx: property (text), widget (QPushButton, addButton)
#: rc.cpp:12
#, kde-format
msgid "&Add"
msgstr "&Tilføj"
#: qt5/guiwrapper/mainwindow.cpp:29 qt6/guiwrapper/mainwindow.cpp:29
msgid "&Apply"
msgstr "&Anvend"
#. i18n: file: qt5/quickphrase-editor/editor.ui:63
#. i18n: ectx: property (text), widget (QPushButton, batchEditButton)
#: rc.cpp:15
#, kde-format
msgid "&Batch Edit"
msgstr "&Batchredigering"
#: qt5/guiwrapper/mainwindow.cpp:31 qt6/guiwrapper/mainwindow.cpp:31
msgid "&Close"
msgstr "&Luk"
#. i18n: file: qt5/quickphrase-editor/editor.ui:74
#. i18n: ectx: property (text), widget (QPushButton, deleteButton)
#: rc.cpp:18
#, kde-format
msgid "&Delete"
msgstr "&Slet"
#. i18n: file: qt5/quickphrase-editor/editor.ui:103
#. i18n: ectx: property (text), widget (QPushButton, importButton)
#: rc.cpp:24
#, kde-format
msgid "&Import"
msgstr "&Importér"
#: qt5/guiwrapper/mainwindow.cpp:28 qt6/guiwrapper/mainwindow.cpp:28
msgid "&Ok"
msgstr "&OK"
#. i18n: file: qt5/quickphrase-editor/editor.ui:45
#. i18n: ectx: property (text), widget (QPushButton, operationButton)
#: rc.cpp:9
#, kde-format
msgid "&Operation"
msgstr "&Handling"
#: qt5/guiwrapper/mainwindow.cpp:30 qt6/guiwrapper/mainwindow.cpp:30
msgid "&Reset"
msgstr "&Nulstil"
#: qt5/guiwrapper/wrapperapp.cpp:31 qt6/guiwrapper/wrapperapp.cpp:31
msgid "A launcher for Fcitx Gui plugin."
msgstr "En starter til Fcitx grafisk brugerflade-plugin."
#: qt5/quickphrase-editor/editor.cpp:33
msgid "Add File"
msgstr "Tilføj fil"
#: qt5/quickphrase-editor/editor.cpp:272
msgid "Are you sure to delete %1?"
msgstr "Er du sikker på, at du vil slette %1?"
#. i18n: file: qt5/quickphrase-editor/batchdialog.ui:14
#. i18n: ectx: property (windowTitle), widget (QDialog, BatchDialog)
#: rc.cpp:3
#, kde-format
msgid "Batch editing"
msgstr "Batchredigering"
#: qt5/quickphrase-editor/editor.cpp:238
msgid "Cannot create file %1."
msgstr "Kan ikke oprette filen %1."
#: qt5/quickphrase-editor/editor.cpp:259
msgid "Cannot remove system file"
msgstr "Kan ikke fjerne systemfil"
#: qt5/guiwrapper/wrapperapp.cpp:37 qt6/guiwrapper/wrapperapp.cpp:37
msgid "Config path"
msgstr "Konfigurationssti"
#: qt5/quickphrase-editor/editor.cpp:271
msgid "Confirm deletion"
msgstr "Bekræft sletning"
#: qt5/quickphrase-editor/editor.cpp:221
msgid "Create new file"
msgstr "Opret ny fil"
#. i18n: file: qt5/quickphrase-editor/editor.ui:85
#. i18n: ectx: property (text), widget (QPushButton, clearButton)
#: rc.cpp:21
#, kde-format
msgid "De&lete All"
msgstr "Slet &alle"
#: qt5/quickphrase-editor/filelistmodel.cpp:29
msgid "Default"
msgstr "Standard"
#. i18n: file: qt5/quickphrase-editor/editor.ui:114
#. i18n: ectx: property (text), widget (QPushButton, exportButton)
#: rc.cpp:27
#, kde-format
msgid "E&xport"
msgstr "&Eksportér"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:355
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:324
msgid "Empty"
msgstr "Tøm"
#: qt5/quickphrase-editor/editor.cpp:280
msgid "Error while deleting %1."
msgstr "Fejl ved sletning af %1."
#: qt5/guiwrapper/mainwindow.cpp:106 qt6/guiwrapper/mainwindow.cpp:106
msgid "Failed to notify Fcitx"
msgstr "Kunne ikke underrette Fcitx"
#: qt5/guiwrapper/mainwindow.cpp:107 qt6/guiwrapper/mainwindow.cpp:107
msgid "Failed to notify Fcitx about the configuration change."
msgstr "Kunne ikke underrette Fcitx om ændringen i konfigurationen."
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:3
msgid "Fcitx 5 Qt5 Gui Wrapper"
msgstr ""
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:3
msgid "Fcitx 5 Qt6 Gui Wrapper"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:237 qt5/quickphrase-editor/editor.cpp:279
msgid "File Operation Failed"
msgstr "Filhandling mislykkedes"
#: qt5/quickphrase-editor/editor.cpp:226
msgid "File name should not contain '/'."
msgstr "Filnavn må ikke indeholde '/'."
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:4
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:4
msgid "Input Method Configuration helper"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:225
msgid "Invalid filename"
msgstr "Ugyldigt filnavn"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:179
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:148
msgid "Key code mode"
msgstr "Tastekode-tilstand"
#: qt5/quickphrase-editor/model.cpp:73
msgid "Keyword"
msgstr "Nøgleord"
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:5
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:5
msgid "Load configuration plugin for Fcitx Addon"
msgstr ""
#: qt5/guiwrapper/wrapperapp.cpp:34 qt6/guiwrapper/wrapperapp.cpp:34
msgid "Parent window ID"
msgstr "Forælder vinduets id"
#: qt5/quickphrase-editor/model.cpp:75
msgid "Phrase"
msgstr "Frase"
#: qt5/quickphrase-editor/editor.cpp:221
msgid "Please input a filename for newfile"
msgstr "Skriv venligst et filnavn til den nye fil"
#: qt5/quickphrase-editor/editor.cpp:101
msgid "Quick Phrase Editor"
msgstr "Hurtig fraseredigering"
#: qt5/quickphrase-editor/editor.cpp:37
msgid "Refresh List"
msgstr "Genopfrisk liste"
#: qt5/quickphrase-editor/editor.cpp:35
msgid "Remove File"
msgstr "Fjern fil"
#: qt5/quickphrase-editor/editor.cpp:85
msgid "Save Changes"
msgstr "Gem ændringer"
#: qt5/guiwrapper/wrapperapp.cpp:35 qt6/guiwrapper/wrapperapp.cpp:35
msgid "Test if config exists"
msgstr "Test om konfiguration findes"
#: qt5/quickphrase-editor/editor.cpp:86
msgid ""
"The content has changed.\n"
"Do you want to save the changes or discard them?"
msgstr ""
"Indholdet er blevet ændret.\n"
"Vil du gemme ændringerne eller forkaste dem?"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:392
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:361
msgid "The key you just pressed is not supported by Qt."
msgstr "Tasten du lige har trykket på understøttes ikke af Qt."
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:393
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:362
msgid "Unsupported Key"
msgstr "Ikkeunderstøttet tast"
#. i18n: file: qt5/quickphrase-editor/batchdialog.ui:50
#. i18n: ectx: property (text), widget (QLabel, infoLabel)
#: rc.cpp:6
#, kde-format
msgid "Use <Keyword> <Phrase> format on every line."
msgstr "Brug <Keyword> <Phrase>-format på hver linje."
#: qt5/guiwrapper/wrapperapp.cpp:37 qt6/guiwrapper/wrapperapp.cpp:37
msgid "path"
msgstr "sti"
#: qt5/guiwrapper/wrapperapp.cpp:34 qt6/guiwrapper/wrapperapp.cpp:34
msgid "winid"
msgstr "winid"

255
Telegram/ThirdParty/fcitx5-qt/po/de.po vendored Normal file
View File

@@ -0,0 +1,255 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the fcitx5-qt package.
#
# Translators:
# mar well <m.wellendorf@gmx.de>, 2018
# Tim Hofstede <timhofstede.va@gmail.com>, 2018
# csslayer <wengxt@gmail.com>, 2022
#
msgid ""
msgstr ""
"Project-Id-Version: fcitx5-qt\n"
"Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n"
"POT-Creation-Date: 2023-11-18 20:24+0000\n"
"PO-Revision-Date: 2017-12-20 02:52+0000\n"
"Last-Translator: csslayer <wengxt@gmail.com>, 2022\n"
"Language-Team: German (https://app.transifex.com/fcitx/teams/12005/de/)\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: qt5/quickphrase-editor/editor.cpp:260
msgid "%1 is a system file, do you want to delete all phrases instead?"
msgstr "%1 ist eine Systemdatei, wollen Sie stattdessen alle Phrasen löschen?"
#. i18n: file: qt5/quickphrase-editor/editor.ui:52
#. i18n: ectx: property (text), widget (QPushButton, addButton)
#: rc.cpp:12
#, kde-format
msgid "&Add"
msgstr "&Hinzufügen"
#: qt5/guiwrapper/mainwindow.cpp:29 qt6/guiwrapper/mainwindow.cpp:29
msgid "&Apply"
msgstr "&Anwenden"
#. i18n: file: qt5/quickphrase-editor/editor.ui:63
#. i18n: ectx: property (text), widget (QPushButton, batchEditButton)
#: rc.cpp:15
#, kde-format
msgid "&Batch Edit"
msgstr "&Stapelbearbeitung"
#: qt5/guiwrapper/mainwindow.cpp:31 qt6/guiwrapper/mainwindow.cpp:31
msgid "&Close"
msgstr "&Schließen"
#. i18n: file: qt5/quickphrase-editor/editor.ui:74
#. i18n: ectx: property (text), widget (QPushButton, deleteButton)
#: rc.cpp:18
#, kde-format
msgid "&Delete"
msgstr "&Löschen"
#. i18n: file: qt5/quickphrase-editor/editor.ui:103
#. i18n: ectx: property (text), widget (QPushButton, importButton)
#: rc.cpp:24
#, kde-format
msgid "&Import"
msgstr "&Importieren"
#: qt5/guiwrapper/mainwindow.cpp:28 qt6/guiwrapper/mainwindow.cpp:28
msgid "&Ok"
msgstr "&Ok"
#. i18n: file: qt5/quickphrase-editor/editor.ui:45
#. i18n: ectx: property (text), widget (QPushButton, operationButton)
#: rc.cpp:9
#, kde-format
msgid "&Operation"
msgstr "&Operation"
#: qt5/guiwrapper/mainwindow.cpp:30 qt6/guiwrapper/mainwindow.cpp:30
msgid "&Reset"
msgstr "&Zurücksetzen"
#: qt5/guiwrapper/wrapperapp.cpp:31 qt6/guiwrapper/wrapperapp.cpp:31
msgid "A launcher for Fcitx Gui plugin."
msgstr "Ein Starter für das Fcitx-Oberflächen-Plugin"
#: qt5/quickphrase-editor/editor.cpp:33
msgid "Add File"
msgstr "Datei hinzufügen"
#: qt5/quickphrase-editor/editor.cpp:272
msgid "Are you sure to delete %1?"
msgstr "Wollen Sie %1 wirklich löschen?"
#. i18n: file: qt5/quickphrase-editor/batchdialog.ui:14
#. i18n: ectx: property (windowTitle), widget (QDialog, BatchDialog)
#: rc.cpp:3
#, kde-format
msgid "Batch editing"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:238
msgid "Cannot create file %1."
msgstr "Datei %1 kann nicht erstellt werden."
#: qt5/quickphrase-editor/editor.cpp:259
msgid "Cannot remove system file"
msgstr "Systemdatei kann nicht entfernt werden."
#: qt5/guiwrapper/wrapperapp.cpp:37 qt6/guiwrapper/wrapperapp.cpp:37
msgid "Config path"
msgstr "Konfigurationspfad"
#: qt5/quickphrase-editor/editor.cpp:271
msgid "Confirm deletion"
msgstr "Löschen bestätigen"
#: qt5/quickphrase-editor/editor.cpp:221
msgid "Create new file"
msgstr "Neue Datei erzeugen"
#. i18n: file: qt5/quickphrase-editor/editor.ui:85
#. i18n: ectx: property (text), widget (QPushButton, clearButton)
#: rc.cpp:21
#, kde-format
msgid "De&lete All"
msgstr "Alle lö&schen"
#: qt5/quickphrase-editor/filelistmodel.cpp:29
msgid "Default"
msgstr "Standard"
#. i18n: file: qt5/quickphrase-editor/editor.ui:114
#. i18n: ectx: property (text), widget (QPushButton, exportButton)
#: rc.cpp:27
#, kde-format
msgid "E&xport"
msgstr "E&xportieren"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:355
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:324
msgid "Empty"
msgstr "Leer"
#: qt5/quickphrase-editor/editor.cpp:280
msgid "Error while deleting %1."
msgstr "Fehler beim Löschen von %1."
#: qt5/guiwrapper/mainwindow.cpp:106 qt6/guiwrapper/mainwindow.cpp:106
msgid "Failed to notify Fcitx"
msgstr ""
#: qt5/guiwrapper/mainwindow.cpp:107 qt6/guiwrapper/mainwindow.cpp:107
msgid "Failed to notify Fcitx about the configuration change."
msgstr ""
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:3
msgid "Fcitx 5 Qt5 Gui Wrapper"
msgstr ""
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:3
msgid "Fcitx 5 Qt6 Gui Wrapper"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:237 qt5/quickphrase-editor/editor.cpp:279
msgid "File Operation Failed"
msgstr "Dateioperation fehlgeschlagen"
#: qt5/quickphrase-editor/editor.cpp:226
msgid "File name should not contain '/'."
msgstr "Dateiname darf kein '/' enthalten."
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:4
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:4
msgid "Input Method Configuration helper"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:225
msgid "Invalid filename"
msgstr "Ungültiger Dateiname"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:179
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:148
msgid "Key code mode"
msgstr "Tastencode-Modus"
#: qt5/quickphrase-editor/model.cpp:73
msgid "Keyword"
msgstr "Schlüsselwort"
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:5
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:5
msgid "Load configuration plugin for Fcitx Addon"
msgstr ""
#: qt5/guiwrapper/wrapperapp.cpp:34 qt6/guiwrapper/wrapperapp.cpp:34
msgid "Parent window ID"
msgstr "ID des Vorläuferfensters"
#: qt5/quickphrase-editor/model.cpp:75
msgid "Phrase"
msgstr "Phrase"
#: qt5/quickphrase-editor/editor.cpp:221
msgid "Please input a filename for newfile"
msgstr "Bitte für die neue Datei einen Namen eingeben"
#: qt5/quickphrase-editor/editor.cpp:101
msgid "Quick Phrase Editor"
msgstr "Quick Phrase Editor"
#: qt5/quickphrase-editor/editor.cpp:37
msgid "Refresh List"
msgstr "Liste neu laden"
#: qt5/quickphrase-editor/editor.cpp:35
msgid "Remove File"
msgstr "Datei entfernen"
#: qt5/quickphrase-editor/editor.cpp:85
msgid "Save Changes"
msgstr "Änderungen speichern"
#: qt5/guiwrapper/wrapperapp.cpp:35 qt6/guiwrapper/wrapperapp.cpp:35
msgid "Test if config exists"
msgstr "Testen, ob eine Konfiguration existiert"
#: qt5/quickphrase-editor/editor.cpp:86
msgid ""
"The content has changed.\n"
"Do you want to save the changes or discard them?"
msgstr ""
"Der Inhalt hat sich geändert.\n"
"Möchten Sie die Änderungen speichern oder verwerfen?"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:392
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:361
msgid "The key you just pressed is not supported by Qt."
msgstr "Die Taste wird von Qt nicht unterstützt."
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:393
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:362
msgid "Unsupported Key"
msgstr "Nicht unterstützte Taste"
#. i18n: file: qt5/quickphrase-editor/batchdialog.ui:50
#. i18n: ectx: property (text), widget (QLabel, infoLabel)
#: rc.cpp:6
#, kde-format
msgid "Use <Keyword> <Phrase> format on every line."
msgstr "Benutze <Keyword> <Phrase> Format in jeder Linie."
#: qt5/guiwrapper/wrapperapp.cpp:37 qt6/guiwrapper/wrapperapp.cpp:37
msgid "path"
msgstr "Pfad"
#: qt5/guiwrapper/wrapperapp.cpp:34 qt6/guiwrapper/wrapperapp.cpp:34
msgid "winid"
msgstr "winid"

476
Telegram/ThirdParty/fcitx5-qt/po/es.po vendored Normal file
View File

@@ -0,0 +1,476 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Adolfo Jayme Barrientos, 2012
msgid ""
msgstr ""
"Project-Id-Version: fcitx5-qt\n"
"Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n"
"POT-Creation-Date: 2023-11-18 20:22+0000\n"
"PO-Revision-Date: 2015-12-12 07:18+0000\n"
"Last-Translator: csslayer <wengxt@gmail.com>\n"
"Language-Team: Spanish (http://www.transifex.com/fcitx/fcitx/language/es/)\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: qt5/quickphrase-editor/editor.cpp:260
msgid "%1 is a system file, do you want to delete all phrases instead?"
msgstr ""
#. i18n: file: qt5/quickphrase-editor/editor.ui:52
#. i18n: ectx: property (text), widget (QPushButton, addButton)
#: rc.cpp:12
#, kde-format
msgid "&Add"
msgstr ""
#: qt5/guiwrapper/mainwindow.cpp:29 qt6/guiwrapper/mainwindow.cpp:29
msgid "&Apply"
msgstr ""
#. i18n: file: qt5/quickphrase-editor/editor.ui:63
#. i18n: ectx: property (text), widget (QPushButton, batchEditButton)
#: rc.cpp:15
#, kde-format
msgid "&Batch Edit"
msgstr ""
#: qt5/guiwrapper/mainwindow.cpp:31 qt6/guiwrapper/mainwindow.cpp:31
msgid "&Close"
msgstr ""
#. i18n: file: qt5/quickphrase-editor/editor.ui:74
#. i18n: ectx: property (text), widget (QPushButton, deleteButton)
#: rc.cpp:18
#, kde-format
msgid "&Delete"
msgstr ""
#. i18n: file: qt5/quickphrase-editor/editor.ui:103
#. i18n: ectx: property (text), widget (QPushButton, importButton)
#: rc.cpp:24
#, kde-format
msgid "&Import"
msgstr ""
#: qt5/guiwrapper/mainwindow.cpp:28 qt6/guiwrapper/mainwindow.cpp:28
msgid "&Ok"
msgstr ""
#. i18n: file: qt5/quickphrase-editor/editor.ui:45
#. i18n: ectx: property (text), widget (QPushButton, operationButton)
#: rc.cpp:9
#, kde-format
msgid "&Operation"
msgstr ""
#: qt5/guiwrapper/mainwindow.cpp:30 qt6/guiwrapper/mainwindow.cpp:30
msgid "&Reset"
msgstr ""
#: qt5/guiwrapper/wrapperapp.cpp:31 qt6/guiwrapper/wrapperapp.cpp:31
msgid "A launcher for Fcitx Gui plugin."
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:33
msgid "Add File"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:272
msgid "Are you sure to delete %1?"
msgstr ""
#. i18n: file: qt5/quickphrase-editor/batchdialog.ui:14
#. i18n: ectx: property (windowTitle), widget (QDialog, BatchDialog)
#: rc.cpp:3
#, kde-format
msgid "Batch editing"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:238
msgid "Cannot create file %1."
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:259
msgid "Cannot remove system file"
msgstr ""
#: qt5/guiwrapper/wrapperapp.cpp:37 qt6/guiwrapper/wrapperapp.cpp:37
#, fuzzy
msgid "Config path"
msgstr "Configurar"
#: qt5/quickphrase-editor/editor.cpp:271
msgid "Confirm deletion"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:221
msgid "Create new file"
msgstr ""
#. i18n: file: qt5/quickphrase-editor/editor.ui:85
#. i18n: ectx: property (text), widget (QPushButton, clearButton)
#: rc.cpp:21
#, kde-format
msgid "De&lete All"
msgstr ""
#: qt5/quickphrase-editor/filelistmodel.cpp:29
msgid "Default"
msgstr ""
#. i18n: file: qt5/quickphrase-editor/editor.ui:114
#. i18n: ectx: property (text), widget (QPushButton, exportButton)
#: rc.cpp:27
#, kde-format
msgid "E&xport"
msgstr ""
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:355
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:324
msgid "Empty"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:280
msgid "Error while deleting %1."
msgstr ""
#: qt5/guiwrapper/mainwindow.cpp:106 qt6/guiwrapper/mainwindow.cpp:106
msgid "Failed to notify Fcitx"
msgstr ""
#: qt5/guiwrapper/mainwindow.cpp:107 qt6/guiwrapper/mainwindow.cpp:107
msgid "Failed to notify Fcitx about the configuration change."
msgstr ""
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:3
msgid "Fcitx 5 Qt5 Gui Wrapper"
msgstr ""
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:3
msgid "Fcitx 5 Qt6 Gui Wrapper"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:237 qt5/quickphrase-editor/editor.cpp:279
msgid "File Operation Failed"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:226
msgid "File name should not contain '/'."
msgstr ""
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:4
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:4
#, fuzzy
msgid "Input Method Configuration helper"
msgstr "Método de entrada desactivado"
#: qt5/quickphrase-editor/editor.cpp:225
msgid "Invalid filename"
msgstr ""
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:179
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:148
msgid "Key code mode"
msgstr ""
#: qt5/quickphrase-editor/model.cpp:73
msgid "Keyword"
msgstr ""
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:5
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:5
msgid "Load configuration plugin for Fcitx Addon"
msgstr ""
#: qt5/guiwrapper/wrapperapp.cpp:34 qt6/guiwrapper/wrapperapp.cpp:34
msgid "Parent window ID"
msgstr ""
#: qt5/quickphrase-editor/model.cpp:75
msgid "Phrase"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:221
msgid "Please input a filename for newfile"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:101
#, fuzzy
msgid "Quick Phrase Editor"
msgstr "Lista de frases rápidas"
#: qt5/quickphrase-editor/editor.cpp:37
msgid "Refresh List"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:35
msgid "Remove File"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:85
msgid "Save Changes"
msgstr ""
#: qt5/guiwrapper/wrapperapp.cpp:35 qt6/guiwrapper/wrapperapp.cpp:35
msgid "Test if config exists"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:86
msgid ""
"The content has changed.\n"
"Do you want to save the changes or discard them?"
msgstr ""
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:392
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:361
msgid "The key you just pressed is not supported by Qt."
msgstr ""
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:393
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:362
msgid "Unsupported Key"
msgstr ""
#. i18n: file: qt5/quickphrase-editor/batchdialog.ui:50
#. i18n: ectx: property (text), widget (QLabel, infoLabel)
#: rc.cpp:6
#, kde-format
msgid "Use <Keyword> <Phrase> format on every line."
msgstr ""
#: qt5/guiwrapper/wrapperapp.cpp:37 qt6/guiwrapper/wrapperapp.cpp:37
msgid "path"
msgstr ""
#: qt5/guiwrapper/wrapperapp.cpp:34 qt6/guiwrapper/wrapperapp.cpp:34
msgid "winid"
msgstr ""
#~ msgid " Ctrl+Delete To Delete"
#~ msgstr "Ctrl+Supr para eliminar"
#~ msgid "All"
#~ msgstr "Todo"
#~ msgid "Appearance"
#~ msgstr "Apariencia"
#~ msgid "Auto Create Phrase"
#~ msgstr "Crear frase automáticamente"
#~ msgid "Background Image"
#~ msgstr "Imagen de fondo"
#~ msgid "Candidate Word Number"
#~ msgstr "Número de palabra candidata"
#~ msgid "Category"
#~ msgstr "Categoría"
#~ msgid "Code is "
#~ msgstr "El código es"
#~ msgid "Color of Cursor"
#~ msgstr "Color del cursor"
#~ msgid "Comment"
#~ msgstr "Comentario"
#~ msgid "Convert Simplified Chinese To Traditional Chinese"
#~ msgstr "Convertir chino simplificado a chino tradicional"
#~ msgid "Copy"
#~ msgstr "Copiar"
#~ msgid "Current Enabled Input Method List"
#~ msgstr "Lista de métodos de entrada activados"
#~ msgid "Current Input Method Name"
#~ msgstr "Nombre del método de entrada actual"
#~ msgid "Default Input Method State"
#~ msgstr "Estado predeterminado del método de entrada"
#~ msgid "Dependency"
#~ msgstr "Dependencia"
#~ msgid "Disabled"
#~ msgstr "Desactivado"
#~ msgid "Do not show input window if there is only preedit string"
#~ msgstr "No mostrar ventanas de entrada si solo hay una cadena preeditada"
#~ msgid "Enable"
#~ msgstr "Activar"
#~ msgid "Enabled"
#~ msgstr "Activado"
#~ msgid "Error: Load fontconfig failed"
#~ msgstr "Error: Falló la carga de fontconfig"
#~ msgid "Exit"
#~ msgstr "Salir"
#~ msgid "Fcitx"
#~ msgstr "Fcitx"
#~ msgid "Font"
#~ msgstr "Tipo de letra"
#~ msgid "Frontend"
#~ msgstr "Interfaz"
#~ msgid "Hide"
#~ msgstr "Ocultar"
#~ msgid "Inactive"
#~ msgstr "Inactivo"
#~ msgid "Input Font Size"
#~ msgstr "Tamaño de letra de entrada"
#~ msgid "Input Method"
#~ msgstr "Método de entrada"
#~ msgid "Input Speed: "
#~ msgstr "Velocidad de entrada"
#~ msgid ""
#~ "Left/Right to choose selected character, Press Enter to confirm, Press "
#~ "Escape to Cancel"
#~ msgstr ""
#~ "Izq/Der para elegir el carácter seleccionado. Oprima Intro para "
#~ "confirmar. Oprima Escape para cancelar."
#~ msgid "Library"
#~ msgstr "Biblioteca"
#~ msgid "MS"
#~ msgstr "MS"
#~ msgid "Menu Font"
#~ msgstr "Tipo de letra del menú"
#~ msgid "Menu Font Size"
#~ msgstr "Tamaño de letra de los menús"
#~ msgid "Migrate the old file path to the new one"
#~ msgstr "Migrar la ruta de archivo anterior a la nueva"
#~ msgid "Module"
#~ msgstr "Módulo"
#~ msgid "Name"
#~ msgstr "Nombre"
#~ msgid "Name that can be display in UI"
#~ msgstr "Nombre que puede mostrarse en la IU"
#~ msgid "Native"
#~ msgstr "Nativo"
#~ msgid "No"
#~ msgstr "No"
#~ msgid "Online Help"
#~ msgstr "Ayuda en línea"
#~ msgid "OpenCC"
#~ msgstr "OpenCC"
#~ msgid "Other Color"
#~ msgstr "Otro color"
#~ msgid "Output"
#~ msgstr "Salida"
#~ msgid "Parent"
#~ msgstr "Padre"
#~ msgid "Pinyin"
#~ msgstr "Pinyin"
#~ msgid "Pinyin: "
#~ msgstr "Pinyin:"
#~ msgid "Press Enter to input text"
#~ msgstr "Oprima Intro para introducir texto"
#~ msgid "Priority"
#~ msgstr "Prioridad"
#~ msgid "Resize"
#~ msgstr "Redimensionar"
#~ msgid "Save Auto Created Phrase"
#~ msgstr "Guardar la frase creada automáticamente"
#~ msgid "Show"
#~ msgstr "Mostrar"
#~ msgid "Show Input Speed"
#~ msgstr "Mostrar velocidad de entrada"
#~ msgid "Show Version"
#~ msgstr "Mostrar versión"
#~ msgid "Shuang Pin Schema"
#~ msgstr "Shuang Pin Schema"
#~ msgid "Shuangpin"
#~ msgstr "Shuangpin"
#~ msgid "Table"
#~ msgstr "Tabla"
#~ msgid "Type"
#~ msgstr "Tipo"
#~ msgid "UI"
#~ msgstr "IU"
#~ msgid "Unique Name for Table"
#~ msgstr "Nombre único para la tabla"
#~ msgid "Use Complete Pinyin"
#~ msgstr "Usar pinyin completo"
#~ msgid "Use Full Width Character"
#~ msgstr "Usar carácter de anchura completa"
#~ msgid "Use System Tray Icon"
#~ msgstr "Usar icono en el área de notificación"
#~ msgid "Use Wide Punctuation"
#~ msgstr "Usar puntuación ancha"
#~ msgid "User Defined"
#~ msgstr "Definido por el usuario"
#~ msgid "Virtual Keyboard"
#~ msgstr "Teclado virtual"
#~ msgid "Virtual Keyboard State"
#~ msgstr "Estado del teclado virtual"
#~ msgid "X11 not initialized"
#~ msgstr "X11 no inicializado"
#~ msgid "Zhongwenzhixing"
#~ msgstr "Zhongwenzhixing"
#~ msgid "Ziguang"
#~ msgstr "Ziguang"
#~ msgid "Ziranma"
#~ msgstr "Ziranma"
#~ msgid "your current font is: %s"
#~ msgstr "su tipo de letra actual es: %s"

View File

@@ -0,0 +1,247 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the fcitx5-qt package.
#
msgid ""
msgstr ""
"Project-Id-Version: fcitx5-qt\n"
"Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n"
"POT-Creation-Date: 2023-11-18 20:24+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: LANG\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: qt5/quickphrase-editor/editor.cpp:260
msgid "%1 is a system file, do you want to delete all phrases instead?"
msgstr ""
#. i18n: file: qt5/quickphrase-editor/editor.ui:52
#. i18n: ectx: property (text), widget (QPushButton, addButton)
#: rc.cpp:12
#, kde-format
msgid "&Add"
msgstr ""
#: qt5/guiwrapper/mainwindow.cpp:29 qt6/guiwrapper/mainwindow.cpp:29
msgid "&Apply"
msgstr ""
#. i18n: file: qt5/quickphrase-editor/editor.ui:63
#. i18n: ectx: property (text), widget (QPushButton, batchEditButton)
#: rc.cpp:15
#, kde-format
msgid "&Batch Edit"
msgstr ""
#: qt5/guiwrapper/mainwindow.cpp:31 qt6/guiwrapper/mainwindow.cpp:31
msgid "&Close"
msgstr ""
#. i18n: file: qt5/quickphrase-editor/editor.ui:74
#. i18n: ectx: property (text), widget (QPushButton, deleteButton)
#: rc.cpp:18
#, kde-format
msgid "&Delete"
msgstr ""
#. i18n: file: qt5/quickphrase-editor/editor.ui:103
#. i18n: ectx: property (text), widget (QPushButton, importButton)
#: rc.cpp:24
#, kde-format
msgid "&Import"
msgstr ""
#: qt5/guiwrapper/mainwindow.cpp:28 qt6/guiwrapper/mainwindow.cpp:28
msgid "&Ok"
msgstr ""
#. i18n: file: qt5/quickphrase-editor/editor.ui:45
#. i18n: ectx: property (text), widget (QPushButton, operationButton)
#: rc.cpp:9
#, kde-format
msgid "&Operation"
msgstr ""
#: qt5/guiwrapper/mainwindow.cpp:30 qt6/guiwrapper/mainwindow.cpp:30
msgid "&Reset"
msgstr ""
#: qt5/guiwrapper/wrapperapp.cpp:31 qt6/guiwrapper/wrapperapp.cpp:31
msgid "A launcher for Fcitx Gui plugin."
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:33
msgid "Add File"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:272
msgid "Are you sure to delete %1?"
msgstr ""
#. i18n: file: qt5/quickphrase-editor/batchdialog.ui:14
#. i18n: ectx: property (windowTitle), widget (QDialog, BatchDialog)
#: rc.cpp:3
#, kde-format
msgid "Batch editing"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:238
msgid "Cannot create file %1."
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:259
msgid "Cannot remove system file"
msgstr ""
#: qt5/guiwrapper/wrapperapp.cpp:37 qt6/guiwrapper/wrapperapp.cpp:37
msgid "Config path"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:271
msgid "Confirm deletion"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:221
msgid "Create new file"
msgstr ""
#. i18n: file: qt5/quickphrase-editor/editor.ui:85
#. i18n: ectx: property (text), widget (QPushButton, clearButton)
#: rc.cpp:21
#, kde-format
msgid "De&lete All"
msgstr ""
#: qt5/quickphrase-editor/filelistmodel.cpp:29
msgid "Default"
msgstr ""
#. i18n: file: qt5/quickphrase-editor/editor.ui:114
#. i18n: ectx: property (text), widget (QPushButton, exportButton)
#: rc.cpp:27
#, kde-format
msgid "E&xport"
msgstr ""
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:355
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:324
msgid "Empty"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:280
msgid "Error while deleting %1."
msgstr ""
#: qt5/guiwrapper/mainwindow.cpp:106 qt6/guiwrapper/mainwindow.cpp:106
msgid "Failed to notify Fcitx"
msgstr ""
#: qt5/guiwrapper/mainwindow.cpp:107 qt6/guiwrapper/mainwindow.cpp:107
msgid "Failed to notify Fcitx about the configuration change."
msgstr ""
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:3
msgid "Fcitx 5 Qt5 Gui Wrapper"
msgstr ""
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:3
msgid "Fcitx 5 Qt6 Gui Wrapper"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:237 qt5/quickphrase-editor/editor.cpp:279
msgid "File Operation Failed"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:226
msgid "File name should not contain '/'."
msgstr ""
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:4
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:4
msgid "Input Method Configuration helper"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:225
msgid "Invalid filename"
msgstr ""
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:179
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:148
msgid "Key code mode"
msgstr ""
#: qt5/quickphrase-editor/model.cpp:73
msgid "Keyword"
msgstr ""
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:5
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:5
msgid "Load configuration plugin for Fcitx Addon"
msgstr ""
#: qt5/guiwrapper/wrapperapp.cpp:34 qt6/guiwrapper/wrapperapp.cpp:34
msgid "Parent window ID"
msgstr ""
#: qt5/quickphrase-editor/model.cpp:75
msgid "Phrase"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:221
msgid "Please input a filename for newfile"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:101
msgid "Quick Phrase Editor"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:37
msgid "Refresh List"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:35
msgid "Remove File"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:85
msgid "Save Changes"
msgstr ""
#: qt5/guiwrapper/wrapperapp.cpp:35 qt6/guiwrapper/wrapperapp.cpp:35
msgid "Test if config exists"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:86
msgid ""
"The content has changed.\n"
"Do you want to save the changes or discard them?"
msgstr ""
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:392
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:361
msgid "The key you just pressed is not supported by Qt."
msgstr ""
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:393
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:362
msgid "Unsupported Key"
msgstr ""
#. i18n: file: qt5/quickphrase-editor/batchdialog.ui:50
#. i18n: ectx: property (text), widget (QLabel, infoLabel)
#: rc.cpp:6
#, kde-format
msgid "Use <Keyword> <Phrase> format on every line."
msgstr ""
#: qt5/guiwrapper/wrapperapp.cpp:37 qt6/guiwrapper/wrapperapp.cpp:37
msgid "path"
msgstr ""
#: qt5/guiwrapper/wrapperapp.cpp:34 qt6/guiwrapper/wrapperapp.cpp:34
msgid "winid"
msgstr ""

257
Telegram/ThirdParty/fcitx5-qt/po/fr.po vendored Normal file
View File

@@ -0,0 +1,257 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the fcitx5-qt package.
#
# Translators:
# roxfr <roxfr@outlook.fr>, 2022
#
msgid ""
msgstr ""
"Project-Id-Version: fcitx5-qt\n"
"Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n"
"POT-Creation-Date: 2023-11-18 20:24+0000\n"
"PO-Revision-Date: 2017-12-20 02:52+0000\n"
"Last-Translator: roxfr <roxfr@outlook.fr>, 2022\n"
"Language-Team: French (https://app.transifex.com/fcitx/teams/12005/fr/)\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % "
"1000000 == 0 ? 1 : 2;\n"
#: qt5/quickphrase-editor/editor.cpp:260
msgid "%1 is a system file, do you want to delete all phrases instead?"
msgstr ""
"%1 est un fichier système, voulez-vous supprimer toutes les phrases à la "
"place ?"
#. i18n: file: qt5/quickphrase-editor/editor.ui:52
#. i18n: ectx: property (text), widget (QPushButton, addButton)
#: rc.cpp:12
#, kde-format
msgid "&Add"
msgstr "&Ajouter"
#: qt5/guiwrapper/mainwindow.cpp:29 qt6/guiwrapper/mainwindow.cpp:29
msgid "&Apply"
msgstr "&Appliquer"
#. i18n: file: qt5/quickphrase-editor/editor.ui:63
#. i18n: ectx: property (text), widget (QPushButton, batchEditButton)
#: rc.cpp:15
#, kde-format
msgid "&Batch Edit"
msgstr "Éditer &Batch"
#: qt5/guiwrapper/mainwindow.cpp:31 qt6/guiwrapper/mainwindow.cpp:31
msgid "&Close"
msgstr "&Fermer"
#. i18n: file: qt5/quickphrase-editor/editor.ui:74
#. i18n: ectx: property (text), widget (QPushButton, deleteButton)
#: rc.cpp:18
#, kde-format
msgid "&Delete"
msgstr "&Supprimer"
#. i18n: file: qt5/quickphrase-editor/editor.ui:103
#. i18n: ectx: property (text), widget (QPushButton, importButton)
#: rc.cpp:24
#, kde-format
msgid "&Import"
msgstr "&Importer"
#: qt5/guiwrapper/mainwindow.cpp:28 qt6/guiwrapper/mainwindow.cpp:28
msgid "&Ok"
msgstr "&OK"
#. i18n: file: qt5/quickphrase-editor/editor.ui:45
#. i18n: ectx: property (text), widget (QPushButton, operationButton)
#: rc.cpp:9
#, kde-format
msgid "&Operation"
msgstr "&Opération"
#: qt5/guiwrapper/mainwindow.cpp:30 qt6/guiwrapper/mainwindow.cpp:30
msgid "&Reset"
msgstr "&Réinitialiser"
#: qt5/guiwrapper/wrapperapp.cpp:31 qt6/guiwrapper/wrapperapp.cpp:31
msgid "A launcher for Fcitx Gui plugin."
msgstr "Un lanceur pour le plugin Fcitx Gui."
#: qt5/quickphrase-editor/editor.cpp:33
msgid "Add File"
msgstr "Ajouter un fichier"
#: qt5/quickphrase-editor/editor.cpp:272
msgid "Are you sure to delete %1?"
msgstr "Êtes-vous sûr de vouloir supprimer %1 ?"
#. i18n: file: qt5/quickphrase-editor/batchdialog.ui:14
#. i18n: ectx: property (windowTitle), widget (QDialog, BatchDialog)
#: rc.cpp:3
#, kde-format
msgid "Batch editing"
msgstr "Édition par lots"
#: qt5/quickphrase-editor/editor.cpp:238
msgid "Cannot create file %1."
msgstr "Impossible de créer le fichier %1."
#: qt5/quickphrase-editor/editor.cpp:259
msgid "Cannot remove system file"
msgstr "Impossible de supprimer le fichier système"
#: qt5/guiwrapper/wrapperapp.cpp:37 qt6/guiwrapper/wrapperapp.cpp:37
msgid "Config path"
msgstr "Chemin de configuration"
#: qt5/quickphrase-editor/editor.cpp:271
msgid "Confirm deletion"
msgstr "Confirmer la suppression"
#: qt5/quickphrase-editor/editor.cpp:221
msgid "Create new file"
msgstr "Créer un nouveau fichier"
#. i18n: file: qt5/quickphrase-editor/editor.ui:85
#. i18n: ectx: property (text), widget (QPushButton, clearButton)
#: rc.cpp:21
#, kde-format
msgid "De&lete All"
msgstr "Tout &supprimer"
#: qt5/quickphrase-editor/filelistmodel.cpp:29
msgid "Default"
msgstr "Par défaut"
#. i18n: file: qt5/quickphrase-editor/editor.ui:114
#. i18n: ectx: property (text), widget (QPushButton, exportButton)
#: rc.cpp:27
#, kde-format
msgid "E&xport"
msgstr "E&xporter"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:355
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:324
msgid "Empty"
msgstr "Vide"
#: qt5/quickphrase-editor/editor.cpp:280
msgid "Error while deleting %1."
msgstr "Erreur lors de la suppression de %1."
#: qt5/guiwrapper/mainwindow.cpp:106 qt6/guiwrapper/mainwindow.cpp:106
msgid "Failed to notify Fcitx"
msgstr "Échec de la notification à Fcitx"
#: qt5/guiwrapper/mainwindow.cpp:107 qt6/guiwrapper/mainwindow.cpp:107
msgid "Failed to notify Fcitx about the configuration change."
msgstr "Échec de notification à Fcitx du changement de configuration."
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:3
msgid "Fcitx 5 Qt5 Gui Wrapper"
msgstr "Fcitx 5 Qt5 Gui Wrapper"
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:3
msgid "Fcitx 5 Qt6 Gui Wrapper"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:237 qt5/quickphrase-editor/editor.cpp:279
msgid "File Operation Failed"
msgstr "Échec de l'opération de fichier"
#: qt5/quickphrase-editor/editor.cpp:226
msgid "File name should not contain '/'."
msgstr "Le nom du fichier ne doit pas contenir '/'."
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:4
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:4
msgid "Input Method Configuration helper"
msgstr "Aide à la configuration de la méthode d'entrée"
#: qt5/quickphrase-editor/editor.cpp:225
msgid "Invalid filename"
msgstr "Nom de fichier invalide"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:179
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:148
msgid "Key code mode"
msgstr "Mode code clé"
#: qt5/quickphrase-editor/model.cpp:73
msgid "Keyword"
msgstr "Mot clé"
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:5
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:5
msgid "Load configuration plugin for Fcitx Addon"
msgstr "Charger le plugin de configuration pour Fcitx Addon"
#: qt5/guiwrapper/wrapperapp.cpp:34 qt6/guiwrapper/wrapperapp.cpp:34
msgid "Parent window ID"
msgstr "ID de la fenêtre parente"
#: qt5/quickphrase-editor/model.cpp:75
msgid "Phrase"
msgstr "Phrase"
#: qt5/quickphrase-editor/editor.cpp:221
msgid "Please input a filename for newfile"
msgstr "Veuillez saisir un nom de fichier pour le nouveau fichier"
#: qt5/quickphrase-editor/editor.cpp:101
msgid "Quick Phrase Editor"
msgstr "Éditeur de phrase rapide"
#: qt5/quickphrase-editor/editor.cpp:37
msgid "Refresh List"
msgstr "Actualiser la liste"
#: qt5/quickphrase-editor/editor.cpp:35
msgid "Remove File"
msgstr "Supprimer le fichier"
#: qt5/quickphrase-editor/editor.cpp:85
msgid "Save Changes"
msgstr "Enregistrer les modifications"
#: qt5/guiwrapper/wrapperapp.cpp:35 qt6/guiwrapper/wrapperapp.cpp:35
msgid "Test if config exists"
msgstr "Tester si la configuration existe"
#: qt5/quickphrase-editor/editor.cpp:86
msgid ""
"The content has changed.\n"
"Do you want to save the changes or discard them?"
msgstr ""
"Le contenu a changé.\n"
"Voulez-vous enregistrer les modifications ou les annuler ?"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:392
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:361
msgid "The key you just pressed is not supported by Qt."
msgstr ""
"La touche que vous venez d&apos;appuyer n'est pas prise en charge par Qt."
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:393
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:362
msgid "Unsupported Key"
msgstr "Clé non prise en charge"
#. i18n: file: qt5/quickphrase-editor/batchdialog.ui:50
#. i18n: ectx: property (text), widget (QLabel, infoLabel)
#: rc.cpp:6
#, kde-format
msgid "Use <Keyword> <Phrase> format on every line."
msgstr "Utiliser<Keyword><Phrase> format sur chaque ligne."
#: qt5/guiwrapper/wrapperapp.cpp:37 qt6/guiwrapper/wrapperapp.cpp:37
msgid "path"
msgstr "chemin"
#: qt5/guiwrapper/wrapperapp.cpp:34 qt6/guiwrapper/wrapperapp.cpp:34
msgid "winid"
msgstr "winid"

273
Telegram/ThirdParty/fcitx5-qt/po/he.po vendored Normal file
View File

@@ -0,0 +1,273 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the fcitx5-qt package.
#
# Translators:
# 63f334ffc0709ba0fc2361b80bf3c0f0_00ffd1e <ab96c93ca0ac55ba7fa06385427e60dd_878890>, 2020
#
msgid ""
msgstr ""
"Project-Id-Version: fcitx5-qt\n"
"Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n"
"POT-Creation-Date: 2024-02-27 20:32+0000\n"
"PO-Revision-Date: 2017-12-20 02:52+0000\n"
"Last-Translator: 63f334ffc0709ba0fc2361b80bf3c0f0_00ffd1e "
"<ab96c93ca0ac55ba7fa06385427e60dd_878890>, 2020\n"
"Language-Team: Hebrew (https://app.transifex.com/fcitx/teams/12005/he/)\n"
"Language: he\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n == 1 && n % 1 == 0) ? 0 : (n == 2 && n % "
"1 == 0) ? 1: 2;\n"
#: qt5/quickphrase-editor/editor.cpp:260 qt6/quickphrase-editor/editor.cpp:260
msgid "%1 is a system file, do you want to delete all phrases instead?"
msgstr ""
#. i18n: file: qt5/quickphrase-editor/editor.ui:52
#. i18n: ectx: property (text), widget (QPushButton, addButton)
#. i18n: file: qt6/quickphrase-editor/editor.ui:52
#. i18n: ectx: property (text), widget (QPushButton, addButton)
#: rc.cpp:12 rc.cpp:39
#, kde-format
msgid "&Add"
msgstr ""
#: qt5/guiwrapper/mainwindow.cpp:29 qt6/guiwrapper/mainwindow.cpp:29
msgid "&Apply"
msgstr ""
#. i18n: file: qt5/quickphrase-editor/editor.ui:63
#. i18n: ectx: property (text), widget (QPushButton, batchEditButton)
#. i18n: file: qt6/quickphrase-editor/editor.ui:63
#. i18n: ectx: property (text), widget (QPushButton, batchEditButton)
#: rc.cpp:15 rc.cpp:42
#, kde-format
msgid "&Batch Edit"
msgstr ""
#: qt5/guiwrapper/mainwindow.cpp:31 qt6/guiwrapper/mainwindow.cpp:31
msgid "&Close"
msgstr "&סגירה"
#. i18n: file: qt5/quickphrase-editor/editor.ui:74
#. i18n: ectx: property (text), widget (QPushButton, deleteButton)
#. i18n: file: qt6/quickphrase-editor/editor.ui:74
#. i18n: ectx: property (text), widget (QPushButton, deleteButton)
#: rc.cpp:18 rc.cpp:45
#, kde-format
msgid "&Delete"
msgstr ""
#. i18n: file: qt5/quickphrase-editor/editor.ui:103
#. i18n: ectx: property (text), widget (QPushButton, importButton)
#. i18n: file: qt6/quickphrase-editor/editor.ui:103
#. i18n: ectx: property (text), widget (QPushButton, importButton)
#: rc.cpp:24 rc.cpp:51
#, kde-format
msgid "&Import"
msgstr ""
#: qt5/guiwrapper/mainwindow.cpp:28 qt6/guiwrapper/mainwindow.cpp:28
msgid "&Ok"
msgstr ""
#. i18n: file: qt5/quickphrase-editor/editor.ui:45
#. i18n: ectx: property (text), widget (QPushButton, operationButton)
#. i18n: file: qt6/quickphrase-editor/editor.ui:45
#. i18n: ectx: property (text), widget (QPushButton, operationButton)
#: rc.cpp:9 rc.cpp:36
#, kde-format
msgid "&Operation"
msgstr ""
#: qt5/guiwrapper/mainwindow.cpp:30 qt6/guiwrapper/mainwindow.cpp:30
msgid "&Reset"
msgstr ""
#: qt5/guiwrapper/wrapperapp.cpp:31 qt6/guiwrapper/wrapperapp.cpp:31
msgid "A launcher for Fcitx Gui plugin."
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:33 qt6/quickphrase-editor/editor.cpp:33
msgid "Add File"
msgstr "הוספת קובץ"
#: qt5/quickphrase-editor/editor.cpp:272 qt6/quickphrase-editor/editor.cpp:272
msgid "Are you sure to delete %1?"
msgstr ""
#. i18n: file: qt5/quickphrase-editor/batchdialog.ui:14
#. i18n: ectx: property (windowTitle), widget (QDialog, BatchDialog)
#. i18n: file: qt6/quickphrase-editor/batchdialog.ui:14
#. i18n: ectx: property (windowTitle), widget (QDialog, BatchDialog)
#: rc.cpp:3 rc.cpp:30
#, kde-format
msgid "Batch editing"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:238 qt6/quickphrase-editor/editor.cpp:238
msgid "Cannot create file %1."
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:259 qt6/quickphrase-editor/editor.cpp:259
msgid "Cannot remove system file"
msgstr ""
#: qt5/guiwrapper/wrapperapp.cpp:37 qt6/guiwrapper/wrapperapp.cpp:37
msgid "Config path"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:271 qt6/quickphrase-editor/editor.cpp:271
msgid "Confirm deletion"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:221 qt6/quickphrase-editor/editor.cpp:221
msgid "Create new file"
msgstr "יצירת קובץ חדש"
#. i18n: file: qt5/quickphrase-editor/editor.ui:85
#. i18n: ectx: property (text), widget (QPushButton, clearButton)
#. i18n: file: qt6/quickphrase-editor/editor.ui:85
#. i18n: ectx: property (text), widget (QPushButton, clearButton)
#: rc.cpp:21 rc.cpp:48
#, kde-format
msgid "De&lete All"
msgstr ""
#: qt5/quickphrase-editor/filelistmodel.cpp:29
#: qt6/quickphrase-editor/filelistmodel.cpp:29
msgid "Default"
msgstr "ברירת מחדל"
#. i18n: file: qt5/quickphrase-editor/editor.ui:114
#. i18n: ectx: property (text), widget (QPushButton, exportButton)
#. i18n: file: qt6/quickphrase-editor/editor.ui:114
#. i18n: ectx: property (text), widget (QPushButton, exportButton)
#: rc.cpp:27 rc.cpp:54
#, kde-format
msgid "E&xport"
msgstr ""
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:353
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:322
msgid "Empty"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:280 qt6/quickphrase-editor/editor.cpp:280
msgid "Error while deleting %1."
msgstr ""
#: qt5/guiwrapper/mainwindow.cpp:106 qt6/guiwrapper/mainwindow.cpp:106
msgid "Failed to notify Fcitx"
msgstr ""
#: qt5/guiwrapper/mainwindow.cpp:107 qt6/guiwrapper/mainwindow.cpp:107
msgid "Failed to notify Fcitx about the configuration change."
msgstr ""
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:3
msgid "Fcitx 5 Qt5 Gui Wrapper"
msgstr ""
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:3
msgid "Fcitx 5 Qt6 Gui Wrapper"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:237 qt5/quickphrase-editor/editor.cpp:279
#: qt6/quickphrase-editor/editor.cpp:237 qt6/quickphrase-editor/editor.cpp:279
msgid "File Operation Failed"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:226 qt6/quickphrase-editor/editor.cpp:226
msgid "File name should not contain '/'."
msgstr ""
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:4
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:4
msgid "Input Method Configuration helper"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:225 qt6/quickphrase-editor/editor.cpp:225
msgid "Invalid filename"
msgstr ""
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:179
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:148
msgid "Key code mode"
msgstr ""
#: qt5/quickphrase-editor/model.cpp:73 qt6/quickphrase-editor/model.cpp:73
msgid "Keyword"
msgstr "מילת מפתח"
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:5
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:5
msgid "Load configuration plugin for Fcitx Addon"
msgstr ""
#: qt5/guiwrapper/wrapperapp.cpp:34 qt6/guiwrapper/wrapperapp.cpp:34
msgid "Parent window ID"
msgstr ""
#: qt5/quickphrase-editor/model.cpp:75 qt6/quickphrase-editor/model.cpp:75
msgid "Phrase"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:221 qt6/quickphrase-editor/editor.cpp:221
msgid "Please input a filename for newfile"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:101 qt6/quickphrase-editor/editor.cpp:101
msgid "Quick Phrase Editor"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:37 qt6/quickphrase-editor/editor.cpp:37
msgid "Refresh List"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:35 qt6/quickphrase-editor/editor.cpp:35
msgid "Remove File"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:85 qt6/quickphrase-editor/editor.cpp:85
msgid "Save Changes"
msgstr "שמירת השינויים"
#: qt5/guiwrapper/wrapperapp.cpp:35 qt6/guiwrapper/wrapperapp.cpp:35
msgid "Test if config exists"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:86 qt6/quickphrase-editor/editor.cpp:86
msgid ""
"The content has changed.\n"
"Do you want to save the changes or discard them?"
msgstr ""
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:390
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:359
msgid "The key you just pressed is not supported by Qt."
msgstr ""
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:391
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:360
msgid "Unsupported Key"
msgstr ""
#. i18n: file: qt5/quickphrase-editor/batchdialog.ui:50
#. i18n: ectx: property (text), widget (QLabel, infoLabel)
#. i18n: file: qt6/quickphrase-editor/batchdialog.ui:50
#. i18n: ectx: property (text), widget (QLabel, infoLabel)
#: rc.cpp:6 rc.cpp:33
#, kde-format
msgid "Use <Keyword> <Phrase> format on every line."
msgstr ""
#: qt5/guiwrapper/wrapperapp.cpp:37 qt6/guiwrapper/wrapperapp.cpp:37
msgid "path"
msgstr ""
#: qt5/guiwrapper/wrapperapp.cpp:34 qt6/guiwrapper/wrapperapp.cpp:34
msgid "winid"
msgstr ""

255
Telegram/ThirdParty/fcitx5-qt/po/ja.po vendored Normal file
View File

@@ -0,0 +1,255 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the fcitx5-qt package.
#
# Translators:
# Takuro Onoue <kusanaginoturugi@gmail.com>, 2020
# csslayer <wengxt@gmail.com>, 2022
# UTUMI Hirosi <utuhiro78@yahoo.co.jp>, 2023
#
msgid ""
msgstr ""
"Project-Id-Version: fcitx5-qt\n"
"Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n"
"POT-Creation-Date: 2023-11-19 20:24+0000\n"
"PO-Revision-Date: 2017-12-20 02:52+0000\n"
"Last-Translator: UTUMI Hirosi <utuhiro78@yahoo.co.jp>, 2023\n"
"Language-Team: Japanese (https://app.transifex.com/fcitx/teams/12005/ja/)\n"
"Language: ja\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: qt5/quickphrase-editor/editor.cpp:260
msgid "%1 is a system file, do you want to delete all phrases instead?"
msgstr "%1 はシステムファイルです。代わりにすべてのフレーズを削除しますか?"
#. i18n: file: qt5/quickphrase-editor/editor.ui:52
#. i18n: ectx: property (text), widget (QPushButton, addButton)
#: rc.cpp:12
#, kde-format
msgid "&Add"
msgstr "追加 (&A)"
#: qt5/guiwrapper/mainwindow.cpp:29 qt6/guiwrapper/mainwindow.cpp:29
msgid "&Apply"
msgstr "適用 (&A)"
#. i18n: file: qt5/quickphrase-editor/editor.ui:63
#. i18n: ectx: property (text), widget (QPushButton, batchEditButton)
#: rc.cpp:15
#, kde-format
msgid "&Batch Edit"
msgstr "バッチ編集 (&B)"
#: qt5/guiwrapper/mainwindow.cpp:31 qt6/guiwrapper/mainwindow.cpp:31
msgid "&Close"
msgstr "閉じる (&C)"
#. i18n: file: qt5/quickphrase-editor/editor.ui:74
#. i18n: ectx: property (text), widget (QPushButton, deleteButton)
#: rc.cpp:18
#, kde-format
msgid "&Delete"
msgstr "削除 (&D)"
#. i18n: file: qt5/quickphrase-editor/editor.ui:103
#. i18n: ectx: property (text), widget (QPushButton, importButton)
#: rc.cpp:24
#, kde-format
msgid "&Import"
msgstr "インポート (&I)"
#: qt5/guiwrapper/mainwindow.cpp:28 qt6/guiwrapper/mainwindow.cpp:28
msgid "&Ok"
msgstr "&Ok"
#. i18n: file: qt5/quickphrase-editor/editor.ui:45
#. i18n: ectx: property (text), widget (QPushButton, operationButton)
#: rc.cpp:9
#, kde-format
msgid "&Operation"
msgstr "操作(&O)"
#: qt5/guiwrapper/mainwindow.cpp:30 qt6/guiwrapper/mainwindow.cpp:30
msgid "&Reset"
msgstr "リセット (&R)"
#: qt5/guiwrapper/wrapperapp.cpp:31 qt6/guiwrapper/wrapperapp.cpp:31
msgid "A launcher for Fcitx Gui plugin."
msgstr "Fcitx Gui プラグインのランチャーです。"
#: qt5/quickphrase-editor/editor.cpp:33
msgid "Add File"
msgstr "ファイル追加"
#: qt5/quickphrase-editor/editor.cpp:272
msgid "Are you sure to delete %1?"
msgstr "本当に %1 を削除しますか?"
#. i18n: file: qt5/quickphrase-editor/batchdialog.ui:14
#. i18n: ectx: property (windowTitle), widget (QDialog, BatchDialog)
#: rc.cpp:3
#, kde-format
msgid "Batch editing"
msgstr "バッチの編集"
#: qt5/quickphrase-editor/editor.cpp:238
msgid "Cannot create file %1."
msgstr "%1 ファイルを作成できません。"
#: qt5/quickphrase-editor/editor.cpp:259
msgid "Cannot remove system file"
msgstr "システムファイルは削除出来ません。"
#: qt5/guiwrapper/wrapperapp.cpp:37 qt6/guiwrapper/wrapperapp.cpp:37
msgid "Config path"
msgstr "設定パス"
#: qt5/quickphrase-editor/editor.cpp:271
msgid "Confirm deletion"
msgstr "削除の確認"
#: qt5/quickphrase-editor/editor.cpp:221
msgid "Create new file"
msgstr "ファイルの新規作成"
#. i18n: file: qt5/quickphrase-editor/editor.ui:85
#. i18n: ectx: property (text), widget (QPushButton, clearButton)
#: rc.cpp:21
#, kde-format
msgid "De&lete All"
msgstr "全削除 (&l)"
#: qt5/quickphrase-editor/filelistmodel.cpp:29
msgid "Default"
msgstr "デフォルト"
#. i18n: file: qt5/quickphrase-editor/editor.ui:114
#. i18n: ectx: property (text), widget (QPushButton, exportButton)
#: rc.cpp:27
#, kde-format
msgid "E&xport"
msgstr "エクスポート (&x)"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:353
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:322
msgid "Empty"
msgstr "空"
#: qt5/quickphrase-editor/editor.cpp:280
msgid "Error while deleting %1."
msgstr "%1 の削除中にエラーが起きました。"
#: qt5/guiwrapper/mainwindow.cpp:106 qt6/guiwrapper/mainwindow.cpp:106
msgid "Failed to notify Fcitx"
msgstr "Fcitx の通知に失敗しました。"
#: qt5/guiwrapper/mainwindow.cpp:107 qt6/guiwrapper/mainwindow.cpp:107
msgid "Failed to notify Fcitx about the configuration change."
msgstr "設定の変更についての Fcitx の通知に失敗しました。"
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:3
msgid "Fcitx 5 Qt5 Gui Wrapper"
msgstr "Fcitx 5 の Qt5 GUI ラッパー"
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:3
msgid "Fcitx 5 Qt6 Gui Wrapper"
msgstr "Fcitx 5 Qt6 GUI ラッパー"
#: qt5/quickphrase-editor/editor.cpp:237 qt5/quickphrase-editor/editor.cpp:279
msgid "File Operation Failed"
msgstr "ファイル処理に失敗しました"
#: qt5/quickphrase-editor/editor.cpp:226
msgid "File name should not contain '/'."
msgstr "ファイル名に '/' は含められません。"
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:4
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:4
msgid "Input Method Configuration helper"
msgstr "入力メソッド設定ヘルパー"
#: qt5/quickphrase-editor/editor.cpp:225
msgid "Invalid filename"
msgstr "無効なファイル名"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:179
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:148
msgid "Key code mode"
msgstr "キーコードモード"
#: qt5/quickphrase-editor/model.cpp:73
msgid "Keyword"
msgstr "キーワード"
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:5
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:5
msgid "Load configuration plugin for Fcitx Addon"
msgstr "Fcitx アドオンの設定プラグインをロードする"
#: qt5/guiwrapper/wrapperapp.cpp:34 qt6/guiwrapper/wrapperapp.cpp:34
msgid "Parent window ID"
msgstr "親ウィンドウID"
#: qt5/quickphrase-editor/model.cpp:75
msgid "Phrase"
msgstr "フレーズ"
#: qt5/quickphrase-editor/editor.cpp:221
msgid "Please input a filename for newfile"
msgstr "新しいファイルのファイル名を入力してください"
#: qt5/quickphrase-editor/editor.cpp:101
msgid "Quick Phrase Editor"
msgstr "クイックフレーズ エディター"
#: qt5/quickphrase-editor/editor.cpp:37
msgid "Refresh List"
msgstr "リストの更新"
#: qt5/quickphrase-editor/editor.cpp:35
msgid "Remove File"
msgstr "ファイル削除"
#: qt5/quickphrase-editor/editor.cpp:85
msgid "Save Changes"
msgstr "変更の保存"
#: qt5/guiwrapper/wrapperapp.cpp:35 qt6/guiwrapper/wrapperapp.cpp:35
msgid "Test if config exists"
msgstr "設定が存在したらテストする"
#: qt5/quickphrase-editor/editor.cpp:86
msgid ""
"The content has changed.\n"
"Do you want to save the changes or discard them?"
msgstr ""
"内容が変更されています。\n"
"変更を保存しますか?それとも変更を破棄しますか?"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:390
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:359
msgid "The key you just pressed is not supported by Qt."
msgstr "押されたキーは Qt でサポートされていません。"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:391
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:360
msgid "Unsupported Key"
msgstr "サポートされていないキー"
#. i18n: file: qt5/quickphrase-editor/batchdialog.ui:50
#. i18n: ectx: property (text), widget (QLabel, infoLabel)
#: rc.cpp:6
#, kde-format
msgid "Use <Keyword> <Phrase> format on every line."
msgstr "各行では <Keyword> <Phrase> の形式を使用してください。"
#: qt5/guiwrapper/wrapperapp.cpp:37 qt6/guiwrapper/wrapperapp.cpp:37
msgid "path"
msgstr "パス"
#: qt5/guiwrapper/wrapperapp.cpp:34 qt6/guiwrapper/wrapperapp.cpp:34
msgid "winid"
msgstr "ウィンドウ ID"

255
Telegram/ThirdParty/fcitx5-qt/po/ko.po vendored Normal file
View File

@@ -0,0 +1,255 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the fcitx5-qt package.
#
# Translators:
# Bon Keun Seo <scobyseo@gmail.com>, 2017
# csslayer <wengxt@gmail.com>, 2022
# Junghee Lee <daemul72@gmail.com>, 2022
#
msgid ""
msgstr ""
"Project-Id-Version: fcitx5-qt\n"
"Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n"
"POT-Creation-Date: 2023-11-18 20:24+0000\n"
"PO-Revision-Date: 2017-12-20 02:52+0000\n"
"Last-Translator: Junghee Lee <daemul72@gmail.com>, 2022\n"
"Language-Team: Korean (https://app.transifex.com/fcitx/teams/12005/ko/)\n"
"Language: ko\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: qt5/quickphrase-editor/editor.cpp:260
msgid "%1 is a system file, do you want to delete all phrases instead?"
msgstr "%1은(는) 시스템 파일입니다. 대신 모든 구문을 삭제하시겠습니까?"
#. i18n: file: qt5/quickphrase-editor/editor.ui:52
#. i18n: ectx: property (text), widget (QPushButton, addButton)
#: rc.cpp:12
#, kde-format
msgid "&Add"
msgstr "추가(&A)"
#: qt5/guiwrapper/mainwindow.cpp:29 qt6/guiwrapper/mainwindow.cpp:29
msgid "&Apply"
msgstr "적용(&A)"
#. i18n: file: qt5/quickphrase-editor/editor.ui:63
#. i18n: ectx: property (text), widget (QPushButton, batchEditButton)
#: rc.cpp:15
#, kde-format
msgid "&Batch Edit"
msgstr "일괄수정(&B)"
#: qt5/guiwrapper/mainwindow.cpp:31 qt6/guiwrapper/mainwindow.cpp:31
msgid "&Close"
msgstr "닫기(&C)"
#. i18n: file: qt5/quickphrase-editor/editor.ui:74
#. i18n: ectx: property (text), widget (QPushButton, deleteButton)
#: rc.cpp:18
#, kde-format
msgid "&Delete"
msgstr "삭제(&D)"
#. i18n: file: qt5/quickphrase-editor/editor.ui:103
#. i18n: ectx: property (text), widget (QPushButton, importButton)
#: rc.cpp:24
#, kde-format
msgid "&Import"
msgstr "가져오기(&I)"
#: qt5/guiwrapper/mainwindow.cpp:28 qt6/guiwrapper/mainwindow.cpp:28
msgid "&Ok"
msgstr "확인(&O)"
#. i18n: file: qt5/quickphrase-editor/editor.ui:45
#. i18n: ectx: property (text), widget (QPushButton, operationButton)
#: rc.cpp:9
#, kde-format
msgid "&Operation"
msgstr "작동(&O)"
#: qt5/guiwrapper/mainwindow.cpp:30 qt6/guiwrapper/mainwindow.cpp:30
msgid "&Reset"
msgstr "재설정(&R)"
#: qt5/guiwrapper/wrapperapp.cpp:31 qt6/guiwrapper/wrapperapp.cpp:31
msgid "A launcher for Fcitx Gui plugin."
msgstr "Fcitx GUI 플러그인용 실행기"
#: qt5/quickphrase-editor/editor.cpp:33
msgid "Add File"
msgstr "파일 추가"
#: qt5/quickphrase-editor/editor.cpp:272
msgid "Are you sure to delete %1?"
msgstr "%1을(를) 삭제하시겠습니까?"
#. i18n: file: qt5/quickphrase-editor/batchdialog.ui:14
#. i18n: ectx: property (windowTitle), widget (QDialog, BatchDialog)
#: rc.cpp:3
#, kde-format
msgid "Batch editing"
msgstr "일괄 편집하기"
#: qt5/quickphrase-editor/editor.cpp:238
msgid "Cannot create file %1."
msgstr "파일 %1을 만들수 없습니다."
#: qt5/quickphrase-editor/editor.cpp:259
msgid "Cannot remove system file"
msgstr "시스템 파일을 제거할 수 없음"
#: qt5/guiwrapper/wrapperapp.cpp:37 qt6/guiwrapper/wrapperapp.cpp:37
msgid "Config path"
msgstr "구성 경로"
#: qt5/quickphrase-editor/editor.cpp:271
msgid "Confirm deletion"
msgstr "지우기 확인"
#: qt5/quickphrase-editor/editor.cpp:221
msgid "Create new file"
msgstr "새로운 파일 생성"
#. i18n: file: qt5/quickphrase-editor/editor.ui:85
#. i18n: ectx: property (text), widget (QPushButton, clearButton)
#: rc.cpp:21
#, kde-format
msgid "De&lete All"
msgstr "모두 삭제(&L)"
#: qt5/quickphrase-editor/filelistmodel.cpp:29
msgid "Default"
msgstr "기본값"
#. i18n: file: qt5/quickphrase-editor/editor.ui:114
#. i18n: ectx: property (text), widget (QPushButton, exportButton)
#: rc.cpp:27
#, kde-format
msgid "E&xport"
msgstr "내보내기(&X)"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:355
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:324
msgid "Empty"
msgstr "비어있음"
#: qt5/quickphrase-editor/editor.cpp:280
msgid "Error while deleting %1."
msgstr "%1을 지우는 중 오류 발생"
#: qt5/guiwrapper/mainwindow.cpp:106 qt6/guiwrapper/mainwindow.cpp:106
msgid "Failed to notify Fcitx"
msgstr "Fcitx에 알리지 못함"
#: qt5/guiwrapper/mainwindow.cpp:107 qt6/guiwrapper/mainwindow.cpp:107
msgid "Failed to notify Fcitx about the configuration change."
msgstr "구성 변경에 대해 Fcitx에 알리지 못했습니다."
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:3
msgid "Fcitx 5 Qt5 Gui Wrapper"
msgstr "Fcitx 5 Qt5 Gui 래퍼"
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:3
msgid "Fcitx 5 Qt6 Gui Wrapper"
msgstr ""
#: qt5/quickphrase-editor/editor.cpp:237 qt5/quickphrase-editor/editor.cpp:279
msgid "File Operation Failed"
msgstr "파일 작업 실패"
#: qt5/quickphrase-editor/editor.cpp:226
msgid "File name should not contain '/'."
msgstr "파일명에 '/'가 포함되지 않아야 합니다."
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:4
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:4
msgid "Input Method Configuration helper"
msgstr "입력기 구성 도우미"
#: qt5/quickphrase-editor/editor.cpp:225
msgid "Invalid filename"
msgstr "잘못된 파일명"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:179
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:148
msgid "Key code mode"
msgstr "키코드 방식"
#: qt5/quickphrase-editor/model.cpp:73
msgid "Keyword"
msgstr "키워드"
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:5
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:5
msgid "Load configuration plugin for Fcitx Addon"
msgstr "Fcitx 애드온용 구성 플러그인 불러오기"
#: qt5/guiwrapper/wrapperapp.cpp:34 qt6/guiwrapper/wrapperapp.cpp:34
msgid "Parent window ID"
msgstr "상위 창 ID"
#: qt5/quickphrase-editor/model.cpp:75
msgid "Phrase"
msgstr "구문"
#: qt5/quickphrase-editor/editor.cpp:221
msgid "Please input a filename for newfile"
msgstr "새 파일의 이름을 입력"
#: qt5/quickphrase-editor/editor.cpp:101
msgid "Quick Phrase Editor"
msgstr "상용구 편집기"
#: qt5/quickphrase-editor/editor.cpp:37
msgid "Refresh List"
msgstr "목록 갱신"
#: qt5/quickphrase-editor/editor.cpp:35
msgid "Remove File"
msgstr "파일 제거"
#: qt5/quickphrase-editor/editor.cpp:85
msgid "Save Changes"
msgstr "변경 저장"
#: qt5/guiwrapper/wrapperapp.cpp:35 qt6/guiwrapper/wrapperapp.cpp:35
msgid "Test if config exists"
msgstr "구성이 있는지 확인"
#: qt5/quickphrase-editor/editor.cpp:86
msgid ""
"The content has changed.\n"
"Do you want to save the changes or discard them?"
msgstr ""
"내용이 변했습니다.\n"
"변경사항을 저장할까요?"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:392
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:361
msgid "The key you just pressed is not supported by Qt."
msgstr "방금 누른 키는 Qt가 지원하지 않습니다."
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:393
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:362
msgid "Unsupported Key"
msgstr "지원하지 않는 키"
#. i18n: file: qt5/quickphrase-editor/batchdialog.ui:50
#. i18n: ectx: property (text), widget (QLabel, infoLabel)
#: rc.cpp:6
#, kde-format
msgid "Use <Keyword> <Phrase> format on every line."
msgstr "모든 줄에 <Keyword> <Phrase> 형식을 사용합니다."
#: qt5/guiwrapper/wrapperapp.cpp:37 qt6/guiwrapper/wrapperapp.cpp:37
msgid "path"
msgstr "경로"
#: qt5/guiwrapper/wrapperapp.cpp:34 qt6/guiwrapper/wrapperapp.cpp:34
msgid "winid"
msgstr "winid"

256
Telegram/ThirdParty/fcitx5-qt/po/ru.po vendored Normal file
View File

@@ -0,0 +1,256 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the fcitx5-qt package.
#
# Translators:
# csslayer <wengxt@gmail.com>, 2022
# Dmitry <dmitrydmitry761@gmail.com>, 2023
#
msgid ""
msgstr ""
"Project-Id-Version: fcitx5-qt\n"
"Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n"
"POT-Creation-Date: 2023-11-19 20:24+0000\n"
"PO-Revision-Date: 2017-12-20 02:52+0000\n"
"Last-Translator: Dmitry <dmitrydmitry761@gmail.com>, 2023\n"
"Language-Team: Russian (https://app.transifex.com/fcitx/teams/12005/ru/)\n"
"Language: ru\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
"n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || "
"(n%100>=11 && n%100<=14)? 2 : 3);\n"
#: qt5/quickphrase-editor/editor.cpp:260
msgid "%1 is a system file, do you want to delete all phrases instead?"
msgstr "%1 — системный файл. Хотите вместо этого удалить все фразы?"
#. i18n: file: qt5/quickphrase-editor/editor.ui:52
#. i18n: ectx: property (text), widget (QPushButton, addButton)
#: rc.cpp:12
#, kde-format
msgid "&Add"
msgstr "&Добавить"
#: qt5/guiwrapper/mainwindow.cpp:29 qt6/guiwrapper/mainwindow.cpp:29
msgid "&Apply"
msgstr "&Применять"
#. i18n: file: qt5/quickphrase-editor/editor.ui:63
#. i18n: ectx: property (text), widget (QPushButton, batchEditButton)
#: rc.cpp:15
#, kde-format
msgid "&Batch Edit"
msgstr "&Групповое редактирование"
#: qt5/guiwrapper/mainwindow.cpp:31 qt6/guiwrapper/mainwindow.cpp:31
msgid "&Close"
msgstr "&Закрыть"
#. i18n: file: qt5/quickphrase-editor/editor.ui:74
#. i18n: ectx: property (text), widget (QPushButton, deleteButton)
#: rc.cpp:18
#, kde-format
msgid "&Delete"
msgstr "&Удалить"
#. i18n: file: qt5/quickphrase-editor/editor.ui:103
#. i18n: ectx: property (text), widget (QPushButton, importButton)
#: rc.cpp:24
#, kde-format
msgid "&Import"
msgstr "&Импорт"
#: qt5/guiwrapper/mainwindow.cpp:28 qt6/guiwrapper/mainwindow.cpp:28
msgid "&Ok"
msgstr "&Ok"
#. i18n: file: qt5/quickphrase-editor/editor.ui:45
#. i18n: ectx: property (text), widget (QPushButton, operationButton)
#: rc.cpp:9
#, kde-format
msgid "&Operation"
msgstr "&Операция"
#: qt5/guiwrapper/mainwindow.cpp:30 qt6/guiwrapper/mainwindow.cpp:30
msgid "&Reset"
msgstr "&Переустановить"
#: qt5/guiwrapper/wrapperapp.cpp:31 qt6/guiwrapper/wrapperapp.cpp:31
msgid "A launcher for Fcitx Gui plugin."
msgstr "Средство запуска для плагина Fcitx Gui."
#: qt5/quickphrase-editor/editor.cpp:33
msgid "Add File"
msgstr "Добавить файл"
#: qt5/quickphrase-editor/editor.cpp:272
msgid "Are you sure to delete %1?"
msgstr "Действительно удалить %1?"
#. i18n: file: qt5/quickphrase-editor/batchdialog.ui:14
#. i18n: ectx: property (windowTitle), widget (QDialog, BatchDialog)
#: rc.cpp:3
#, kde-format
msgid "Batch editing"
msgstr "Групповое редактирование"
#: qt5/quickphrase-editor/editor.cpp:238
msgid "Cannot create file %1."
msgstr "Не удалось создать файл %1."
#: qt5/quickphrase-editor/editor.cpp:259
msgid "Cannot remove system file"
msgstr "Не удалось удалить системный файл"
#: qt5/guiwrapper/wrapperapp.cpp:37 qt6/guiwrapper/wrapperapp.cpp:37
msgid "Config path"
msgstr "Путь конфигурации"
#: qt5/quickphrase-editor/editor.cpp:271
msgid "Confirm deletion"
msgstr "Подтвердите удаление"
#: qt5/quickphrase-editor/editor.cpp:221
msgid "Create new file"
msgstr "Создать новый файл"
#. i18n: file: qt5/quickphrase-editor/editor.ui:85
#. i18n: ectx: property (text), widget (QPushButton, clearButton)
#: rc.cpp:21
#, kde-format
msgid "De&lete All"
msgstr "Уд&алить все"
#: qt5/quickphrase-editor/filelistmodel.cpp:29
msgid "Default"
msgstr "По умолчанию"
#. i18n: file: qt5/quickphrase-editor/editor.ui:114
#. i18n: ectx: property (text), widget (QPushButton, exportButton)
#: rc.cpp:27
#, kde-format
msgid "E&xport"
msgstr "&Экспорт"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:353
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:322
msgid "Empty"
msgstr "Пусто"
#: qt5/quickphrase-editor/editor.cpp:280
msgid "Error while deleting %1."
msgstr "Ошибка при удалении %1."
#: qt5/guiwrapper/mainwindow.cpp:106 qt6/guiwrapper/mainwindow.cpp:106
msgid "Failed to notify Fcitx"
msgstr "Не удалось уведомить Fcitx"
#: qt5/guiwrapper/mainwindow.cpp:107 qt6/guiwrapper/mainwindow.cpp:107
msgid "Failed to notify Fcitx about the configuration change."
msgstr "Не удалось уведомить Fcitx об изменении конфигурации."
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:3
msgid "Fcitx 5 Qt5 Gui Wrapper"
msgstr "Графическая оболочка Fcitx 5 Qt5"
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:3
msgid "Fcitx 5 Qt6 Gui Wrapper"
msgstr "Графическая оболочка Fcitx 5 Qt6"
#: qt5/quickphrase-editor/editor.cpp:237 qt5/quickphrase-editor/editor.cpp:279
msgid "File Operation Failed"
msgstr "Сбой операции с файлом"
#: qt5/quickphrase-editor/editor.cpp:226
msgid "File name should not contain '/'."
msgstr "Имя файла не должно содержать '/'."
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:4
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:4
msgid "Input Method Configuration helper"
msgstr "Помощник по настройке метода ввода"
#: qt5/quickphrase-editor/editor.cpp:225
msgid "Invalid filename"
msgstr "Недопустимое имя файла"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:179
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:148
msgid "Key code mode"
msgstr "Режим кода клавиши"
#: qt5/quickphrase-editor/model.cpp:73
msgid "Keyword"
msgstr "Ключевое слово"
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:5
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:5
msgid "Load configuration plugin for Fcitx Addon"
msgstr "Плагин загрузки конфигурации для Fcitx Addon"
#: qt5/guiwrapper/wrapperapp.cpp:34 qt6/guiwrapper/wrapperapp.cpp:34
msgid "Parent window ID"
msgstr "Идентификатор главного окна"
#: qt5/quickphrase-editor/model.cpp:75
msgid "Phrase"
msgstr "Фраза"
#: qt5/quickphrase-editor/editor.cpp:221
msgid "Please input a filename for newfile"
msgstr "Введите имя для нового файла"
#: qt5/quickphrase-editor/editor.cpp:101
msgid "Quick Phrase Editor"
msgstr "Быстрый редактор фраз"
#: qt5/quickphrase-editor/editor.cpp:37
msgid "Refresh List"
msgstr "Обновить список"
#: qt5/quickphrase-editor/editor.cpp:35
msgid "Remove File"
msgstr "Удалить файл"
#: qt5/quickphrase-editor/editor.cpp:85
msgid "Save Changes"
msgstr "Сохранить изменения"
#: qt5/guiwrapper/wrapperapp.cpp:35 qt6/guiwrapper/wrapperapp.cpp:35
msgid "Test if config exists"
msgstr "Проверьте, существует ли конфигурация"
#: qt5/quickphrase-editor/editor.cpp:86
msgid ""
"The content has changed.\n"
"Do you want to save the changes or discard them?"
msgstr ""
"Содержимое изменилось.\n"
"Сохранить изменения или отменить их?"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:390
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:359
msgid "The key you just pressed is not supported by Qt."
msgstr "Нажатая клавиша не поддерживается Qt."
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:391
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:360
msgid "Unsupported Key"
msgstr "Клавиша не поддерживается"
#. i18n: file: qt5/quickphrase-editor/batchdialog.ui:50
#. i18n: ectx: property (text), widget (QLabel, infoLabel)
#: rc.cpp:6
#, kde-format
msgid "Use <Keyword> <Phrase> format on every line."
msgstr "Использовать для каждой строки формат <Ключевое слово> <Фраза>."
#: qt5/guiwrapper/wrapperapp.cpp:37 qt6/guiwrapper/wrapperapp.cpp:37
msgid "path"
msgstr "путь"
#: qt5/guiwrapper/wrapperapp.cpp:34 qt6/guiwrapper/wrapperapp.cpp:34
msgid "winid"
msgstr "winid"

View File

@@ -0,0 +1,254 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the fcitx5-qt package.
#
# Translators:
# csslayer <wengxt@gmail.com>, 2023
#
msgid ""
msgstr ""
"Project-Id-Version: fcitx5-qt\n"
"Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n"
"POT-Creation-Date: 2023-11-22 20:24+0000\n"
"PO-Revision-Date: 2017-12-20 02:52+0000\n"
"Last-Translator: csslayer <wengxt@gmail.com>, 2023\n"
"Language-Team: Chinese (China) (https://app.transifex.com/fcitx/teams/12005/"
"zh_CN/)\n"
"Language: zh_CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: qt6/quickphrase-editor/editor.cpp:260
msgid "%1 is a system file, do you want to delete all phrases instead?"
msgstr "%1 是系统文件,您是否想要改为清空所有词组?"
#. i18n: file: qt6/quickphrase-editor/editor.ui:52
#. i18n: ectx: property (text), widget (QPushButton, addButton)
#: rc.cpp:12
#, kde-format
msgid "&Add"
msgstr "添加(&A)"
#: qt5/guiwrapper/mainwindow.cpp:29 qt6/guiwrapper/mainwindow.cpp:29
msgid "&Apply"
msgstr "应用(&A)"
#. i18n: file: qt6/quickphrase-editor/editor.ui:63
#. i18n: ectx: property (text), widget (QPushButton, batchEditButton)
#: rc.cpp:15
#, kde-format
msgid "&Batch Edit"
msgstr "批量编辑(&B)"
#: qt5/guiwrapper/mainwindow.cpp:31 qt6/guiwrapper/mainwindow.cpp:31
msgid "&Close"
msgstr "关闭(&C)"
#. i18n: file: qt6/quickphrase-editor/editor.ui:74
#. i18n: ectx: property (text), widget (QPushButton, deleteButton)
#: rc.cpp:18
#, kde-format
msgid "&Delete"
msgstr "删除(&D)"
#. i18n: file: qt6/quickphrase-editor/editor.ui:103
#. i18n: ectx: property (text), widget (QPushButton, importButton)
#: rc.cpp:24
#, kde-format
msgid "&Import"
msgstr "导入(&I)"
#: qt5/guiwrapper/mainwindow.cpp:28 qt6/guiwrapper/mainwindow.cpp:28
msgid "&Ok"
msgstr "确定(&O)"
#. i18n: file: qt6/quickphrase-editor/editor.ui:45
#. i18n: ectx: property (text), widget (QPushButton, operationButton)
#: rc.cpp:9
#, kde-format
msgid "&Operation"
msgstr "操作(&O)"
#: qt5/guiwrapper/mainwindow.cpp:30 qt6/guiwrapper/mainwindow.cpp:30
msgid "&Reset"
msgstr "重置(&R)"
#: qt5/guiwrapper/wrapperapp.cpp:31 qt6/guiwrapper/wrapperapp.cpp:31
msgid "A launcher for Fcitx Gui plugin."
msgstr "Fcitx 图形界面插件的启动器"
#: qt6/quickphrase-editor/editor.cpp:33
msgid "Add File"
msgstr "添加文件"
#: qt6/quickphrase-editor/editor.cpp:272
msgid "Are you sure to delete %1?"
msgstr "您确定要删除 %1"
#. i18n: file: qt6/quickphrase-editor/batchdialog.ui:14
#. i18n: ectx: property (windowTitle), widget (QDialog, BatchDialog)
#: rc.cpp:3
#, kde-format
msgid "Batch editing"
msgstr "批量编辑"
#: qt6/quickphrase-editor/editor.cpp:238
msgid "Cannot create file %1."
msgstr "无法创建文件 %1。"
#: qt6/quickphrase-editor/editor.cpp:259
msgid "Cannot remove system file"
msgstr "无法移除系统文件"
#: qt5/guiwrapper/wrapperapp.cpp:37 qt6/guiwrapper/wrapperapp.cpp:37
msgid "Config path"
msgstr "配置路径"
#: qt6/quickphrase-editor/editor.cpp:271
msgid "Confirm deletion"
msgstr "确认删除"
#: qt6/quickphrase-editor/editor.cpp:221
msgid "Create new file"
msgstr "创建新文件"
#. i18n: file: qt6/quickphrase-editor/editor.ui:85
#. i18n: ectx: property (text), widget (QPushButton, clearButton)
#: rc.cpp:21
#, kde-format
msgid "De&lete All"
msgstr "全部删除(&L)"
#: qt6/quickphrase-editor/filelistmodel.cpp:29
msgid "Default"
msgstr "默认"
#. i18n: file: qt6/quickphrase-editor/editor.ui:114
#. i18n: ectx: property (text), widget (QPushButton, exportButton)
#: rc.cpp:27
#, kde-format
msgid "E&xport"
msgstr "导出(&X)"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:353
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:322
msgid "Empty"
msgstr "空"
#: qt6/quickphrase-editor/editor.cpp:280
msgid "Error while deleting %1."
msgstr "删除 %1 时出错。"
#: qt5/guiwrapper/mainwindow.cpp:106 qt6/guiwrapper/mainwindow.cpp:106
msgid "Failed to notify Fcitx"
msgstr "通知 Fcitx 失败"
#: qt5/guiwrapper/mainwindow.cpp:107 qt6/guiwrapper/mainwindow.cpp:107
msgid "Failed to notify Fcitx about the configuration change."
msgstr "通知 Fcitx 配置更改时失败。"
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:3
msgid "Fcitx 5 Qt5 Gui Wrapper"
msgstr "Fcitx 5 Qt5 图形界面封装器"
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:3
msgid "Fcitx 5 Qt6 Gui Wrapper"
msgstr "Fcitx 5 Qt6 图形界面封装器"
#: qt6/quickphrase-editor/editor.cpp:237 qt6/quickphrase-editor/editor.cpp:279
msgid "File Operation Failed"
msgstr "文件操作失败"
#: qt6/quickphrase-editor/editor.cpp:226
msgid "File name should not contain '/'."
msgstr "文件名不应该包括 “/”。"
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:4
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:4
msgid "Input Method Configuration helper"
msgstr "输入法配置助手程序"
#: qt6/quickphrase-editor/editor.cpp:225
msgid "Invalid filename"
msgstr "文件名无效"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:179
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:148
msgid "Key code mode"
msgstr "扫描码模式"
#: qt6/quickphrase-editor/model.cpp:73
msgid "Keyword"
msgstr "关键字"
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:5
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:5
msgid "Load configuration plugin for Fcitx Addon"
msgstr "加载 Fcitx 附加组件的配置插件"
#: qt5/guiwrapper/wrapperapp.cpp:34 qt6/guiwrapper/wrapperapp.cpp:34
msgid "Parent window ID"
msgstr "父窗口 ID"
#: qt6/quickphrase-editor/model.cpp:75
msgid "Phrase"
msgstr "词组"
#: qt6/quickphrase-editor/editor.cpp:221
msgid "Please input a filename for newfile"
msgstr "请输入新文件的文件名"
#: qt6/quickphrase-editor/editor.cpp:101
msgid "Quick Phrase Editor"
msgstr "快速输入编辑器"
#: qt6/quickphrase-editor/editor.cpp:37
msgid "Refresh List"
msgstr "刷新列表"
#: qt6/quickphrase-editor/editor.cpp:35
msgid "Remove File"
msgstr "移除文件"
#: qt6/quickphrase-editor/editor.cpp:85
msgid "Save Changes"
msgstr "保存更改"
#: qt5/guiwrapper/wrapperapp.cpp:35 qt6/guiwrapper/wrapperapp.cpp:35
msgid "Test if config exists"
msgstr "检测配置是否存在"
#: qt6/quickphrase-editor/editor.cpp:86
msgid ""
"The content has changed.\n"
"Do you want to save the changes or discard them?"
msgstr ""
"内容已更改。\n"
"您想要保存还是撤销这些修改?"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:390
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:359
msgid "The key you just pressed is not supported by Qt."
msgstr "你刚刚按下的按键不被 Qt 支持。"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:391
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:360
msgid "Unsupported Key"
msgstr "不支持的按键"
#. i18n: file: qt6/quickphrase-editor/batchdialog.ui:50
#. i18n: ectx: property (text), widget (QLabel, infoLabel)
#: rc.cpp:6
#, kde-format
msgid "Use <Keyword> <Phrase> format on every line."
msgstr "每行使用 <关键词> <词组> 的格式。"
#: qt5/guiwrapper/wrapperapp.cpp:37 qt6/guiwrapper/wrapperapp.cpp:37
msgid "path"
msgstr "路径"
#: qt5/guiwrapper/wrapperapp.cpp:34 qt6/guiwrapper/wrapperapp.cpp:34
msgid "winid"
msgstr "窗口 id"

View File

@@ -0,0 +1,259 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the fcitx5-qt package.
#
# Translators:
# 黃柏諺 <s8321414@gmail.com>, 2017
# Billy SU <billy4195.su@gmail.com>, 2020
# bruh, 2020
# csslayer <wengxt@gmail.com>, 2022
# Neko ◣ 0xFF, 2022
# Lau YeeYu, 2023
#
msgid ""
msgstr ""
"Project-Id-Version: fcitx5-qt\n"
"Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n"
"POT-Creation-Date: 2023-11-24 20:24+0000\n"
"PO-Revision-Date: 2017-12-20 02:52+0000\n"
"Last-Translator: Lau YeeYu, 2023\n"
"Language-Team: Chinese (Taiwan) (https://app.transifex.com/fcitx/teams/12005/"
"zh_TW/)\n"
"Language: zh_TW\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: qt6/quickphrase-editor/editor.cpp:260
msgid "%1 is a system file, do you want to delete all phrases instead?"
msgstr "%1 是系統檔,您是否想要改為清空所有字詞?"
#. i18n: file: qt6/quickphrase-editor/editor.ui:52
#. i18n: ectx: property (text), widget (QPushButton, addButton)
#: rc.cpp:12
#, kde-format
msgid "&Add"
msgstr "新增(&A)"
#: qt5/guiwrapper/mainwindow.cpp:29 qt6/guiwrapper/mainwindow.cpp:29
msgid "&Apply"
msgstr "套用(&A)"
#. i18n: file: qt6/quickphrase-editor/editor.ui:63
#. i18n: ectx: property (text), widget (QPushButton, batchEditButton)
#: rc.cpp:15
#, kde-format
msgid "&Batch Edit"
msgstr "批次編輯(&B)"
#: qt5/guiwrapper/mainwindow.cpp:31 qt6/guiwrapper/mainwindow.cpp:31
msgid "&Close"
msgstr "關閉 (&C)"
#. i18n: file: qt6/quickphrase-editor/editor.ui:74
#. i18n: ectx: property (text), widget (QPushButton, deleteButton)
#: rc.cpp:18
#, kde-format
msgid "&Delete"
msgstr "刪除(&D)"
#. i18n: file: qt6/quickphrase-editor/editor.ui:103
#. i18n: ectx: property (text), widget (QPushButton, importButton)
#: rc.cpp:24
#, kde-format
msgid "&Import"
msgstr "匯入(&I)"
#: qt5/guiwrapper/mainwindow.cpp:28 qt6/guiwrapper/mainwindow.cpp:28
msgid "&Ok"
msgstr "確定(&O)"
#. i18n: file: qt6/quickphrase-editor/editor.ui:45
#. i18n: ectx: property (text), widget (QPushButton, operationButton)
#: rc.cpp:9
#, kde-format
msgid "&Operation"
msgstr "操作(&O)"
#: qt5/guiwrapper/mainwindow.cpp:30 qt6/guiwrapper/mainwindow.cpp:30
msgid "&Reset"
msgstr "重新設定 (&R)"
#: qt5/guiwrapper/wrapperapp.cpp:31 qt6/guiwrapper/wrapperapp.cpp:31
msgid "A launcher for Fcitx Gui plugin."
msgstr "Fcitx 圖形化介面外掛程式的啟動器。"
#: qt6/quickphrase-editor/editor.cpp:33
msgid "Add File"
msgstr "加入檔案"
#: qt6/quickphrase-editor/editor.cpp:272
msgid "Are you sure to delete %1?"
msgstr "您確定要刪除 %1"
#. i18n: file: qt6/quickphrase-editor/batchdialog.ui:14
#. i18n: ectx: property (windowTitle), widget (QDialog, BatchDialog)
#: rc.cpp:3
#, kde-format
msgid "Batch editing"
msgstr "批次編輯"
#: qt6/quickphrase-editor/editor.cpp:238
msgid "Cannot create file %1."
msgstr "無法建立檔案 %1。"
#: qt6/quickphrase-editor/editor.cpp:259
msgid "Cannot remove system file"
msgstr "無法移除系統檔案"
#: qt5/guiwrapper/wrapperapp.cpp:37 qt6/guiwrapper/wrapperapp.cpp:37
msgid "Config path"
msgstr "設定路徑"
#: qt6/quickphrase-editor/editor.cpp:271
msgid "Confirm deletion"
msgstr "確定刪除"
#: qt6/quickphrase-editor/editor.cpp:221
msgid "Create new file"
msgstr "建立新檔"
#. i18n: file: qt6/quickphrase-editor/editor.ui:85
#. i18n: ectx: property (text), widget (QPushButton, clearButton)
#: rc.cpp:21
#, kde-format
msgid "De&lete All"
msgstr "全部刪除(&L)"
#: qt6/quickphrase-editor/filelistmodel.cpp:29
msgid "Default"
msgstr "預設"
#. i18n: file: qt6/quickphrase-editor/editor.ui:114
#. i18n: ectx: property (text), widget (QPushButton, exportButton)
#: rc.cpp:27
#, kde-format
msgid "E&xport"
msgstr "匯出(&X)"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:353
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:322
msgid "Empty"
msgstr "空"
#: qt6/quickphrase-editor/editor.cpp:280
msgid "Error while deleting %1."
msgstr "刪除 %1 時出錯。"
#: qt5/guiwrapper/mainwindow.cpp:106 qt6/guiwrapper/mainwindow.cpp:106
msgid "Failed to notify Fcitx"
msgstr "通知 Fcitx 失敗"
#: qt5/guiwrapper/mainwindow.cpp:107 qt6/guiwrapper/mainwindow.cpp:107
msgid "Failed to notify Fcitx about the configuration change."
msgstr "通知 Fcitx 設定修改失敗。"
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:3
msgid "Fcitx 5 Qt5 Gui Wrapper"
msgstr "Fcitx 5 Qt5 圖形界面封装器"
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:3
msgid "Fcitx 5 Qt6 Gui Wrapper"
msgstr "Fcitx 5 Qt6 圖形使用者介面封裝"
#: qt6/quickphrase-editor/editor.cpp:237 qt6/quickphrase-editor/editor.cpp:279
msgid "File Operation Failed"
msgstr "檔案操作失敗"
#: qt6/quickphrase-editor/editor.cpp:226
msgid "File name should not contain '/'."
msgstr "檔案名稱不能有「/」。"
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:4
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:4
msgid "Input Method Configuration helper"
msgstr "輸入法設定助手"
#: qt6/quickphrase-editor/editor.cpp:225
msgid "Invalid filename"
msgstr "無效的檔案名稱"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:179
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:148
msgid "Key code mode"
msgstr "關鍵代碼模式"
#: qt6/quickphrase-editor/model.cpp:73
msgid "Keyword"
msgstr "關鍵字"
#: qt5/guiwrapper/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in:5
#: qt6/guiwrapper/org.fcitx.fcitx5-qt6-gui-wrapper.desktop.in.in:5
msgid "Load configuration plugin for Fcitx Addon"
msgstr "戴入Fcitx 附加組件的配置插件 "
#: qt5/guiwrapper/wrapperapp.cpp:34 qt6/guiwrapper/wrapperapp.cpp:34
msgid "Parent window ID"
msgstr "父視窗 ID"
#: qt6/quickphrase-editor/model.cpp:75
msgid "Phrase"
msgstr "字詞"
#: qt6/quickphrase-editor/editor.cpp:221
msgid "Please input a filename for newfile"
msgstr "請輸入新檔案的名稱"
#: qt6/quickphrase-editor/editor.cpp:101
msgid "Quick Phrase Editor"
msgstr "快速輸入編輯器"
#: qt6/quickphrase-editor/editor.cpp:37
msgid "Refresh List"
msgstr "更新列表"
#: qt6/quickphrase-editor/editor.cpp:35
msgid "Remove File"
msgstr "移除檔案"
#: qt6/quickphrase-editor/editor.cpp:85
msgid "Save Changes"
msgstr "儲存修改"
#: qt5/guiwrapper/wrapperapp.cpp:35 qt6/guiwrapper/wrapperapp.cpp:35
msgid "Test if config exists"
msgstr "測試設定是否存在"
#: qt6/quickphrase-editor/editor.cpp:86
msgid ""
"The content has changed.\n"
"Do you want to save the changes or discard them?"
msgstr ""
"內容已修改。\n"
"您想要儲存還是放棄這些修改?"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:390
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:359
msgid "The key you just pressed is not supported by Qt."
msgstr "Qt 不支援你剛輸入的按鍵組合"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:391
#: qt6/widgetsaddons/fcitxqtkeysequencewidget.cpp:360
msgid "Unsupported Key"
msgstr "不支援的按鍵組合"
#. i18n: file: qt6/quickphrase-editor/batchdialog.ui:50
#. i18n: ectx: property (text), widget (QLabel, infoLabel)
#: rc.cpp:6
#, kde-format
msgid "Use <Keyword> <Phrase> format on every line."
msgstr "每一行請使用 <Keyword> <Phrase> 格式。"
#: qt5/guiwrapper/wrapperapp.cpp:37 qt6/guiwrapper/wrapperapp.cpp:37
msgid "path"
msgstr "路徑"
#: qt5/guiwrapper/wrapperapp.cpp:34 qt6/guiwrapper/wrapperapp.cpp:34
msgid "winid"
msgstr "winid"

View File

@@ -0,0 +1,8 @@
find_package(Qt4 ${REQUIRED_QT4_VERSION} REQUIRED)
add_subdirectory(dbusaddons)
add_subdirectory(inputcontext)
if(NOT BUILD_ONLY_PLUGIN)
add_subdirectory(immodule-probing)
endif()

View File

@@ -0,0 +1,78 @@
ecm_setup_version(PROJECT VARIABLE_PREFIX FCITX5QT4DBUSADDONS
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/fcitx5qt4dbusaddons_version.h"
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/Fcitx5Qt4DBusAddonsConfigVersion.cmake"
SOVERSION 1)
# create a Config.cmake and a ConfigVersion.cmake file and install them
set(CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/Fcitx5Qt4DBusAddons")
configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/Fcitx5Qt4DBusAddonsConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/Fcitx5Qt4DBusAddonsConfig.cmake"
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
)
set(dbusaddons_SOURCES
fcitxqtwatcher.cpp
fcitxqtdbustypes.cpp
fcitxqtinputcontextproxy.cpp
fcitxqtinputcontextproxyimpl.cpp
fcitxqtinputmethodproxy.cpp
)
set(dbusaddons_HEADERS
fcitxqtwatcher.h
fcitxqtdbustypes.h
fcitxqtinputcontextproxy.h
fcitxqtinputmethodproxy.h
)
set(fcitxqtdbusaddons_INCLUDE_DIRS
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
)
add_library(Fcitx5Qt4DBusAddons ${LIBRARY_TYPE} ${dbusaddons_SOURCES})
generate_export_header(Fcitx5Qt4DBusAddons BASE_NAME Fcitx5Qt4DBusAddons)
add_library(Fcitx5Qt4::DBusAddons ALIAS Fcitx5Qt4DBusAddons)
target_include_directories(Fcitx5Qt4DBusAddons PUBLIC "$<BUILD_INTERFACE:${fcitxqtdbusaddons_INCLUDE_DIRS}>")
target_include_directories(Fcitx5Qt4DBusAddons INTERFACE "$<INSTALL_INTERFACE:${Fcitx5Qt4_INCLUDE_INSTALL_DIR}/Fcitx5Qt4DBusAddons>")
set_target_properties(Fcitx5Qt4DBusAddons
PROPERTIES VERSION ${FCITX5QT4DBUSADDONS_VERSION}
AUTOMOC TRUE
SOVERSION ${FCITX5QT4DBUSADDONS_SOVERSION}
POSITION_INDEPENDENT_CODE ON
EXPORT_NAME DBusAddons
)
target_link_libraries(
Fcitx5Qt4DBusAddons
PUBLIC
Qt4::QtCore
Qt4::QtDBus
)
if(BUILD_ONLY_PLUGIN)
set_target_properties(Fcitx5Qt4DBusAddons PROPERTIES
COMPILE_DEFINITIONS "FCITX5QT4DBUSADDONS_STATIC_DEFINE")
else()
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Fcitx5Qt4DBusAddonsConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/Fcitx5Qt4DBusAddonsConfigVersion.cmake"
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
COMPONENT Devel )
install(EXPORT Fcitx5Qt4DBusAddonsTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE Fcitx5Qt4DBusAddonsTargets.cmake NAMESPACE Fcitx5Qt4:: )
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/fcitx5qt4dbusaddons_version.h
DESTINATION ${Fcitx5Qt4_INCLUDE_INSTALL_DIR} COMPONENT Devel )
install(TARGETS Fcitx5Qt4DBusAddons EXPORT Fcitx5Qt4DBusAddonsTargets LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
install(FILES ${dbusaddons_HEADERS}
${CMAKE_CURRENT_BINARY_DIR}/fcitx5qt4dbusaddons_export.h
DESTINATION "${Fcitx5Qt4_INCLUDE_INSTALL_DIR}/Fcitx5Qt4DBusAddons")
endif()

View File

@@ -0,0 +1,7 @@
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
find_dependency(Qt4 @REQUIRED_QT4_VERSION@)
include("${CMAKE_CURRENT_LIST_DIR}/Fcitx5Qt4DBusAddonsTargets.cmake")

View File

@@ -0,0 +1,298 @@
/*
* SPDX-FileCopyrightText: 2012~2017 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#include <QDBusMetaType>
#include "fcitxqtdbustypes.h"
namespace fcitx {
#define FCITX5_QT_DEFINE_DBUS_TYPE(TYPE) \
qRegisterMetaType<TYPE>(#TYPE); \
qDBusRegisterMetaType<TYPE>(); \
qRegisterMetaType<TYPE##List>(#TYPE "List"); \
qDBusRegisterMetaType<TYPE##List>();
void registerFcitxQtDBusTypes() {
FCITX5_QT_DEFINE_DBUS_TYPE(FcitxQtFormattedPreedit);
FCITX5_QT_DEFINE_DBUS_TYPE(FcitxQtStringKeyValue);
FCITX5_QT_DEFINE_DBUS_TYPE(FcitxQtInputMethodEntry);
FCITX5_QT_DEFINE_DBUS_TYPE(FcitxQtLayoutInfo);
FCITX5_QT_DEFINE_DBUS_TYPE(FcitxQtVariantInfo);
FCITX5_QT_DEFINE_DBUS_TYPE(FcitxQtConfigOption);
FCITX5_QT_DEFINE_DBUS_TYPE(FcitxQtConfigType);
FCITX5_QT_DEFINE_DBUS_TYPE(FcitxQtAddonInfo);
FCITX5_QT_DEFINE_DBUS_TYPE(FcitxQtAddonState);
FCITX5_QT_DEFINE_DBUS_TYPE(FcitxQtAddonInfoV2);
}
bool FcitxQtFormattedPreedit::operator==(
const FcitxQtFormattedPreedit &preedit) const {
return (preedit.format_ == format_) && (preedit.string_ == string_);
}
QDBusArgument &operator<<(QDBusArgument &argument,
const FcitxQtFormattedPreedit &preedit) {
argument.beginStructure();
argument << preedit.string();
argument << preedit.format();
argument.endStructure();
return argument;
}
const QDBusArgument &operator>>(const QDBusArgument &argument,
FcitxQtFormattedPreedit &preedit) {
QString str;
qint32 format;
argument.beginStructure();
argument >> str >> format;
argument.endStructure();
preedit.setString(str);
preedit.setFormat(format);
return argument;
}
QDBusArgument &operator<<(QDBusArgument &argument,
const FcitxQtStringKeyValue &arg) {
argument.beginStructure();
argument << arg.key();
argument << arg.value();
argument.endStructure();
return argument;
}
const QDBusArgument &operator>>(const QDBusArgument &argument,
FcitxQtStringKeyValue &arg) {
QString key, value;
argument.beginStructure();
argument >> key >> value;
argument.endStructure();
arg.setKey(key);
arg.setValue(value);
return argument;
}
QDBusArgument &operator<<(QDBusArgument &argument,
const FcitxQtInputMethodEntry &arg) {
argument.beginStructure();
argument << arg.uniqueName();
argument << arg.name();
argument << arg.nativeName();
argument << arg.icon();
argument << arg.label();
argument << arg.languageCode();
argument << arg.configurable();
argument.endStructure();
return argument;
}
const QDBusArgument &operator>>(const QDBusArgument &argument,
FcitxQtInputMethodEntry &arg) {
QString uniqueName, name, nativeName, icon, label, languageCode;
bool configurable;
argument.beginStructure();
argument >> uniqueName >> name >> nativeName >> icon >> label >>
languageCode >> configurable;
argument.endStructure();
arg.setUniqueName(uniqueName);
arg.setName(name);
arg.setNativeName(nativeName);
arg.setIcon(icon);
arg.setLabel(label);
arg.setLanguageCode(languageCode);
arg.setConfigurable(configurable);
return argument;
}
QDBusArgument &operator<<(QDBusArgument &argument,
const FcitxQtVariantInfo &arg) {
argument.beginStructure();
argument << arg.variant();
argument << arg.description();
argument << arg.languages();
argument.endStructure();
return argument;
}
const QDBusArgument &operator>>(const QDBusArgument &argument,
FcitxQtVariantInfo &arg) {
QString variant, description;
QStringList languages;
argument.beginStructure();
argument >> variant >> description >> languages;
argument.endStructure();
arg.setVariant(variant);
arg.setDescription(description);
arg.setLanguages(languages);
return argument;
}
QDBusArgument &operator<<(QDBusArgument &argument,
const FcitxQtLayoutInfo &arg) {
argument.beginStructure();
argument << arg.layout();
argument << arg.description();
argument << arg.languages();
argument << arg.variants();
argument.endStructure();
return argument;
}
const QDBusArgument &operator>>(const QDBusArgument &argument,
FcitxQtLayoutInfo &arg) {
QString layout, description;
QStringList languages;
FcitxQtVariantInfoList variants;
argument.beginStructure();
argument >> layout >> description >> languages >> variants;
argument.endStructure();
arg.setLayout(layout);
arg.setDescription(description);
arg.setLanguages(languages);
arg.setVariants(variants);
return argument;
}
QDBusArgument &operator<<(QDBusArgument &argument,
const FcitxQtConfigOption &arg) {
argument.beginStructure();
argument << arg.name();
argument << arg.type();
argument << arg.description();
argument << arg.defaultValue();
argument << arg.properties();
argument.endStructure();
return argument;
}
const QDBusArgument &operator>>(const QDBusArgument &argument,
FcitxQtConfigOption &arg) {
QString name, description, type;
QDBusVariant defaultValue;
QVariantMap properties;
argument.beginStructure();
argument >> name >> type >> description >> defaultValue >> properties;
argument.endStructure();
arg.setName(name);
arg.setType(type);
arg.setDescription(description);
arg.setDefaultValue(defaultValue);
arg.setProperties(properties);
return argument;
}
QDBusArgument &operator<<(QDBusArgument &argument,
const FcitxQtConfigType &arg) {
argument.beginStructure();
argument << arg.name();
argument << arg.options();
argument.endStructure();
return argument;
}
const QDBusArgument &operator>>(const QDBusArgument &argument,
FcitxQtConfigType &arg) {
QString name;
FcitxQtConfigOptionList options;
argument.beginStructure();
argument >> name >> options;
argument.endStructure();
arg.setName(name);
arg.setOptions(options);
return argument;
}
QDBusArgument &operator<<(QDBusArgument &argument,
const FcitxQtAddonInfo &arg) {
argument.beginStructure();
argument << arg.uniqueName();
argument << arg.name();
argument << arg.comment();
argument << arg.category();
argument << arg.configurable();
argument << arg.enabled();
argument.endStructure();
return argument;
}
const QDBusArgument &operator>>(const QDBusArgument &argument,
FcitxQtAddonInfo &arg) {
QString uniqueName, name, comment;
int category;
bool configurable, enabled;
argument.beginStructure();
argument >> uniqueName >> name >> comment >> category >> configurable >>
enabled;
argument.endStructure();
arg.setUniqueName(uniqueName);
arg.setName(name);
arg.setComment(comment);
arg.setCategory(category);
arg.setConfigurable(configurable);
arg.setEnabled(enabled);
return argument;
}
QDBusArgument &operator<<(QDBusArgument &argument,
const FcitxQtAddonInfoV2 &arg) {
argument.beginStructure();
argument << arg.uniqueName();
argument << arg.name();
argument << arg.comment();
argument << arg.category();
argument << arg.configurable();
argument << arg.enabled();
argument << arg.onDemand();
argument << arg.dependencies();
argument << arg.optionalDependencies();
argument.endStructure();
return argument;
}
const QDBusArgument &operator>>(const QDBusArgument &argument,
FcitxQtAddonInfoV2 &arg) {
QString uniqueName, name, comment;
int category;
bool configurable, enabled, onDemand;
QStringList dependencies, optionalDependencies;
argument.beginStructure();
argument >> uniqueName >> name >> comment >> category >> configurable >>
enabled >> onDemand >> dependencies >> optionalDependencies;
argument.endStructure();
arg.setUniqueName(uniqueName);
arg.setName(name);
arg.setComment(comment);
arg.setCategory(category);
arg.setConfigurable(configurable);
arg.setEnabled(enabled);
arg.setOnDemand(onDemand);
arg.setDependencies(dependencies);
arg.setOptionalDependencies(optionalDependencies);
return argument;
}
QDBusArgument &operator<<(QDBusArgument &argument,
const FcitxQtAddonState &arg) {
argument.beginStructure();
argument << arg.uniqueName();
argument << arg.enabled();
argument.endStructure();
return argument;
}
const QDBusArgument &operator>>(const QDBusArgument &argument,
FcitxQtAddonState &arg) {
QString uniqueName;
bool enabled;
argument.beginStructure();
argument >> uniqueName >> enabled;
argument.endStructure();
arg.setUniqueName(uniqueName);
arg.setEnabled(enabled);
return argument;
}
} // namespace fcitx

View File

@@ -0,0 +1,157 @@
/*
* SPDX-FileCopyrightText: 2012~2017 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#ifndef _DBUSADDONS_FCITXQTDBUSTYPES_H_
#define _DBUSADDONS_FCITXQTDBUSTYPES_H_
#include "fcitx5qt4dbusaddons_export.h"
#include <QDBusArgument>
#include <QList>
#include <QMetaType>
#include <type_traits>
namespace fcitx {
FCITX5QT4DBUSADDONS_EXPORT void registerFcitxQtDBusTypes();
#define FCITX5_QT_BEGIN_DECLARE_DBUS_TYPE(TYPE) \
class FCITX5QT4DBUSADDONS_EXPORT TYPE { \
public:
#define FCITX5_QT_DECLARE_FIELD(TYPE, GETTER, SETTER) \
public: \
std::conditional_t<std::is_class<TYPE>::value, const TYPE &, TYPE> \
GETTER() const { \
return GETTER##_; \
} \
void SETTER( \
std::conditional_t<std::is_class<TYPE>::value, const TYPE &, TYPE> \
value) { \
GETTER##_ = value; \
} \
\
private: \
TYPE GETTER##_ = TYPE();
#define FCITX5_QT_END_DECLARE_DBUS_TYPE(TYPE) \
} \
; \
typedef QList<TYPE> TYPE##List; \
FCITX5QT4DBUSADDONS_EXPORT QDBusArgument &operator<<( \
QDBusArgument &argument, const TYPE &value); \
FCITX5QT4DBUSADDONS_EXPORT const QDBusArgument &operator>>( \
const QDBusArgument &argument, TYPE &value);
FCITX5_QT_BEGIN_DECLARE_DBUS_TYPE(FcitxQtFormattedPreedit);
FCITX5_QT_DECLARE_FIELD(QString, string, setString);
FCITX5_QT_DECLARE_FIELD(qint32, format, setFormat);
public:
bool operator==(const FcitxQtFormattedPreedit &preedit) const;
FCITX5_QT_END_DECLARE_DBUS_TYPE(FcitxQtFormattedPreedit);
FCITX5_QT_BEGIN_DECLARE_DBUS_TYPE(FcitxQtStringKeyValue);
FCITX5_QT_DECLARE_FIELD(QString, key, setKey);
FCITX5_QT_DECLARE_FIELD(QString, value, setValue);
FCITX5_QT_END_DECLARE_DBUS_TYPE(FcitxQtStringKeyValue);
FCITX5_QT_BEGIN_DECLARE_DBUS_TYPE(FcitxQtInputMethodEntry);
FCITX5_QT_DECLARE_FIELD(QString, uniqueName, setUniqueName);
FCITX5_QT_DECLARE_FIELD(QString, name, setName);
FCITX5_QT_DECLARE_FIELD(QString, nativeName, setNativeName);
FCITX5_QT_DECLARE_FIELD(QString, icon, setIcon);
FCITX5_QT_DECLARE_FIELD(QString, label, setLabel);
FCITX5_QT_DECLARE_FIELD(QString, languageCode, setLanguageCode);
FCITX5_QT_DECLARE_FIELD(bool, configurable, setConfigurable);
FCITX5_QT_END_DECLARE_DBUS_TYPE(FcitxQtInputMethodEntry);
FCITX5_QT_BEGIN_DECLARE_DBUS_TYPE(FcitxQtVariantInfo);
FCITX5_QT_DECLARE_FIELD(QString, variant, setVariant);
FCITX5_QT_DECLARE_FIELD(QString, description, setDescription);
FCITX5_QT_DECLARE_FIELD(QStringList, languages, setLanguages);
FCITX5_QT_END_DECLARE_DBUS_TYPE(FcitxQtVariantInfo);
FCITX5_QT_BEGIN_DECLARE_DBUS_TYPE(FcitxQtLayoutInfo);
FCITX5_QT_DECLARE_FIELD(QString, layout, setLayout);
FCITX5_QT_DECLARE_FIELD(QString, description, setDescription);
FCITX5_QT_DECLARE_FIELD(QStringList, languages, setLanguages);
FCITX5_QT_DECLARE_FIELD(FcitxQtVariantInfoList, variants, setVariants);
FCITX5_QT_END_DECLARE_DBUS_TYPE(FcitxQtLayoutInfo);
FCITX5_QT_BEGIN_DECLARE_DBUS_TYPE(FcitxQtConfigOption);
FCITX5_QT_DECLARE_FIELD(QString, name, setName);
FCITX5_QT_DECLARE_FIELD(QString, type, setType);
FCITX5_QT_DECLARE_FIELD(QString, description, setDescription);
FCITX5_QT_DECLARE_FIELD(QDBusVariant, defaultValue, setDefaultValue);
FCITX5_QT_DECLARE_FIELD(QVariantMap, properties, setProperties);
FCITX5_QT_END_DECLARE_DBUS_TYPE(FcitxQtConfigOption);
FCITX5_QT_BEGIN_DECLARE_DBUS_TYPE(FcitxQtConfigType);
FCITX5_QT_DECLARE_FIELD(QString, name, setName);
FCITX5_QT_DECLARE_FIELD(FcitxQtConfigOptionList, options, setOptions);
FCITX5_QT_END_DECLARE_DBUS_TYPE(FcitxQtConfigType);
FCITX5_QT_BEGIN_DECLARE_DBUS_TYPE(FcitxQtAddonInfo);
FCITX5_QT_DECLARE_FIELD(QString, uniqueName, setUniqueName);
FCITX5_QT_DECLARE_FIELD(QString, name, setName);
FCITX5_QT_DECLARE_FIELD(QString, comment, setComment);
FCITX5_QT_DECLARE_FIELD(int, category, setCategory);
FCITX5_QT_DECLARE_FIELD(bool, configurable, setConfigurable);
FCITX5_QT_DECLARE_FIELD(bool, enabled, setEnabled);
FCITX5_QT_END_DECLARE_DBUS_TYPE(FcitxQtAddonInfo);
FCITX5_QT_BEGIN_DECLARE_DBUS_TYPE(FcitxQtAddonInfoV2);
FCITX5_QT_DECLARE_FIELD(QString, uniqueName, setUniqueName);
FCITX5_QT_DECLARE_FIELD(QString, name, setName);
FCITX5_QT_DECLARE_FIELD(QString, comment, setComment);
FCITX5_QT_DECLARE_FIELD(int, category, setCategory);
FCITX5_QT_DECLARE_FIELD(bool, configurable, setConfigurable);
FCITX5_QT_DECLARE_FIELD(bool, enabled, setEnabled);
FCITX5_QT_DECLARE_FIELD(bool, onDemand, setOnDemand);
FCITX5_QT_DECLARE_FIELD(QStringList, dependencies, setDependencies);
FCITX5_QT_DECLARE_FIELD(QStringList, optionalDependencies,
setOptionalDependencies);
FCITX5_QT_END_DECLARE_DBUS_TYPE(FcitxQtAddonInfoV2);
FCITX5_QT_BEGIN_DECLARE_DBUS_TYPE(FcitxQtAddonState);
FCITX5_QT_DECLARE_FIELD(QString, uniqueName, setUniqueName);
FCITX5_QT_DECLARE_FIELD(bool, enabled, setEnabled);
FCITX5_QT_END_DECLARE_DBUS_TYPE(FcitxQtAddonState);
} // namespace fcitx
Q_DECLARE_METATYPE(fcitx::FcitxQtFormattedPreedit)
Q_DECLARE_METATYPE(fcitx::FcitxQtFormattedPreeditList)
Q_DECLARE_METATYPE(fcitx::FcitxQtStringKeyValue)
Q_DECLARE_METATYPE(fcitx::FcitxQtStringKeyValueList)
Q_DECLARE_METATYPE(fcitx::FcitxQtInputMethodEntry)
Q_DECLARE_METATYPE(fcitx::FcitxQtInputMethodEntryList)
Q_DECLARE_METATYPE(fcitx::FcitxQtVariantInfo)
Q_DECLARE_METATYPE(fcitx::FcitxQtVariantInfoList)
Q_DECLARE_METATYPE(fcitx::FcitxQtLayoutInfo)
Q_DECLARE_METATYPE(fcitx::FcitxQtLayoutInfoList)
Q_DECLARE_METATYPE(fcitx::FcitxQtConfigOption)
Q_DECLARE_METATYPE(fcitx::FcitxQtConfigOptionList)
Q_DECLARE_METATYPE(fcitx::FcitxQtConfigType)
Q_DECLARE_METATYPE(fcitx::FcitxQtConfigTypeList)
Q_DECLARE_METATYPE(fcitx::FcitxQtAddonInfo)
Q_DECLARE_METATYPE(fcitx::FcitxQtAddonInfoList)
Q_DECLARE_METATYPE(fcitx::FcitxQtAddonInfoV2)
Q_DECLARE_METATYPE(fcitx::FcitxQtAddonInfoV2List)
Q_DECLARE_METATYPE(fcitx::FcitxQtAddonState)
Q_DECLARE_METATYPE(fcitx::FcitxQtAddonStateList)
#endif // _DBUSADDONS_FCITXQTDBUSTYPES_H_

View File

@@ -0,0 +1,133 @@
/*
* SPDX-FileCopyrightText: 2017~2017 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#include "fcitxqtinputcontextproxy_p.h"
#include <QCoreApplication>
#include <QDBusConnectionInterface>
#include <QDBusInterface>
#include <QDBusMetaType>
#include <QFileInfo>
#include <QTimer>
namespace fcitx {
FcitxQtInputContextProxy::FcitxQtInputContextProxy(FcitxQtWatcher *watcher,
QObject *parent)
: QObject(parent),
d_ptr(new FcitxQtInputContextProxyPrivate(watcher, this)) {}
FcitxQtInputContextProxy::~FcitxQtInputContextProxy() {
Q_D(FcitxQtInputContextProxy);
if (isValid()) {
d->icproxy_->DestroyIC();
}
delete d_ptr;
}
void FcitxQtInputContextProxy::setDisplay(const QString &display) {
Q_D(FcitxQtInputContextProxy);
d->display_ = display;
}
const QString &FcitxQtInputContextProxy::display() const {
Q_D(const FcitxQtInputContextProxy);
return d->display_;
}
bool FcitxQtInputContextProxy::isValid() const {
Q_D(const FcitxQtInputContextProxy);
return d->isValid();
}
QDBusPendingReply<> FcitxQtInputContextProxy::focusIn() {
Q_D(FcitxQtInputContextProxy);
return d->icproxy_->FocusIn();
}
QDBusPendingReply<> FcitxQtInputContextProxy::focusOut() {
Q_D(FcitxQtInputContextProxy);
return d->icproxy_->FocusOut();
}
QDBusPendingReply<bool> FcitxQtInputContextProxy::processKeyEvent(
unsigned int keyval, unsigned int keycode, unsigned int state, bool type,
unsigned int time) {
Q_D(FcitxQtInputContextProxy);
return d->icproxy_->ProcessKeyEvent(keyval, keycode, state, type, time);
}
QDBusPendingReply<> FcitxQtInputContextProxy::reset() {
Q_D(FcitxQtInputContextProxy);
return d->icproxy_->Reset();
}
QDBusPendingReply<>
FcitxQtInputContextProxy::setSupportedCapability(qulonglong caps) {
Q_D(FcitxQtInputContextProxy);
return d->icproxy_->SetSupportedCapability(caps);
}
QDBusPendingReply<> FcitxQtInputContextProxy::setCapability(qulonglong caps) {
Q_D(FcitxQtInputContextProxy);
return d->icproxy_->SetCapability(caps);
}
QDBusPendingReply<> FcitxQtInputContextProxy::setCursorRect(int x, int y, int w,
int h) {
Q_D(FcitxQtInputContextProxy);
return d->icproxy_->SetCursorRect(x, y, w, h);
}
QDBusPendingReply<> FcitxQtInputContextProxy::setCursorRectV2(int x, int y,
int w, int h,
double scale) {
Q_D(FcitxQtInputContextProxy);
return d->icproxy_->SetCursorRectV2(x, y, w, h, scale);
}
QDBusPendingReply<> FcitxQtInputContextProxy::setSurroundingText(
const QString &text, unsigned int cursor, unsigned int anchor) {
Q_D(FcitxQtInputContextProxy);
return d->icproxy_->SetSurroundingText(text, cursor, anchor);
}
QDBusPendingReply<>
FcitxQtInputContextProxy::setSurroundingTextPosition(unsigned int cursor,
unsigned int anchor) {
Q_D(FcitxQtInputContextProxy);
return d->icproxy_->SetSurroundingTextPosition(cursor, anchor);
}
QDBusPendingReply<> FcitxQtInputContextProxy::prevPage() {
Q_D(FcitxQtInputContextProxy);
return d->icproxy_->PrevPage();
}
QDBusPendingReply<> FcitxQtInputContextProxy::nextPage() {
Q_D(FcitxQtInputContextProxy);
return d->icproxy_->NextPage();
}
QDBusPendingReply<> FcitxQtInputContextProxy::selectCandidate(int i) {
Q_D(FcitxQtInputContextProxy);
return d->icproxy_->SelectCandidate(i);
}
QDBusPendingReply<> FcitxQtInputContextProxy::invokeAction(unsigned int action,
int cursor) {
Q_D(FcitxQtInputContextProxy);
return d->icproxy_->InvokeAction(action, cursor);
}
bool FcitxQtInputContextProxy::supportInvokeAction() const {
Q_D(const FcitxQtInputContextProxy);
return d->supportInvokeAction_;
}
} // namespace fcitx
#include "moc_fcitxqtinputcontextproxy.cpp"

View File

@@ -0,0 +1,93 @@
/*
* SPDX-FileCopyrightText: 2012~2017 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#ifndef _DBUSADDONS_FCITXQTINPUTCONTEXTPROXY_H_
#define _DBUSADDONS_FCITXQTINPUTCONTEXTPROXY_H_
#include "fcitx5qt4dbusaddons_export.h"
#include "fcitxqtdbustypes.h"
#include <QDBusConnection>
#include <QDBusPendingReply>
#include <QDBusServiceWatcher>
#include <QObject>
class QDBusPendingCallWatcher;
namespace fcitx {
class FcitxQtWatcher;
class FcitxQtInputContextProxyPrivate;
class FCITX5QT4DBUSADDONS_EXPORT FcitxQtInputContextProxy : public QObject {
Q_OBJECT
public:
FcitxQtInputContextProxy(FcitxQtWatcher *watcher, QObject *parent);
~FcitxQtInputContextProxy();
bool isValid() const;
void setDisplay(const QString &display);
const QString &display() const;
public Q_SLOTS:
QDBusPendingReply<> focusIn();
QDBusPendingReply<> focusOut();
QDBusPendingReply<bool> processKeyEvent(unsigned int keyval,
unsigned int keycode,
unsigned int state, bool type,
unsigned int time);
QDBusPendingReply<> reset();
QDBusPendingReply<> setSupportedCapability(qulonglong caps);
QDBusPendingReply<> setCapability(qulonglong caps);
QDBusPendingReply<> setCursorRect(int x, int y, int w, int h);
QDBusPendingReply<> setCursorRectV2(int x, int y, int w, int h,
double scale);
QDBusPendingReply<> setSurroundingText(const QString &text,
unsigned int cursor,
unsigned int anchor);
QDBusPendingReply<> setSurroundingTextPosition(unsigned int cursor,
unsigned int anchor);
QDBusPendingReply<> prevPage();
QDBusPendingReply<> nextPage();
QDBusPendingReply<> selectCandidate(int i);
QDBusPendingReply<> invokeAction(unsigned int action, int cursor);
bool supportInvokeAction() const;
Q_SIGNALS:
void commitString(const QString &str);
void currentIM(const QString &name, const QString &uniqueName,
const QString &langCode);
void deleteSurroundingText(int offset, unsigned int nchar);
void forwardKey(unsigned int keyval, unsigned int state, bool isRelease);
void updateFormattedPreedit(const FcitxQtFormattedPreeditList &str,
int cursorpos);
void updateClientSideUI(const FcitxQtFormattedPreeditList &preedit,
int cursorpos,
const FcitxQtFormattedPreeditList &auxUp,
const FcitxQtFormattedPreeditList &auxDown,
const FcitxQtStringKeyValueList &candidates,
int candidateIndex, int layoutHint, bool hasPrev,
bool hasNext);
void inputContextCreated(const QByteArray &uuid);
void notifyFocusOut();
private:
Q_PRIVATE_SLOT(d_func(), void availabilityChanged());
Q_PRIVATE_SLOT(d_func(), void recheck());
Q_PRIVATE_SLOT(d_func(), void cleanUp());
Q_PRIVATE_SLOT(d_func(), void serviceUnregistered());
Q_PRIVATE_SLOT(d_func(), void createInputContextFinished());
Q_PRIVATE_SLOT(d_func(), void introspectFinished());
FcitxQtInputContextProxyPrivate *const d_ptr;
Q_DECLARE_PRIVATE(FcitxQtInputContextProxy);
};
} // namespace fcitx
#endif // _DBUSADDONS_FCITXQTINPUTCONTEXTPROXY_H_

View File

@@ -0,0 +1,218 @@
/*
* SPDX-FileCopyrightText: 2012~2017 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#ifndef _DBUSADDONS_FCITXQTINPUTCONTEXTPROXY_P_H_
#define _DBUSADDONS_FCITXQTINPUTCONTEXTPROXY_P_H_
#include "fcitxqtinputcontextproxy.h"
#include "fcitxqtinputcontextproxyimpl.h"
#include "fcitxqtinputmethodproxy.h"
#include "fcitxqtwatcher.h"
#include <QDBusServiceWatcher>
namespace fcitx {
class FcitxQtInputContextProxyPrivate {
public:
FcitxQtInputContextProxyPrivate(FcitxQtWatcher *watcher,
FcitxQtInputContextProxy *q)
: q_ptr(q), fcitxWatcher_(watcher), watcher_(q) {
registerFcitxQtDBusTypes();
QObject::connect(fcitxWatcher_, SIGNAL(availabilityChanged(bool)), q,
SLOT(availabilityChanged()));
watcher_.setWatchMode(QDBusServiceWatcher::WatchForUnregistration);
QObject::connect(&watcher_, SIGNAL(serviceUnregistered(QString)), q,
SLOT(serviceUnregistered()));
availabilityChanged();
}
~FcitxQtInputContextProxyPrivate() {
if (isValid()) {
icproxy_->DestroyIC();
}
}
bool isValid() const { return (icproxy_ && icproxy_->isValid()); }
void serviceUnregistered() {
cleanUp();
availabilityChanged();
}
void availabilityChanged() {
QTimer::singleShot(100, q_ptr, SLOT(recheck()));
}
void recheck() {
if (!isValid() && fcitxWatcher_->availability()) {
createInputContext();
}
if (!fcitxWatcher_->availability()) {
cleanUp();
}
}
void cleanUp() {
auto services = watcher_.watchedServices();
for (const auto &service : services) {
watcher_.removeWatchedService(service);
}
delete improxy_;
improxy_ = nullptr;
delete icproxy_;
icproxy_ = nullptr;
delete createInputContextWatcher_;
createInputContextWatcher_ = nullptr;
delete introspectWatcher_;
introspectWatcher_ = nullptr;
supportInvokeAction_ = false;
}
void createInputContext() {
Q_Q(FcitxQtInputContextProxy);
if (!fcitxWatcher_->availability()) {
return;
}
cleanUp();
auto service = fcitxWatcher_->serviceName();
auto connection = fcitxWatcher_->connection();
auto owner = connection.interface()->serviceOwner(service);
if (!owner.isValid()) {
return;
}
watcher_.setConnection(connection);
watcher_.setWatchedServices(QStringList() << owner);
// Avoid race, query again.
if (!connection.interface()->isServiceRegistered(owner)) {
cleanUp();
return;
}
QFileInfo info(QCoreApplication::applicationFilePath());
portal_ = true;
improxy_ = new FcitxQtInputMethodProxy(
owner, "/org/freedesktop/portal/inputmethod", connection, q);
FcitxQtStringKeyValueList list;
FcitxQtStringKeyValue arg;
arg.setKey("program");
arg.setValue(info.fileName());
list << arg;
if (!display_.isEmpty()) {
FcitxQtStringKeyValue arg2;
arg2.setKey("display");
arg2.setValue(display_);
list << arg2;
}
// Qt has good support for showing virtual keyboard, so we should
// disable the default behavior supported by fcitx5
FcitxQtStringKeyValue clientControlVirtualkeyboardShow;
clientControlVirtualkeyboardShow.setKey(
"clientControlVirtualkeyboardShow");
clientControlVirtualkeyboardShow.setValue("true");
list << clientControlVirtualkeyboardShow;
// Qt has poor support for hiding virtual keyboard, so we should enable
// the default behavior supported by fcitx5
FcitxQtStringKeyValue clientControlVirtualkeyboardHide;
clientControlVirtualkeyboardHide.setKey(
"clientControlVirtualkeyboardHide");
clientControlVirtualkeyboardHide.setValue("false");
list << clientControlVirtualkeyboardHide;
auto result = improxy_->CreateInputContext(list);
createInputContextWatcher_ = new QDBusPendingCallWatcher(result);
QObject::connect(createInputContextWatcher_,
SIGNAL(finished(QDBusPendingCallWatcher *)), q,
SLOT(createInputContextFinished()));
}
void createInputContextFinished() {
Q_Q(FcitxQtInputContextProxy);
if (createInputContextWatcher_->isError()) {
cleanUp();
return;
}
QDBusPendingReply<QDBusObjectPath, QByteArray> reply(
*createInputContextWatcher_);
icproxy_ = new FcitxQtInputContextProxyImpl(improxy_->service(),
reply.value().path(),
improxy_->connection(), q);
QObject::connect(icproxy_, SIGNAL(CommitString(QString)), q,
SIGNAL(commitString(QString)));
QObject::connect(icproxy_, SIGNAL(CurrentIM(QString, QString, QString)),
q, SIGNAL(currentIM(QString, QString, QString)));
QObject::connect(
icproxy_, SIGNAL(ForwardKey(unsigned int, unsigned int, bool)), q,
SIGNAL(forwardKey(unsigned int, unsigned int, bool)));
QObject::connect(
icproxy_,
SIGNAL(UpdateFormattedPreedit(FcitxQtFormattedPreeditList, int)), q,
SIGNAL(updateFormattedPreedit(FcitxQtFormattedPreeditList, int)));
QObject::connect(icproxy_,
SIGNAL(DeleteSurroundingText(int, unsigned int)), q,
SIGNAL(deleteSurroundingText(int, unsigned int)));
QObject::connect(icproxy_, SIGNAL(NotifyFocusOut()), q,
SIGNAL(notifyFocusOut()));
delete createInputContextWatcher_;
createInputContextWatcher_ = nullptr;
Q_EMIT q->inputContextCreated(reply.argumentAt<1>());
introspect();
}
void introspect() {
Q_Q(FcitxQtInputContextProxy);
if (introspectWatcher_) {
delete introspectWatcher_;
introspectWatcher_ = nullptr;
}
QDBusMessage call = QDBusMessage::createMethodCall(
icproxy_->service(), icproxy_->path(),
"org.freedesktop.DBus.Introspectable", "Introspect");
introspectWatcher_ = new QDBusPendingCallWatcher(
fcitxWatcher_->connection().asyncCall(call));
QObject::connect(introspectWatcher_,
SIGNAL(finished(QDBusPendingCallWatcher *)), q,
SLOT(introspectFinished()));
}
void introspectFinished() {
if (introspectWatcher_->isFinished() &&
!introspectWatcher_->isError()) {
QDBusPendingReply<QString> reply = *introspectWatcher_;
if (reply.value().contains("InvokeAction")) {
supportInvokeAction_ = true;
}
}
delete introspectWatcher_;
introspectWatcher_ = nullptr;
}
FcitxQtInputContextProxy *q_ptr;
Q_DECLARE_PUBLIC(FcitxQtInputContextProxy);
FcitxQtWatcher *fcitxWatcher_;
QDBusServiceWatcher watcher_;
FcitxQtInputMethodProxy *improxy_ = nullptr;
FcitxQtInputContextProxyImpl *icproxy_ = nullptr;
bool supportInvokeAction_ = false;
QDBusPendingCallWatcher *createInputContextWatcher_ = nullptr;
QDBusPendingCallWatcher *introspectWatcher_ = nullptr;
QString display_;
bool portal_ = false;
};
} // namespace fcitx
#endif // _DBUSADDONS_FCITXQTINPUTCONTEXTPROXY_P_H_

View File

@@ -0,0 +1,29 @@
/*
* This file was generated by qdbusxml2cpp version 0.7
* Command line was: qdbusxml2cpp -N -p fcitxqtinputcontextproxyimpl -c
* FcitxQtInputContextProxyImpl interfaces/org.fcitx.Fcitx.InputContext1.xml -i
* fcitxqtdbustypes.h -i fcitx5qt4dbusaddons_export.h
*
* qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd.
*
* This is an auto-generated file.
* This file may have been hand-edited. Look for HAND-EDIT comments
* before re-generating it.
*/
#include "fcitxqtinputcontextproxyimpl.h"
namespace fcitx {
/*
* Implementation of interface class FcitxQtInputContextProxyImpl
*/
FcitxQtInputContextProxyImpl::FcitxQtInputContextProxyImpl(
const QString &service, const QString &path,
const QDBusConnection &connection, QObject *parent)
: QDBusAbstractInterface(service, path, staticInterfaceName(), connection,
parent) {}
FcitxQtInputContextProxyImpl::~FcitxQtInputContextProxyImpl() {}
} // namespace fcitx

View File

@@ -0,0 +1,176 @@
/*
* This file was generated by qdbusxml2cpp version 0.7
* Command line was: qdbusxml2cpp -N -p fcitxqtinputcontextproxyimpl -c
* FcitxQtInputContextProxyImpl interfaces/org.fcitx.Fcitx.InputContext1.xml -i
* fcitxqtdbustypes.h -i fcitx5qt4dbusaddons_export.h
*
* qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd.
*
* This is an auto-generated file.
* Do not edit! All changes made to it will be lost.
*/
#ifndef FCITXQTINPUTCONTEXTPROXYIMPL_H_1637715099
#define FCITXQTINPUTCONTEXTPROXYIMPL_H_1637715099
#include "fcitx5qt4dbusaddons_export.h"
#include "fcitxqtdbustypes.h"
#include <QtCore/QByteArray>
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QVariant>
#include <QtDBus/QtDBus>
namespace fcitx {
/*
* Proxy class for interface org.fcitx.Fcitx.InputContext1
*/
class FcitxQtInputContextProxyImpl : public QDBusAbstractInterface {
Q_OBJECT
public:
static inline const char *staticInterfaceName() {
return "org.fcitx.Fcitx.InputContext1";
}
public:
FcitxQtInputContextProxyImpl(const QString &service, const QString &path,
const QDBusConnection &connection,
QObject *parent = 0);
~FcitxQtInputContextProxyImpl();
public Q_SLOTS: // METHODS
inline QDBusPendingReply<> DestroyIC() {
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QLatin1String("DestroyIC"),
argumentList);
}
inline QDBusPendingReply<> FocusIn() {
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QLatin1String("FocusIn"),
argumentList);
}
inline QDBusPendingReply<> FocusOut() {
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QLatin1String("FocusOut"),
argumentList);
}
inline QDBusPendingReply<> InvokeAction(unsigned int action, int cursor) {
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(action)
<< QVariant::fromValue(cursor);
return asyncCallWithArgumentList(QLatin1String("InvokeAction"),
argumentList);
}
inline QDBusPendingReply<> NextPage() {
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QLatin1String("NextPage"),
argumentList);
}
inline QDBusPendingReply<> PrevPage() {
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QLatin1String("PrevPage"),
argumentList);
}
inline QDBusPendingReply<bool> ProcessKeyEvent(unsigned int keyval, unsigned int keycode,
unsigned int state, bool type,
unsigned int time) {
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(keyval)
<< QVariant::fromValue(keycode)
<< QVariant::fromValue(state) << QVariant::fromValue(type)
<< QVariant::fromValue(time);
return asyncCallWithArgumentList(QLatin1String("ProcessKeyEvent"),
argumentList);
}
inline QDBusPendingReply<> Reset() {
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QLatin1String("Reset"), argumentList);
}
inline QDBusPendingReply<> SelectCandidate(int index) {
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(index);
return asyncCallWithArgumentList(QLatin1String("SelectCandidate"),
argumentList);
}
inline QDBusPendingReply<> SetSupportedCapability(qulonglong caps)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(caps);
return asyncCallWithArgumentList(QLatin1String("SetSupportedCapability"), argumentList);
}
inline QDBusPendingReply<> SetCapability(qulonglong caps) {
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(caps);
return asyncCallWithArgumentList(QLatin1String("SetCapability"),
argumentList);
}
inline QDBusPendingReply<> SetCursorRect(int x, int y, int w, int h) {
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(x) << QVariant::fromValue(y)
<< QVariant::fromValue(w) << QVariant::fromValue(h);
return asyncCallWithArgumentList(QLatin1String("SetCursorRect"),
argumentList);
}
inline QDBusPendingReply<> SetCursorRectV2(int x, int y, int w, int h,
double scale) {
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(x) << QVariant::fromValue(y)
<< QVariant::fromValue(w) << QVariant::fromValue(h)
<< QVariant::fromValue(scale);
return asyncCallWithArgumentList(QLatin1String("SetCursorRectV2"),
argumentList);
}
inline QDBusPendingReply<> SetSurroundingText(const QString &text,
unsigned int cursor, unsigned int anchor) {
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(text) << QVariant::fromValue(cursor)
<< QVariant::fromValue(anchor);
return asyncCallWithArgumentList(QLatin1String("SetSurroundingText"),
argumentList);
}
inline QDBusPendingReply<> SetSurroundingTextPosition(unsigned int cursor,
unsigned int anchor) {
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(cursor)
<< QVariant::fromValue(anchor);
return asyncCallWithArgumentList(
QLatin1String("SetSurroundingTextPosition"), argumentList);
}
Q_SIGNALS: // SIGNALS
void CommitString(const QString &str);
void CurrentIM(const QString &name, const QString &uniqueName,
const QString &langCode);
void DeleteSurroundingText(int offset, unsigned int nchar);
void ForwardKey(unsigned int keyval, unsigned int state, bool type);
void NotifyFocusOut();
void UpdateClientSideUI(FcitxQtFormattedPreeditList preedit, int cursorpos,
FcitxQtFormattedPreeditList auxUp,
FcitxQtFormattedPreeditList auxDown,
FcitxQtFormattedPreeditList candidates,
int candidateIndex, int layoutHint, bool hasPrev,
bool hasNext);
void UpdateFormattedPreedit(FcitxQtFormattedPreeditList str, int cursorpos);
};
} // namespace fcitx
#endif

View File

@@ -0,0 +1,29 @@
/*
* This file was generated by qdbusxml2cpp version 0.7
* Command line was: qdbusxml2cpp -N -p fcitxqtinputmethodproxy -c FcitxQtInputMethodProxy interfaces/org.fcitx.Fcitx.InputMethod1.xml -i fcitxqtdbustypes.h -i fcitx5qt4dbusaddons_export.h
*
* qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd.
*
* This is an auto-generated file.
* This file may have been hand-edited. Look for HAND-EDIT comments
* before re-generating it.
*/
#include "fcitxqtinputmethodproxy.h"
namespace fcitx {
/*
* Implementation of interface class FcitxQtInputMethodProxy
*/
FcitxQtInputMethodProxy::FcitxQtInputMethodProxy(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
: QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
{
}
FcitxQtInputMethodProxy::~FcitxQtInputMethodProxy()
{
}
}

View File

@@ -0,0 +1,65 @@
/*
* This file was generated by qdbusxml2cpp version 0.7
* Command line was: qdbusxml2cpp -N -p fcitxqtinputmethodproxy -c FcitxQtInputMethodProxy interfaces/org.fcitx.Fcitx.InputMethod1.xml -i fcitxqtdbustypes.h -i fcitx5qt4dbusaddons_export.h
*
* qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd.
*
* This is an auto-generated file.
* Do not edit! All changes made to it will be lost.
*/
#ifndef FCITXQTINPUTMETHODPROXY_H_1637715099
#define FCITXQTINPUTMETHODPROXY_H_1637715099
#include <QtCore/QObject>
#include <QtCore/QByteArray>
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QVariant>
#include <QtDBus/QtDBus>
#include "fcitxqtdbustypes.h"
#include "fcitx5qt4dbusaddons_export.h"
namespace fcitx {
/*
* Proxy class for interface org.fcitx.Fcitx.InputMethod1
*/
class FCITX5QT4DBUSADDONS_EXPORT FcitxQtInputMethodProxy: public QDBusAbstractInterface
{
Q_OBJECT
public:
static inline const char *staticInterfaceName()
{ return "org.fcitx.Fcitx.InputMethod1"; }
public:
FcitxQtInputMethodProxy(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
~FcitxQtInputMethodProxy();
public Q_SLOTS: // METHODS
inline QDBusPendingReply<QDBusObjectPath, QByteArray> CreateInputContext(FcitxQtStringKeyValueList in0)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(in0);
return asyncCallWithArgumentList(QLatin1String("CreateInputContext"), argumentList);
}
inline QDBusReply<QDBusObjectPath> CreateInputContext(FcitxQtStringKeyValueList in0, QByteArray &out1)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(in0);
QDBusMessage reply = callWithArgumentList(QDBus::Block, QLatin1String("CreateInputContext"), argumentList);
if (reply.type() == QDBusMessage::ReplyMessage && reply.arguments().count() == 2) {
out1 = qdbus_cast<QByteArray>(reply.arguments().at(1));
}
return reply;
}
Q_SIGNALS: // SIGNALS
};
}
#endif

View File

@@ -0,0 +1,142 @@
/*
* SPDX-FileCopyrightText: 2012~2017 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#include "fcitxqtwatcher_p.h"
#include <QDBusConnection>
#include <QDBusConnectionInterface>
#include <QDBusServiceWatcher>
namespace fcitx {
FcitxQtWatcher::FcitxQtWatcher(QObject *parent)
: QObject(parent), d_ptr(new FcitxQtWatcherPrivate(this)) {}
FcitxQtWatcher::FcitxQtWatcher(const QDBusConnection &connection,
QObject *parent)
: FcitxQtWatcher(parent) {
setConnection(connection);
}
FcitxQtWatcher::~FcitxQtWatcher() { delete d_ptr; }
bool FcitxQtWatcher::availability() const {
Q_D(const FcitxQtWatcher);
return d->availability_;
}
void FcitxQtWatcher::setConnection(const QDBusConnection &connection) {
Q_D(FcitxQtWatcher);
return d->serviceWatcher_.setConnection(connection);
}
QDBusConnection FcitxQtWatcher::connection() const {
Q_D(const FcitxQtWatcher);
return d->serviceWatcher_.connection();
}
void FcitxQtWatcher::setWatchPortal(bool portal) {
Q_D(FcitxQtWatcher);
d->watchPortal_ = portal;
}
bool FcitxQtWatcher::watchPortal() const {
Q_D(const FcitxQtWatcher);
return d->watchPortal_;
}
QString FcitxQtWatcher::serviceName() const {
Q_D(const FcitxQtWatcher);
if (d->mainPresent_) {
return FCITX_MAIN_SERVICE_NAME;
}
if (d->portalPresent_) {
return FCITX_PORTAL_SERVICE_NAME;
}
return QString();
}
void FcitxQtWatcher::setAvailability(bool availability) {
Q_D(FcitxQtWatcher);
if (d->availability_ != availability) {
d->availability_ = availability;
Q_EMIT availabilityChanged(d->availability_);
}
}
void FcitxQtWatcher::watch() {
Q_D(FcitxQtWatcher);
if (d->watched_) {
return;
}
connect(&d->serviceWatcher_,
SIGNAL(serviceOwnerChanged(QString, QString, QString)), this,
SLOT(imChanged(QString, QString, QString)));
d->serviceWatcher_.addWatchedService(FCITX_MAIN_SERVICE_NAME);
if (d->watchPortal_) {
d->serviceWatcher_.addWatchedService(FCITX_PORTAL_SERVICE_NAME);
}
if (QDBusConnection::sessionBus().interface()->isServiceRegistered(
FCITX_MAIN_SERVICE_NAME)) {
d->mainPresent_ = true;
}
if (d->watchPortal_ &&
QDBusConnection::sessionBus().interface()->isServiceRegistered(
FCITX_PORTAL_SERVICE_NAME)) {
d->portalPresent_ = true;
}
updateAvailability();
d->watched_ = true;
}
void FcitxQtWatcher::unwatch() {
Q_D(FcitxQtWatcher);
if (!d->watched_) {
return;
}
disconnect(&d->serviceWatcher_,
SIGNAL(serviceOwnerChanged(QString, QString, QString)), this,
SLOT(imChanged(QString, QString, QString)));
d->mainPresent_ = false;
d->portalPresent_ = false;
d->watched_ = false;
updateAvailability();
}
bool FcitxQtWatcher::isWatching() const {
Q_D(const FcitxQtWatcher);
return d->watched_;
}
void FcitxQtWatcher::imChanged(const QString &service, const QString &,
const QString &newOwner) {
Q_D(FcitxQtWatcher);
if (service == FCITX_MAIN_SERVICE_NAME) {
if (!newOwner.isEmpty()) {
d->mainPresent_ = true;
} else {
d->mainPresent_ = false;
}
} else if (service == FCITX_PORTAL_SERVICE_NAME) {
if (!newOwner.isEmpty()) {
d->portalPresent_ = true;
} else {
d->portalPresent_ = false;
}
}
updateAvailability();
}
void FcitxQtWatcher::updateAvailability() {
Q_D(FcitxQtWatcher);
setAvailability(d->mainPresent_ || d->portalPresent_);
}
} // namespace fcitx

View File

@@ -0,0 +1,54 @@
/*
* SPDX-FileCopyrightText: 2012~2017 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#ifndef _DBUSADDONS_FCITXQTWATCHER_H_
#define _DBUSADDONS_FCITXQTWATCHER_H_
#include "fcitx5qt4dbusaddons_export.h"
#include <QDBusConnection>
#include <QObject>
namespace fcitx {
class FcitxQtWatcherPrivate;
class FCITX5QT4DBUSADDONS_EXPORT FcitxQtWatcher : public QObject {
Q_OBJECT
public:
explicit FcitxQtWatcher(QObject *parent = nullptr);
explicit FcitxQtWatcher(const QDBusConnection &connection,
QObject *parent = nullptr);
~FcitxQtWatcher();
void watch();
void unwatch();
void setConnection(const QDBusConnection &connection);
QDBusConnection connection() const;
void setWatchPortal(bool portal);
bool watchPortal() const;
bool isWatching() const;
bool availability() const;
QString serviceName() const;
Q_SIGNALS:
void availabilityChanged(bool);
private Q_SLOTS:
void imChanged(const QString &service, const QString &oldOwner,
const QString &newOwner);
private:
void setAvailability(bool availability);
void updateAvailability();
FcitxQtWatcherPrivate *const d_ptr;
Q_DECLARE_PRIVATE(FcitxQtWatcher);
};
} // namespace fcitx
#endif // _DBUSADDONS_FCITXQTWATCHER_H_

View File

@@ -0,0 +1,32 @@
/*
* SPDX-FileCopyrightText: 2012~2017 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#ifndef _DBUSADDONS_FCITXQTWATCHER_P_H_
#define _DBUSADDONS_FCITXQTWATCHER_P_H_
#include "fcitxqtwatcher.h"
#include <QDBusServiceWatcher>
#define FCITX_MAIN_SERVICE_NAME "org.fcitx.Fcitx5"
#define FCITX_PORTAL_SERVICE_NAME "org.freedesktop.portal.Fcitx"
namespace fcitx {
class FcitxQtWatcherPrivate {
public:
FcitxQtWatcherPrivate(FcitxQtWatcher *q) : serviceWatcher_(q) {}
QDBusServiceWatcher serviceWatcher_;
bool watchPortal_ = false;
bool availability_ = false;
bool mainPresent_ = false;
bool portalPresent_ = false;
bool watched_ = false;
};
} // namespace fcitx
#endif // _DBUSADDONS_FCITXQTWATCHER_P_H_

View File

@@ -0,0 +1,4 @@
#!/bin/sh
qdbusxml2cpp-qt4 -N -p fcitxqtinputcontextproxyimpl -c FcitxQtInputContextProxyImpl interfaces/org.fcitx.Fcitx.InputContext1.xml -i fcitxqtdbustypes.h -i fcitx5qt4dbusaddons_export.h
qdbusxml2cpp-qt4 -N -p fcitxqtinputmethodproxy -c FcitxQtInputMethodProxy interfaces/org.fcitx.Fcitx.InputMethod1.xml -i fcitxqtdbustypes.h -i fcitx5qt4dbusaddons_export.h

View File

@@ -0,0 +1 @@
../../../qt5/dbusaddons/interfaces/org.fcitx.Fcitx.InputContext1.xml

View File

@@ -0,0 +1 @@
../../../qt5/dbusaddons/interfaces/org.fcitx.Fcitx.InputMethod1.xml

View File

@@ -0,0 +1,4 @@
add_executable(fcitx5-qt4-immodule-probing main.cpp)
target_link_libraries(fcitx5-qt4-immodule-probing Qt4::QtGui)
install(TARGETS fcitx5-qt4-immodule-probing DESTINATION "${CMAKE_INSTALL_BINDIR}")

View File

@@ -0,0 +1,20 @@
/*
* SPDX-FileCopyrightText: 2023~2023 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
*/
#include <QApplication>
#include <QInputContext>
#include <iostream>
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
auto *inputContext = app.inputContext();
std::cout << "QT_IM_MODULE=";
if (inputContext) {
std::cout << inputContext->identifierName().toUtf8().constData();
}
std::cout << std::endl;
return 0;
}

View File

@@ -0,0 +1,39 @@
set(plugin_SRCS
qfcitxinputcontext.cpp
qtkey.cpp
main.cpp
)
if (BUILD_ONLY_PLUGIN AND BUILD_STATIC_PLUGIN)
set(plugin_SRCS ${plugin_SRCS} $<TARGET_OBJECTS:Fcitx5Qt4DBusAddons>)
endif()
add_library(qtim-fcitx5 ${PLUGIN_LIBRARY_TYPE} ${plugin_SRCS})
set_target_properties(qtim-fcitx5 PROPERTIES
AUTOMOC TRUE
)
target_include_directories(qtim-fcitx5 PRIVATE "${PROJECT_SOURCE_DIR}/common")
if (BUILD_ONLY_PLUGIN AND BUILD_STATIC_PLUGIN)
target_compile_definitions(qtim-fcitx5 PRIVATE "-DQT_STATICPLUGIN")
endif()
if (WITH_FCITX_PLUGIN_NAME)
target_compile_definitions(qtim-fcitx5 PRIVATE "-DFCITX5_QT_WITH_FCITX_NAME")
endif()
target_link_libraries(qtim-fcitx5
Qt4::QtCore
Qt4::QtGui
Qt4::QtDBus
Fcitx5Qt4::DBusAddons
XKBCommon::XKBCommon
)
if (ENABLE_X11)
target_link_libraries(qtim-fcitx5 X11Import)
target_compile_definitions(qtim-fcitx5 PRIVATE "-DENABLE_X11")
endif()
set(CMAKE_INSTALL_QT4PLUGINDIR ${QT_PLUGINS_DIR} CACHE PATH "Qt4 plugin dir")
install(TARGETS qtim-fcitx5 DESTINATION ${CMAKE_INSTALL_QT4PLUGINDIR}/inputmethods)

View File

@@ -0,0 +1,59 @@
/*
* SPDX-FileCopyrightText: 2012~2017 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#include "main.h"
namespace fcitx {
namespace {
bool isFcitx(const QString &key) {
return key.toLower() == "fcitx5" || key.toLower() == "fcitx";
}
} // namespace
QStringList QFcitxInputContextPlugin::keys() const {
#ifdef FCITX5_QT_WITH_FCITX_NAME
return QStringList() << "fcitx5"
<< "fcitx";
#else
return QStringList() << "fcitx5";
#endif
}
QInputContext *QFcitxInputContextPlugin::create(const QString &key) {
if (!isFcitx(key)) {
return nullptr;
}
return static_cast<QInputContext *>(new QFcitxInputContext());
}
QString QFcitxInputContextPlugin::description(const QString &key) {
if (!isFcitx(key)) {
return QString("");
}
return QString::fromUtf8("Qt immodule plugin for Fcitx 5");
}
QStringList QFcitxInputContextPlugin::languages(const QString &key) {
QStringList result;
if (!isFcitx(key)) {
result << "zh";
result << "ja";
result << "ko";
}
return result;
}
QString QFcitxInputContextPlugin::displayName(const QString &key) {
return key;
}
} // namespace fcitx
Q_EXPORT_PLUGIN2(QFcitxInputContextPlugin, fcitx::QFcitxInputContextPlugin)

View File

@@ -0,0 +1,33 @@
/*
* SPDX-FileCopyrightText: 2012~2017 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#ifndef MAIN_H
#define MAIN_H
#include <QInputContextPlugin>
#include <QStringList>
#include "qfcitxinputcontext.h"
namespace fcitx {
class QFcitxInputContextPlugin : public QInputContextPlugin {
Q_OBJECT
public:
QStringList keys() const override;
QStringList languages(const QString &key) override;
QString description(const QString &key) override;
QInputContext *create(const QString &key) override;
QString displayName(const QString &key) override;
};
} // namespace fcitx
#endif // MAIN_H

View File

@@ -0,0 +1,837 @@
/*
* SPDX-FileCopyrightText: 2012~2017 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#include <QApplication>
#include <QDBusConnection>
#include <QDateTime>
#include <QDebug>
#include <QKeyEvent>
#include <QPalette>
#include <QTextCharFormat>
#include <QTextCodec>
#include <QWidget>
#ifdef ENABLE_X11
#include <QX11Info>
#endif
#include <array>
#include <errno.h>
#include <signal.h>
#include <unistd.h>
#include "qtkey.h"
#include "fcitxflags.h"
#include "fcitxqtinputcontextproxy.h"
#include "fcitxqtwatcher.h"
#include "qfcitxinputcontext.h"
#ifdef ENABLE_X11
#include <X11/Xlib.h>
#endif
#include <memory>
#undef KeyPress
#undef KeyRelease
#undef FocusIn
#undef FocusOut
namespace fcitx {
#ifdef ENABLE_X11
void setFocusGroupForX11(const QByteArray &uuid) {
if (uuid.size() != 16) {
return;
}
Display *xdisplay = QX11Info::display();
if (!xdisplay) {
return;
}
Atom atom = XInternAtom(xdisplay, "_FCITX_SERVER", False);
if (!atom) {
return;
}
Window window = XGetSelectionOwner(xdisplay, atom);
if (!window) {
return;
}
XEvent ev;
memset(&ev, 0, sizeof(ev));
ev.xclient.type = ClientMessage;
ev.xclient.window = window;
ev.xclient.message_type = atom;
ev.xclient.format = 8;
memcpy(ev.xclient.data.b, uuid.constData(), 16);
XSendEvent(xdisplay, window, False, NoEventMask, &ev);
XSync(xdisplay, False);
}
#endif
static bool key_filtered = false;
static bool get_boolean_env(const char *name, bool defval) {
const char *value = getenv(name);
if (value == nullptr)
return defval;
if (strcmp(value, "") == 0 || strcmp(value, "0") == 0 ||
strcmp(value, "false") == 0 || strcmp(value, "False") == 0 ||
strcmp(value, "FALSE") == 0)
return false;
return true;
}
static inline const char *get_locale() {
const char *locale = getenv("LC_ALL");
if (!locale)
locale = getenv("LC_CTYPE");
if (!locale)
locale = getenv("LANG");
if (!locale)
locale = "C";
return locale;
}
struct xkb_context *_xkb_context_new_helper() {
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
if (context) {
xkb_context_set_log_level(context, XKB_LOG_LEVEL_CRITICAL);
}
return context;
}
QFcitxInputContext::QFcitxInputContext()
: watcher_(new FcitxQtWatcher(
QDBusConnection::connectToBus(QDBusConnection::SessionBus, "fcitx"),
this)),
cursorPos_(0), useSurroundingText_(false),
syncMode_(get_boolean_env("FCITX_QT_USE_SYNC", false)), destroy_(false),
xkbContext_(_xkb_context_new_helper()),
xkbComposeTable_(xkbContext_ ? xkb_compose_table_new_from_locale(
xkbContext_.data(), get_locale(),
XKB_COMPOSE_COMPILE_NO_FLAGS)
: 0),
xkbComposeState_(xkbComposeTable_
? xkb_compose_state_new(xkbComposeTable_.data(),
XKB_COMPOSE_STATE_NO_FLAGS)
: 0) {
registerFcitxQtDBusTypes();
watcher_->setWatchPortal(true);
watcher_->watch();
}
QFcitxInputContext::~QFcitxInputContext() {
destroy_ = true;
watcher_->unwatch();
cleanUp();
delete watcher_;
}
void QFcitxInputContext::cleanUp() {
icMap_.clear();
if (!destroy_) {
commitPreedit();
}
}
void QFcitxInputContext::mouseHandler(int cursorPosition, QMouseEvent *event) {
if (event->type() != QEvent::MouseButtonRelease) {
return;
}
unsigned int action;
if (event->button() == Qt::LeftButton) {
action = 0;
} else if (event->button() == Qt::RightButton) {
action = 1;
} else {
return;
}
if (FcitxQtInputContextProxy *proxy = validIC();
proxy->supportInvokeAction()) {
proxy->invokeAction(action, cursorPosition);
} else {
if (cursorPosition <= 0 || cursorPosition >= preedit_.length()) {
// qDebug() << action << cursorPosition;
reset();
}
}
}
void QFcitxInputContext::commitPreedit(QPointer<QWidget> input) {
if (!input)
return;
if (commitPreedit_.length() <= 0)
return;
QInputMethodEvent e;
e.setCommitString(commitPreedit_);
QCoreApplication::sendEvent(input, &e);
commitPreedit_.clear();
preeditList_.clear();
}
bool checkUtf8(const QByteArray &byteArray) {
QTextCodec::ConverterState state;
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
const QString text =
codec->toUnicode(byteArray.constData(), byteArray.size(), &state);
return state.invalidChars == 0;
}
void QFcitxInputContext::reset() {
commitPreedit();
if (FcitxQtInputContextProxy *proxy = validIC()) {
proxy->reset();
}
if (xkbComposeState_) {
xkb_compose_state_reset(xkbComposeState_.data());
}
}
void QFcitxInputContext::update() {
QWidget *window = qApp->focusWidget();
FcitxQtInputContextProxy *proxy = validICByWindow(window);
if (!proxy)
return;
FcitxQtICData &data = *static_cast<FcitxQtICData *>(
proxy->property("icData").value<void *>());
QWidget *input = qApp->focusWidget();
if (!input)
return;
cursorRectChanged();
if (true) {
Qt::InputMethodHints hints = input->inputMethodHints();
#define CHECK_HINTS(_HINTS, _CAPABILITY) \
if (hints & _HINTS) \
addCapability(data, FcitxCapabilityFlag_##_CAPABILITY); \
else \
removeCapability(data, FcitxCapabilityFlag_##_CAPABILITY);
CHECK_HINTS(Qt::ImhHiddenText, Password)
CHECK_HINTS(Qt::ImhNoAutoUppercase, NoAutoUpperCase)
CHECK_HINTS(Qt::ImhPreferNumbers, Number)
CHECK_HINTS(Qt::ImhPreferUppercase, Uppercase)
CHECK_HINTS(Qt::ImhPreferLowercase, Lowercase)
CHECK_HINTS(Qt::ImhNoPredictiveText, NoSpellCheck)
CHECK_HINTS(Qt::ImhDigitsOnly, Digit)
CHECK_HINTS(Qt::ImhFormattedNumbersOnly, Number)
CHECK_HINTS(Qt::ImhUppercaseOnly, Uppercase)
CHECK_HINTS(Qt::ImhLowercaseOnly, Lowercase)
CHECK_HINTS(Qt::ImhDialableCharactersOnly, Dialable)
CHECK_HINTS(Qt::ImhEmailCharactersOnly, Email)
CHECK_HINTS(Qt::ImhUrlCharactersOnly, Url)
}
bool setSurrounding = false;
do {
if (!useSurroundingText_)
break;
if ((data.capability & FcitxCapabilityFlag_Password) ||
(data.capability & FcitxCapabilityFlag_Sensitive))
break;
QVariant var = input->inputMethodQuery(Qt::ImSurroundingText);
QVariant var1 = input->inputMethodQuery(Qt::ImCursorPosition);
QVariant var2 = input->inputMethodQuery(Qt::ImAnchorPosition);
if (!var.isValid() || !var1.isValid())
break;
QString text = var.toString();
/* we don't want to waste too much memory here */
#define SURROUNDING_THRESHOLD 4096
if (text.length() < SURROUNDING_THRESHOLD) {
if (checkUtf8(text.toUtf8())) {
addCapability(data, FcitxCapabilityFlag_SurroundingText);
int cursor = var1.toInt();
int anchor;
if (var2.isValid()) {
anchor = var2.toInt();
} else {
anchor = cursor;
}
// adjust it to real character size
#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)
QVector<unsigned int> tempUCS4 = text.leftRef(cursor).toUcs4();
#else
QVector<unsigned int> tempUCS4 = text.left(cursor).toUcs4();
#endif
cursor = tempUCS4.size();
#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)
tempUCS4 = text.leftRef(anchor).toUcs4();
#else
tempUCS4 = text.left(anchor).toUcs4();
#endif
anchor = tempUCS4.size();
if (data.surroundingText != text) {
data.surroundingText = text;
proxy->setSurroundingText(text, cursor, anchor);
} else {
if (data.surroundingAnchor != anchor ||
data.surroundingCursor != cursor)
proxy->setSurroundingTextPosition(cursor, anchor);
}
data.surroundingCursor = cursor;
data.surroundingAnchor = anchor;
setSurrounding = true;
}
}
if (!setSurrounding) {
data.surroundingAnchor = -1;
data.surroundingCursor = -1;
data.surroundingText = QString();
removeCapability(data, FcitxCapabilityFlag_SurroundingText);
}
} while (0);
}
void QFcitxInputContext::setFocusWidget(QWidget *object) {
Q_UNUSED(object);
FcitxQtInputContextProxy *proxy = validICByWindow(lastWindow_);
if (proxy) {
proxy->focusOut();
}
QWidget *window = qApp->focusWidget();
lastWindow_ = window;
if (!window) {
return;
}
proxy = validICByWindow(window);
if (proxy) {
cursorRectChanged();
proxy->focusIn();
} else {
createICData(window);
}
QInputContext::setFocusWidget(object);
}
void QFcitxInputContext::widgetDestroyed(QWidget *w) {
QInputContext::widgetDestroyed(w);
icMap_.erase(w);
}
void QFcitxInputContext::windowDestroyed(QObject *object) {
/* access QWindow is not possible here, so we use our own map to do so */
icMap_.erase(reinterpret_cast<QWidget *>(object));
// qDebug() << "Window Destroyed and we destroy IC correctly, horray!";
}
void QFcitxInputContext::cursorRectChanged() {
QWidget *inputWindow = qApp->focusWidget();
if (!inputWindow)
return;
FcitxQtInputContextProxy *proxy = validICByWindow(inputWindow);
if (!proxy)
return;
FcitxQtICData &data = *static_cast<FcitxQtICData *>(
proxy->property("icData").value<void *>());
QRect r = inputWindow->inputMethodQuery(Qt::ImMicroFocus).toRect();
auto point = inputWindow->mapToGlobal(r.topLeft());
QRect newRect(point, r.size());
if (data.rect != newRect) {
data.rect = newRect;
proxy->setCursorRect(newRect.x(), newRect.y(), newRect.width(),
newRect.height());
}
}
void QFcitxInputContext::createInputContextFinished(const QByteArray &uuid) {
auto proxy = qobject_cast<FcitxQtInputContextProxy *>(sender());
if (!proxy) {
return;
}
auto w =
reinterpret_cast<QWidget *>(proxy->property("wid").value<void *>());
FcitxQtICData *data =
static_cast<FcitxQtICData *>(proxy->property("icData").value<void *>());
data->rect = QRect();
if (proxy->isValid()) {
QWidget *window = qApp->focusWidget();
#ifdef ENABLE_X11
setFocusGroupForX11(uuid);
#else
Q_UNUSED(uuid);
#endif
if (window && window == w) {
cursorRectChanged();
proxy->focusIn();
}
}
quint64 flag = 0;
flag |= FcitxCapabilityFlag_Preedit;
flag |= FcitxCapabilityFlag_FormattedPreedit;
flag |= FcitxCapabilityFlag_ClientUnfocusCommit;
flag |= FcitxCapabilityFlag_GetIMInfoOnFocus;
flag |= FcitxCapabilityFlag_KeyEventOrderFix;
flag |= FcitxCapabilityFlag_ReportKeyRepeat;
useSurroundingText_ =
get_boolean_env("FCITX_QT_ENABLE_SURROUNDING_TEXT", true);
if (useSurroundingText_)
flag |= FcitxCapabilityFlag_SurroundingText;
addCapability(*data, flag, true);
}
void QFcitxInputContext::updateCapability(const FcitxQtICData &data) {
if (!data.proxy || !data.proxy->isValid())
return;
QDBusPendingReply<void> result = data.proxy->setCapability(data.capability);
}
void QFcitxInputContext::commitString(const QString &str) {
cursorPos_ = 0;
preeditList_.clear();
commitPreedit_.clear();
QWidget *input = qApp->focusWidget();
if (!input)
return;
QInputMethodEvent event;
event.setCommitString(str);
QCoreApplication::sendEvent(input, &event);
}
void QFcitxInputContext::updateFormattedPreedit(
const FcitxQtFormattedPreeditList &preeditList, int cursorPos) {
QWidget *input = qApp->focusWidget();
if (!input)
return;
if (cursorPos == cursorPos_ && preeditList == preeditList_)
return;
preeditList_ = preeditList;
cursorPos_ = cursorPos;
QString str, commitStr;
int pos = 0;
QList<QInputMethodEvent::Attribute> attrList;
Q_FOREACH (const FcitxQtFormattedPreedit &preedit, preeditList) {
str += preedit.string();
if (!(preedit.format() & FcitxTextFormatFlag_DontCommit))
commitStr += preedit.string();
QTextCharFormat format;
if (preedit.format() & FcitxTextFormatFlag_Underline) {
format.setUnderlineStyle(QTextCharFormat::DashUnderline);
}
if (preedit.format() & FcitxTextFormatFlag_Strike) {
format.setFontStrikeOut(true);
}
if (preedit.format() & FcitxTextFormatFlag_Bold) {
format.setFontWeight(QFont::Bold);
}
if (preedit.format() & FcitxTextFormatFlag_Italic) {
format.setFontItalic(true);
}
if (preedit.format() & FcitxTextFormatFlag_HighLight) {
QBrush brush;
QPalette palette;
palette = QApplication::palette();
format.setBackground(QBrush(
QColor(palette.color(QPalette::Active, QPalette::Highlight))));
format.setForeground(QBrush(QColor(
palette.color(QPalette::Active, QPalette::HighlightedText))));
}
attrList.append(
QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, pos,
preedit.string().length(), format));
pos += preedit.string().length();
}
QByteArray array = str.toUtf8();
array.truncate(cursorPos);
cursorPos = QString::fromUtf8(array).length();
attrList.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor,
cursorPos, 1, 0));
preedit_ = str;
commitPreedit_ = commitStr;
QInputMethodEvent event(str, attrList);
QCoreApplication::sendEvent(input, &event);
update();
}
void QFcitxInputContext::deleteSurroundingText(int offset,
unsigned int _nchar) {
QWidget *input = qApp->focusWidget();
if (!input)
return;
QInputMethodEvent event;
FcitxQtInputContextProxy *proxy =
qobject_cast<FcitxQtInputContextProxy *>(sender());
if (!proxy) {
return;
}
FcitxQtICData *data =
static_cast<FcitxQtICData *>(proxy->property("icData").value<void *>());
QVector<unsigned int> ucsText = data->surroundingText.toUcs4();
int cursor = data->surroundingCursor;
// make nchar signed so we are safer
int nchar = _nchar;
// Qt's reconvert semantics is different from gtk's. It doesn't count the
// current
// selection. Discard selection from nchar.
if (data->surroundingAnchor < data->surroundingCursor) {
nchar -= data->surroundingCursor - data->surroundingAnchor;
offset += data->surroundingCursor - data->surroundingAnchor;
cursor = data->surroundingAnchor;
} else if (data->surroundingAnchor > data->surroundingCursor) {
nchar -= data->surroundingAnchor - data->surroundingCursor;
cursor = data->surroundingCursor;
}
// validates
if (nchar >= 0 && cursor + offset >= 0 &&
cursor + offset + nchar <= ucsText.size()) {
// order matters
QVector<unsigned int> replacedChars =
ucsText.mid(cursor + offset, nchar);
nchar = QString::fromUcs4(replacedChars.data(), replacedChars.size())
.size();
int start, len;
if (offset >= 0) {
start = cursor;
len = offset;
} else {
start = cursor + offset;
len = -offset;
}
QVector<unsigned int> prefixedChars = ucsText.mid(start, len);
offset = QString::fromUcs4(prefixedChars.data(), prefixedChars.size())
.size() *
(offset >= 0 ? 1 : -1);
event.setCommitString("", offset, nchar);
QCoreApplication::sendEvent(input, &event);
}
}
void QFcitxInputContext::forwardKey(unsigned int keyval, unsigned int state,
bool type) {
auto proxy = qobject_cast<FcitxQtInputContextProxy *>(sender());
if (!proxy) {
return;
}
FcitxQtICData &data = *static_cast<FcitxQtICData *>(
proxy->property("icData").value<void *>());
QWidget *input = qApp->focusWidget();
if (input != nullptr) {
key_filtered = true;
QKeyEvent *keyevent =
createKeyEvent(keyval, state, type, data.event.get());
QCoreApplication::sendEvent(input, keyevent);
delete keyevent;
key_filtered = false;
}
}
void QFcitxInputContext::serverSideFocusOut() {
if (lastWindow_ == qApp->focusWidget()) {
commitPreedit();
}
}
void QFcitxInputContext::createICData(QWidget *w) {
auto iter = icMap_.find(w);
if (iter == icMap_.end()) {
auto result =
icMap_.emplace(std::piecewise_construct, std::forward_as_tuple(w),
std::forward_as_tuple(watcher_));
iter = result.first;
auto &data = iter->second;
data.proxy->setDisplay("x11:");
data.proxy->setProperty("wid",
qVariantFromValue(static_cast<void *>(w)));
data.proxy->setProperty("icData",
qVariantFromValue(static_cast<void *>(&data)));
connect(data.proxy, SIGNAL(inputContextCreated(QByteArray)), this,
SLOT(createInputContextFinished(QByteArray)));
connect(data.proxy, SIGNAL(commitString(QString)), this,
SLOT(commitString(QString)));
connect(data.proxy,
SIGNAL(forwardKey(unsigned int, unsigned int, bool)), this,
SLOT(forwardKey(unsigned int, unsigned int, bool)));
connect(
data.proxy,
SIGNAL(updateFormattedPreedit(FcitxQtFormattedPreeditList, int)),
this,
SLOT(updateFormattedPreedit(FcitxQtFormattedPreeditList, int)));
connect(data.proxy, SIGNAL(deleteSurroundingText(int, uint)), this,
SLOT(deleteSurroundingText(int, uint)));
connect(data.proxy, SIGNAL(notifyFocusOut()), this,
SLOT(serverSideFocusOut()));
}
}
QKeyEvent *QFcitxInputContext::createKeyEvent(unsigned int keyval,
unsigned int state,
bool isRelease,
const QKeyEvent *event) {
QKeyEvent *newEvent = nullptr;
if (event && event->nativeVirtualKey() == keyval &&
event->nativeModifiers() == state &&
isRelease == (event->type() == QEvent::KeyRelease)) {
newEvent = new QKeyEvent(*event);
} else {
Qt::KeyboardModifiers qstate = Qt::NoModifier;
int count = 1;
if (state & FcitxKeyState_Alt) {
qstate |= Qt::AltModifier;
count++;
}
if (state & FcitxKeyState_Shift) {
qstate |= Qt::ShiftModifier;
count++;
}
if (state & FcitxKeyState_Ctrl) {
qstate |= Qt::ControlModifier;
count++;
}
auto unicode = xkb_keysym_to_utf32(keyval);
QString text;
if (unicode) {
text = QString::fromUcs4(&unicode, 1);
}
int key = keysymToQtKey(keyval, text);
newEvent = QKeyEvent::createExtendedKeyEvent(
isRelease ? (QEvent::KeyRelease) : (QEvent::KeyPress), key, qstate,
0, keyval, state, text, false, count);
}
return newEvent;
}
bool QFcitxInputContext::filterEvent(const QEvent *event) {
do {
if (event->type() != QEvent::KeyPress &&
event->type() != QEvent::KeyRelease) {
break;
}
const QKeyEvent *keyEvent = static_cast<const QKeyEvent *>(event);
quint32 keyval = keyEvent->nativeVirtualKey();
quint32 keycode = keyEvent->nativeScanCode();
quint32 state = keyEvent->nativeModifiers();
bool isRelease = keyEvent->type() == QEvent::KeyRelease;
if (key_filtered) {
break;
}
QWidget *input = qApp->focusWidget();
if (!input) {
break;
}
FcitxQtInputContextProxy *proxy = validICByWindow(input);
if (!proxy) {
if (filterEventFallback(keyval, keycode, state, isRelease)) {
return true;
} else {
break;
}
}
proxy->focusIn();
update();
auto stateToFcitx = state;
if (keyEvent->isAutoRepeat()) {
// KeyState::Repeat
stateToFcitx |= (1u << 31);
}
auto reply =
proxy->processKeyEvent(keyval, keycode, stateToFcitx, isRelease,
QDateTime::currentDateTime().toTime_t());
#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)
if (Q_UNLIKELY(syncMode_)) {
#else
if (syncMode_) {
#endif
reply.waitForFinished();
if (reply.isError() || !reply.value()) {
if (filterEventFallback(keyval, keycode, state, isRelease)) {
return true;
} else {
break;
}
} else {
update();
return true;
}
} else {
ProcessKeyWatcher *watcher = new ProcessKeyWatcher(
*keyEvent, qApp->focusWidget(), reply, proxy);
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher *)), this,
SLOT(processKeyEventFinished(QDBusPendingCallWatcher *)));
return true;
}
} while (0);
return QInputContext::filterEvent(event);
}
void QFcitxInputContext::processKeyEventFinished(QDBusPendingCallWatcher *w) {
ProcessKeyWatcher *watcher = static_cast<ProcessKeyWatcher *>(w);
QDBusPendingReply<bool> result(*watcher);
bool filtered = false;
QWidget *window = watcher->window();
// if window is already destroyed, we can only throw this event away.
if (!window) {
delete watcher;
return;
}
QKeyEvent &keyEvent = watcher->keyEvent();
// use same variable name as in QXcbKeyboard::handleKeyEvent
QEvent::Type type = keyEvent.type();
quint32 code = keyEvent.nativeScanCode();
quint32 sym = keyEvent.nativeVirtualKey();
quint32 state = keyEvent.nativeModifiers();
QString string = keyEvent.text();
if (result.isError() || !result.value()) {
filtered =
filterEventFallback(sym, code, state, type == QEvent::KeyRelease);
} else {
filtered = true;
}
if (!watcher->isError()) {
update();
}
if (!filtered) {
key_filtered = true;
QCoreApplication::sendEvent(window, &keyEvent);
key_filtered = false;
} else {
auto proxy =
qobject_cast<FcitxQtInputContextProxy *>(watcher->parent());
if (proxy) {
FcitxQtICData &data = *static_cast<FcitxQtICData *>(
proxy->property("icData").value<void *>());
data.event = std::make_unique<QKeyEvent>(keyEvent);
}
}
delete watcher;
}
bool QFcitxInputContext::filterEventFallback(unsigned int keyval,
unsigned int keycode,
unsigned int state,
bool isRelease) {
Q_UNUSED(keycode);
if (processCompose(keyval, state, isRelease)) {
return true;
}
return false;
}
FcitxQtInputContextProxy *QFcitxInputContext::validIC() {
if (icMap_.empty()) {
return nullptr;
}
QWidget *window = qApp->focusWidget();
return validICByWindow(window);
}
FcitxQtInputContextProxy *QFcitxInputContext::validICByWindow(QWidget *w) {
if (!w) {
return nullptr;
}
if (icMap_.empty()) {
return nullptr;
}
auto iter = icMap_.find(w);
if (iter == icMap_.end())
return nullptr;
auto &data = iter->second;
if (!data.proxy || !data.proxy->isValid()) {
return nullptr;
}
return data.proxy;
}
bool QFcitxInputContext::processCompose(unsigned int keyval, unsigned int state,
bool isRelease) {
Q_UNUSED(state);
if (!xkbComposeTable_ || isRelease)
return false;
struct xkb_compose_state *xkbComposeState = xkbComposeState_.data();
enum xkb_compose_feed_result result =
xkb_compose_state_feed(xkbComposeState, keyval);
if (result == XKB_COMPOSE_FEED_IGNORED) {
return false;
}
enum xkb_compose_status status =
xkb_compose_state_get_status(xkbComposeState);
if (status == XKB_COMPOSE_NOTHING) {
return 0;
} else if (status == XKB_COMPOSE_COMPOSED) {
std::array<char, 256> buffer;
int length = xkb_compose_state_get_utf8(xkbComposeState, buffer.data(),
buffer.size());
xkb_compose_state_reset(xkbComposeState);
if (length != 0) {
commitString(QString::fromUtf8(buffer.data(), length));
}
} else if (status == XKB_COMPOSE_CANCELLED) {
xkb_compose_state_reset(xkbComposeState);
}
return true;
}
QString QFcitxInputContext::identifierName() { return "fcitx5"; }
QString QFcitxInputContext::language() { return ""; }
} // namespace fcitx
// kate: indent-mode cstyle; space-indent on; indent-width 0;

View File

@@ -0,0 +1,173 @@
/*
* SPDX-FileCopyrightText: 2012~2017 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#ifndef QFCITXINPUTCONTEXT_H
#define QFCITXINPUTCONTEXT_H
#include "fcitxqtinputcontextproxy.h"
#include "fcitxqtwatcher.h"
#include <QApplication>
#include <QDBusConnection>
#include <QDBusServiceWatcher>
#include <QInputContext>
#include <QKeyEvent>
#include <QPointer>
#include <QRect>
#include <QWidget>
#include <memory>
#include <unordered_map>
#include <xkbcommon/xkbcommon-compose.h>
namespace fcitx {
class FcitxQtConnection;
struct FcitxQtICData {
FcitxQtICData(FcitxQtWatcher *watcher)
: proxy(new FcitxQtInputContextProxy(watcher, watcher)) {}
FcitxQtICData(const FcitxQtICData &that) = delete;
~FcitxQtICData() { delete proxy; }
quint64 capability = 0;
FcitxQtInputContextProxy *proxy;
QRect rect;
// Last key event forwarded.
std::unique_ptr<QKeyEvent> event;
QString surroundingText;
int surroundingAnchor = -1;
int surroundingCursor = -1;
};
class ProcessKeyWatcher : public QDBusPendingCallWatcher {
Q_OBJECT
public:
ProcessKeyWatcher(const QKeyEvent &event, QWidget *window,
const QDBusPendingCall &call, QObject *parent = 0)
: QDBusPendingCallWatcher(call, parent),
event_(QKeyEvent::createExtendedKeyEvent(
event.type(), event.key(), event.modifiers(),
event.nativeScanCode(), event.nativeVirtualKey(),
event.nativeModifiers(), event.text(), event.isAutoRepeat(),
event.count())),
window_(window) {}
virtual ~ProcessKeyWatcher() { delete event_; }
QKeyEvent &keyEvent() { return *event_; }
QWidget *window() { return window_.data(); }
private:
QKeyEvent *event_;
QPointer<QWidget> window_;
};
struct XkbContextDeleter {
static inline void cleanup(struct xkb_context *pointer) {
if (pointer)
xkb_context_unref(pointer);
}
};
struct XkbComposeTableDeleter {
static inline void cleanup(struct xkb_compose_table *pointer) {
if (pointer)
xkb_compose_table_unref(pointer);
}
};
struct XkbComposeStateDeleter {
static inline void cleanup(struct xkb_compose_state *pointer) {
if (pointer)
xkb_compose_state_unref(pointer);
}
};
class FcitxQtInputMethodProxy;
class QFcitxInputContext : public QInputContext {
Q_OBJECT
public:
QFcitxInputContext();
virtual ~QFcitxInputContext();
QString identifierName() override;
QString language() override;
void reset() override;
bool isComposing() const override { return false; };
void update() override;
void setFocusWidget(QWidget *w) override;
void widgetDestroyed(QWidget *w) override;
bool filterEvent(const QEvent *event) override;
void mouseHandler(int x, QMouseEvent *event) override;
public Q_SLOTS:
void cursorRectChanged();
void commitString(const QString &str);
void updateFormattedPreedit(const FcitxQtFormattedPreeditList &preeditList,
int cursorPos);
void deleteSurroundingText(int offset, unsigned int nchar);
void forwardKey(unsigned int keyval, unsigned int state, bool type);
void createInputContextFinished(const QByteArray &uuid);
void serverSideFocusOut();
void cleanUp();
void windowDestroyed(QObject *object);
private:
bool processCompose(unsigned int keyval, unsigned int state,
bool isRelaese);
QKeyEvent *createKeyEvent(unsigned int keyval, unsigned int state,
bool isRelaese, const QKeyEvent *event);
void addCapability(FcitxQtICData &data, quint64 capability,
bool forceUpdate = false) {
auto newcaps = data.capability | capability;
if (data.capability != newcaps || forceUpdate) {
data.capability = newcaps;
updateCapability(data);
}
}
void removeCapability(FcitxQtICData &data, quint64 capability,
bool forceUpdate = false) {
auto newcaps = data.capability & (~capability);
if (data.capability != newcaps || forceUpdate) {
data.capability = newcaps;
updateCapability(data);
}
}
void updateCapability(const FcitxQtICData &data);
void commitPreedit(QPointer<QWidget> input = qApp->focusWidget());
void createICData(QWidget *w);
FcitxQtInputContextProxy *validIC();
FcitxQtInputContextProxy *validICByWindow(QWidget *window);
bool filterEventFallback(unsigned int keyval, unsigned int keycode,
unsigned int state, bool isRelaese);
FcitxQtWatcher *watcher_;
QString preedit_;
QString commitPreedit_;
FcitxQtFormattedPreeditList preeditList_;
int cursorPos_;
bool useSurroundingText_;
bool syncMode_;
std::unordered_map<QWidget *, FcitxQtICData> icMap_;
QPointer<QWidget> lastWindow_;
bool destroy_;
QScopedPointer<struct xkb_context, XkbContextDeleter> xkbContext_;
QScopedPointer<struct xkb_compose_table, XkbComposeTableDeleter>
xkbComposeTable_;
QScopedPointer<struct xkb_compose_state, XkbComposeStateDeleter>
xkbComposeState_;
private Q_SLOTS:
void processKeyEventFinished(QDBusPendingCallWatcher *);
};
} // namespace fcitx
#endif // QFCITXINPUTCONTEXT_H

View File

@@ -0,0 +1 @@
../../qt5/platforminputcontext/qtkey.cpp

View File

@@ -0,0 +1 @@
../../qt5/platforminputcontext/qtkey.h

View File

@@ -0,0 +1,16 @@
if(NOT BUILD_ONLY_PLUGIN)
set(REQUIRED_QT5_VERSION 5.7.0)
endif()
find_package(Qt5 ${REQUIRED_QT5_VERSION} CONFIG REQUIRED Core DBus Widgets)
find_package(Qt5Gui ${REQUIRED_QT5_VERSION} REQUIRED Private)
add_subdirectory(dbusaddons)
add_subdirectory(platforminputcontext)
if(NOT BUILD_ONLY_PLUGIN)
add_subdirectory(guiwrapper)
add_subdirectory(widgetsaddons)
add_subdirectory(quickphrase-editor)
add_subdirectory(immodule-probing)
endif()

View File

@@ -0,0 +1,80 @@
ecm_setup_version(PROJECT VARIABLE_PREFIX FCITX5QT5DBUSADDONS
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/fcitx5qt5dbusaddons_version.h"
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/Fcitx5Qt5DBusAddonsConfigVersion.cmake"
SOVERSION 1)
# create a Config.cmake and a ConfigVersion.cmake file and install them
set(CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/Fcitx5Qt5DBusAddons")
configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/Fcitx5Qt5DBusAddonsConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/Fcitx5Qt5DBusAddonsConfig.cmake"
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
)
set(dbusaddons_SOURCES
fcitxqtwatcher.cpp
fcitxqtdbustypes.cpp
fcitxqtinputcontextproxy.cpp
fcitxqtinputcontextproxyimpl.cpp
fcitxqtinputmethodproxy.cpp
fcitxqtcontrollerproxy.cpp
)
set(dbusaddons_HEADERS
fcitxqtwatcher.h
fcitxqtdbustypes.h
fcitxqtinputcontextproxy.h
fcitxqtinputmethodproxy.h
fcitxqtcontrollerproxy.h
)
set(fcitxqtdbusaddons_INCLUDE_DIRS
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
)
add_library(Fcitx5Qt5DBusAddons ${LIBRARY_TYPE} ${dbusaddons_SOURCES})
generate_export_header(Fcitx5Qt5DBusAddons BASE_NAME Fcitx5Qt5DBusAddons)
add_library(Fcitx5Qt5::DBusAddons ALIAS Fcitx5Qt5DBusAddons)
target_include_directories(Fcitx5Qt5DBusAddons PUBLIC "$<BUILD_INTERFACE:${fcitxqtdbusaddons_INCLUDE_DIRS}>")
target_include_directories(Fcitx5Qt5DBusAddons INTERFACE "$<INSTALL_INTERFACE:${Fcitx5Qt5_INCLUDE_INSTALL_DIR}/Fcitx5Qt5DBusAddons>")
set_target_properties(Fcitx5Qt5DBusAddons
PROPERTIES VERSION ${FCITX5QT5DBUSADDONS_VERSION}
AUTOMOC TRUE
SOVERSION ${FCITX5QT5DBUSADDONS_SOVERSION}
POSITION_INDEPENDENT_CODE ON
EXPORT_NAME DBusAddons
)
target_link_libraries(
Fcitx5Qt5DBusAddons
PUBLIC
Qt5::Core
Qt5::DBus
)
if(BUILD_ONLY_PLUGIN)
set_target_properties(Fcitx5Qt5DBusAddons PROPERTIES
COMPILE_DEFINITIONS "FCITX5QT5DBUSADDONS_STATIC_DEFINE")
else()
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Fcitx5Qt5DBusAddonsConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/Fcitx5Qt5DBusAddonsConfigVersion.cmake"
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
COMPONENT Devel )
install(EXPORT Fcitx5Qt5DBusAddonsTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE Fcitx5Qt5DBusAddonsTargets.cmake NAMESPACE Fcitx5Qt5:: )
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/fcitx5qt5dbusaddons_version.h
DESTINATION ${Fcitx5Qt5_INCLUDE_INSTALL_DIR} COMPONENT Devel )
install(TARGETS Fcitx5Qt5DBusAddons EXPORT Fcitx5Qt5DBusAddonsTargets LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
install(FILES ${dbusaddons_HEADERS}
${CMAKE_CURRENT_BINARY_DIR}/fcitx5qt5dbusaddons_export.h
DESTINATION "${Fcitx5Qt5_INCLUDE_INSTALL_DIR}/Fcitx5Qt5DBusAddons")
endif()

View File

@@ -0,0 +1,8 @@
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
find_dependency(Qt5Core @REQUIRED_QT5_VERSION@)
find_dependency(Qt5DBus @REQUIRED_QT5_VERSION@)
include("${CMAKE_CURRENT_LIST_DIR}/Fcitx5Qt5DBusAddonsTargets.cmake")

View File

@@ -0,0 +1,31 @@
/*
* This file was generated by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp -N -p fcitxqtcontrollerproxy -c
* FcitxQtControllerProxy interfaces/org.fcitx.Fcitx.Controller1.xml -i
* fcitxqtdbustypes.h -i fcitx5qt5dbusaddons_export.h
*
* qdbusxml2cpp is Copyright (C) 2022 The Qt Company Ltd.
*
* This is an auto-generated file.
* This file may have been hand-edited. Look for HAND-EDIT comments
* before re-generating it.
*/
#include "fcitxqtcontrollerproxy.h"
namespace fcitx {
/*
* Implementation of interface class FcitxQtControllerProxy
*/
FcitxQtControllerProxy::FcitxQtControllerProxy(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
: QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
{
}
FcitxQtControllerProxy::~FcitxQtControllerProxy()
{
}
}

View File

@@ -0,0 +1,291 @@
/*
* This file was generated by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp -N -p fcitxqtcontrollerproxy -c
* FcitxQtControllerProxy interfaces/org.fcitx.Fcitx.Controller1.xml -i
* fcitxqtdbustypes.h -i fcitx5qt5dbusaddons_export.h
*
* qdbusxml2cpp is Copyright (C) 2022 The Qt Company Ltd.
*
* This is an auto-generated file.
* Do not edit! All changes made to it will be lost.
*/
#ifndef FCITXQTCONTROLLERPROXY_H
#define FCITXQTCONTROLLERPROXY_H
#include <QtCore/QObject>
#include <QtCore/QByteArray>
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QVariant>
#include <QtDBus/QtDBus>
#include "fcitxqtdbustypes.h"
#include "fcitx5qt5dbusaddons_export.h"
namespace fcitx {
/*
* Proxy class for interface org.fcitx.Fcitx.Controller1
*/
class FCITX5QT5DBUSADDONS_EXPORT FcitxQtControllerProxy: public QDBusAbstractInterface
{
Q_OBJECT
public:
static inline const char *staticInterfaceName()
{ return "org.fcitx.Fcitx.Controller1"; }
public:
FcitxQtControllerProxy(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = nullptr);
~FcitxQtControllerProxy();
public Q_SLOTS: // METHODS
inline QDBusPendingReply<> Activate()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("Activate"), argumentList);
}
inline QDBusPendingReply<> AddInputMethodGroup(const QString &in0)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(in0);
return asyncCallWithArgumentList(QStringLiteral("AddInputMethodGroup"), argumentList);
}
inline QDBusPendingReply<QString> AddonForIM(const QString &in0)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(in0);
return asyncCallWithArgumentList(QStringLiteral("AddonForIM"), argumentList);
}
inline QDBusPendingReply<FcitxQtInputMethodEntryList> AvailableInputMethods()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("AvailableInputMethods"), argumentList);
}
inline QDBusPendingReply<FcitxQtLayoutInfoList> AvailableKeyboardLayouts()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("AvailableKeyboardLayouts"), argumentList);
}
inline QDBusPendingReply<bool> CanRestart() {
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("CanRestart"),
argumentList);
}
inline QDBusPendingReply<bool> CheckUpdate()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("CheckUpdate"), argumentList);
}
inline QDBusPendingReply<> Configure()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("Configure"), argumentList);
}
inline QDBusPendingReply<> ConfigureAddon(const QString &in0)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(in0);
return asyncCallWithArgumentList(QStringLiteral("ConfigureAddon"), argumentList);
}
inline QDBusPendingReply<> ConfigureIM(const QString &in0)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(in0);
return asyncCallWithArgumentList(QStringLiteral("ConfigureIM"), argumentList);
}
inline QDBusPendingReply<QString> CurrentInputMethod()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("CurrentInputMethod"), argumentList);
}
inline QDBusPendingReply<QString> CurrentUI()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("CurrentUI"), argumentList);
}
inline QDBusPendingReply<> Exit()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("Exit"), argumentList);
}
inline QDBusPendingReply<QString, QString, QString, QVariantMap,
FcitxQtFullInputMethodEntryList>
FullInputMethodGroupInfo(const QString &in0) {
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(in0);
return asyncCallWithArgumentList(
QStringLiteral("FullInputMethodGroupInfo"), argumentList);
}
inline QDBusReply<QString> FullInputMethodGroupInfo(
const QString &in0, QString &defaultInputMethod, QString &defaultLayout,
QVariantMap &properties,
FcitxQtFullInputMethodEntryList &inputMethodEntryList) {
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(in0);
QDBusMessage reply = callWithArgumentList(
QDBus::Block, QStringLiteral("FullInputMethodGroupInfo"),
argumentList);
if (reply.type() == QDBusMessage::ReplyMessage &&
reply.arguments().count() == 5) {
defaultInputMethod = qdbus_cast<QString>(reply.arguments().at(1));
defaultLayout = qdbus_cast<QString>(reply.arguments().at(2));
properties = qdbus_cast<QVariantMap>(reply.arguments().at(3));
inputMethodEntryList = qdbus_cast<FcitxQtFullInputMethodEntryList>(
reply.arguments().at(4));
}
return reply;
}
inline QDBusPendingReply<FcitxQtAddonInfoList> GetAddons()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("GetAddons"), argumentList);
}
inline QDBusPendingReply<FcitxQtAddonInfoV2List> GetAddonsV2()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("GetAddonsV2"), argumentList);
}
inline QDBusPendingReply<QDBusVariant, FcitxQtConfigTypeList> GetConfig(const QString &in0)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(in0);
return asyncCallWithArgumentList(QStringLiteral("GetConfig"), argumentList);
}
inline QDBusReply<QDBusVariant> GetConfig(const QString &in0, FcitxQtConfigTypeList &out1)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(in0);
QDBusMessage reply = callWithArgumentList(QDBus::Block, QStringLiteral("GetConfig"), argumentList);
if (reply.type() == QDBusMessage::ReplyMessage && reply.arguments().count() == 2) {
out1 = qdbus_cast<FcitxQtConfigTypeList>(reply.arguments().at(1));
}
return reply;
}
inline QDBusPendingReply<QString, FcitxQtStringKeyValueList> InputMethodGroupInfo(const QString &in0)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(in0);
return asyncCallWithArgumentList(QStringLiteral("InputMethodGroupInfo"), argumentList);
}
inline QDBusReply<QString> InputMethodGroupInfo(const QString &in0, FcitxQtStringKeyValueList &items)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(in0);
QDBusMessage reply = callWithArgumentList(QDBus::Block, QStringLiteral("InputMethodGroupInfo"), argumentList);
if (reply.type() == QDBusMessage::ReplyMessage && reply.arguments().count() == 2) {
items = qdbus_cast<FcitxQtStringKeyValueList>(reply.arguments().at(1));
}
return reply;
}
inline QDBusPendingReply<QStringList> InputMethodGroups()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("InputMethodGroups"), argumentList);
}
inline QDBusPendingReply<> Refresh()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("Refresh"), argumentList);
}
inline QDBusPendingReply<> ReloadAddonConfig(const QString &in0)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(in0);
return asyncCallWithArgumentList(QStringLiteral("ReloadAddonConfig"), argumentList);
}
inline QDBusPendingReply<> ReloadConfig()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("ReloadConfig"), argumentList);
}
inline QDBusPendingReply<> RemoveInputMethodGroup(const QString &in0)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(in0);
return asyncCallWithArgumentList(QStringLiteral("RemoveInputMethodGroup"), argumentList);
}
inline QDBusPendingReply<> ResetIMList()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("ResetIMList"), argumentList);
}
inline QDBusPendingReply<> Restart()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("Restart"), argumentList);
}
inline QDBusPendingReply<> SetAddonsState(FcitxQtAddonStateList in0)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(in0);
return asyncCallWithArgumentList(QStringLiteral("SetAddonsState"), argumentList);
}
inline QDBusPendingReply<> SetConfig(const QString &in0, const QDBusVariant &in1)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(in0) << QVariant::fromValue(in1);
return asyncCallWithArgumentList(QStringLiteral("SetConfig"), argumentList);
}
inline QDBusPendingReply<> SetCurrentIM(const QString &in0)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(in0);
return asyncCallWithArgumentList(QStringLiteral("SetCurrentIM"), argumentList);
}
inline QDBusPendingReply<> SetInputMethodGroupInfo(const QString &name, const QString &layout, FcitxQtStringKeyValueList entries)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(name) << QVariant::fromValue(layout) << QVariant::fromValue(entries);
return asyncCallWithArgumentList(QStringLiteral("SetInputMethodGroupInfo"), argumentList);
}
inline QDBusPendingReply<int> State()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("State"), argumentList);
}
inline QDBusPendingReply<> Toggle()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("Toggle"), argumentList);
}
Q_SIGNALS: // SIGNALS
void InputMethodGroupsChanged();
};
}
#endif

View File

@@ -0,0 +1,339 @@
/*
* SPDX-FileCopyrightText: 2012~2017 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#include <QDBusMetaType>
#include "fcitxqtdbustypes.h"
namespace fcitx {
#define FCITX5_QT_DEFINE_DBUS_TYPE(TYPE) \
qRegisterMetaType<TYPE>(#TYPE); \
qDBusRegisterMetaType<TYPE>(); \
qRegisterMetaType<TYPE##List>(#TYPE "List"); \
qDBusRegisterMetaType<TYPE##List>();
void registerFcitxQtDBusTypes() {
FCITX5_QT_DEFINE_DBUS_TYPE(FcitxQtFormattedPreedit);
FCITX5_QT_DEFINE_DBUS_TYPE(FcitxQtStringKeyValue);
FCITX5_QT_DEFINE_DBUS_TYPE(FcitxQtInputMethodEntry);
FCITX5_QT_DEFINE_DBUS_TYPE(FcitxQtFullInputMethodEntry);
FCITX5_QT_DEFINE_DBUS_TYPE(FcitxQtLayoutInfo);
FCITX5_QT_DEFINE_DBUS_TYPE(FcitxQtVariantInfo);
FCITX5_QT_DEFINE_DBUS_TYPE(FcitxQtConfigOption);
FCITX5_QT_DEFINE_DBUS_TYPE(FcitxQtConfigType);
FCITX5_QT_DEFINE_DBUS_TYPE(FcitxQtAddonInfo);
FCITX5_QT_DEFINE_DBUS_TYPE(FcitxQtAddonState);
FCITX5_QT_DEFINE_DBUS_TYPE(FcitxQtAddonInfoV2);
}
bool FcitxQtFormattedPreedit::operator==(
const FcitxQtFormattedPreedit &preedit) const {
return (preedit.format_ == format_) && (preedit.string_ == string_);
}
QDBusArgument &operator<<(QDBusArgument &argument,
const FcitxQtFormattedPreedit &preedit) {
argument.beginStructure();
argument << preedit.string();
argument << preedit.format();
argument.endStructure();
return argument;
}
const QDBusArgument &operator>>(const QDBusArgument &argument,
FcitxQtFormattedPreedit &preedit) {
QString str;
qint32 format;
argument.beginStructure();
argument >> str >> format;
argument.endStructure();
preedit.setString(str);
preedit.setFormat(format);
return argument;
}
QDBusArgument &operator<<(QDBusArgument &argument,
const FcitxQtStringKeyValue &arg) {
argument.beginStructure();
argument << arg.key();
argument << arg.value();
argument.endStructure();
return argument;
}
const QDBusArgument &operator>>(const QDBusArgument &argument,
FcitxQtStringKeyValue &arg) {
QString key, value;
argument.beginStructure();
argument >> key >> value;
argument.endStructure();
arg.setKey(key);
arg.setValue(value);
return argument;
}
QDBusArgument &operator<<(QDBusArgument &argument,
const FcitxQtInputMethodEntry &arg) {
argument.beginStructure();
argument << arg.uniqueName();
argument << arg.name();
argument << arg.nativeName();
argument << arg.icon();
argument << arg.label();
argument << arg.languageCode();
argument << arg.configurable();
argument.endStructure();
return argument;
}
const QDBusArgument &operator>>(const QDBusArgument &argument,
FcitxQtInputMethodEntry &arg) {
QString uniqueName, name, nativeName, icon, label, languageCode;
bool configurable;
argument.beginStructure();
argument >> uniqueName >> name >> nativeName >> icon >> label >>
languageCode >> configurable;
argument.endStructure();
arg.setUniqueName(uniqueName);
arg.setName(name);
arg.setNativeName(nativeName);
arg.setIcon(icon);
arg.setLabel(label);
arg.setLanguageCode(languageCode);
arg.setConfigurable(configurable);
return argument;
}
QDBusArgument &operator<<(QDBusArgument &argument,
const FcitxQtFullInputMethodEntry &arg) {
argument.beginStructure();
argument << arg.uniqueName();
argument << arg.name();
argument << arg.nativeName();
argument << arg.icon();
argument << arg.label();
argument << arg.languageCode();
argument << arg.addon();
argument << arg.configurable();
argument << arg.layout();
argument << arg.properties();
argument.endStructure();
return argument;
}
const QDBusArgument &operator>>(const QDBusArgument &argument,
FcitxQtFullInputMethodEntry &arg) {
QString uniqueName, name, nativeName, icon, label, languageCode, addon,
layout;
bool configurable;
QVariantMap properties;
argument.beginStructure();
argument >> uniqueName >> name >> nativeName >> icon >> label >>
languageCode >> addon >> configurable >> layout >> properties;
argument.endStructure();
arg.setUniqueName(uniqueName);
arg.setName(name);
arg.setNativeName(nativeName);
arg.setIcon(icon);
arg.setLabel(label);
arg.setLanguageCode(languageCode);
arg.setAddon(addon);
arg.setConfigurable(configurable);
arg.setLayout(layout);
arg.setProperties(properties);
return argument;
}
QDBusArgument &operator<<(QDBusArgument &argument,
const FcitxQtVariantInfo &arg) {
argument.beginStructure();
argument << arg.variant();
argument << arg.description();
argument << arg.languages();
argument.endStructure();
return argument;
}
const QDBusArgument &operator>>(const QDBusArgument &argument,
FcitxQtVariantInfo &arg) {
QString variant, description;
QStringList languages;
argument.beginStructure();
argument >> variant >> description >> languages;
argument.endStructure();
arg.setVariant(variant);
arg.setDescription(description);
arg.setLanguages(languages);
return argument;
}
QDBusArgument &operator<<(QDBusArgument &argument,
const FcitxQtLayoutInfo &arg) {
argument.beginStructure();
argument << arg.layout();
argument << arg.description();
argument << arg.languages();
argument << arg.variants();
argument.endStructure();
return argument;
}
const QDBusArgument &operator>>(const QDBusArgument &argument,
FcitxQtLayoutInfo &arg) {
QString layout, description;
QStringList languages;
FcitxQtVariantInfoList variants;
argument.beginStructure();
argument >> layout >> description >> languages >> variants;
argument.endStructure();
arg.setLayout(layout);
arg.setDescription(description);
arg.setLanguages(languages);
arg.setVariants(variants);
return argument;
}
QDBusArgument &operator<<(QDBusArgument &argument,
const FcitxQtConfigOption &arg) {
argument.beginStructure();
argument << arg.name();
argument << arg.type();
argument << arg.description();
argument << arg.defaultValue();
argument << arg.properties();
argument.endStructure();
return argument;
}
const QDBusArgument &operator>>(const QDBusArgument &argument,
FcitxQtConfigOption &arg) {
QString name, description, type;
QDBusVariant defaultValue;
QVariantMap properties;
argument.beginStructure();
argument >> name >> type >> description >> defaultValue >> properties;
argument.endStructure();
arg.setName(name);
arg.setType(type);
arg.setDescription(description);
arg.setDefaultValue(defaultValue);
arg.setProperties(properties);
return argument;
}
QDBusArgument &operator<<(QDBusArgument &argument,
const FcitxQtConfigType &arg) {
argument.beginStructure();
argument << arg.name();
argument << arg.options();
argument.endStructure();
return argument;
}
const QDBusArgument &operator>>(const QDBusArgument &argument,
FcitxQtConfigType &arg) {
QString name;
FcitxQtConfigOptionList options;
argument.beginStructure();
argument >> name >> options;
argument.endStructure();
arg.setName(name);
arg.setOptions(options);
return argument;
}
QDBusArgument &operator<<(QDBusArgument &argument,
const FcitxQtAddonInfo &arg) {
argument.beginStructure();
argument << arg.uniqueName();
argument << arg.name();
argument << arg.comment();
argument << arg.category();
argument << arg.configurable();
argument << arg.enabled();
argument.endStructure();
return argument;
}
const QDBusArgument &operator>>(const QDBusArgument &argument,
FcitxQtAddonInfo &arg) {
QString uniqueName, name, comment;
int category;
bool configurable, enabled;
argument.beginStructure();
argument >> uniqueName >> name >> comment >> category >> configurable >>
enabled;
argument.endStructure();
arg.setUniqueName(uniqueName);
arg.setName(name);
arg.setComment(comment);
arg.setCategory(category);
arg.setConfigurable(configurable);
arg.setEnabled(enabled);
return argument;
}
QDBusArgument &operator<<(QDBusArgument &argument,
const FcitxQtAddonInfoV2 &arg) {
argument.beginStructure();
argument << arg.uniqueName();
argument << arg.name();
argument << arg.comment();
argument << arg.category();
argument << arg.configurable();
argument << arg.enabled();
argument << arg.onDemand();
argument << arg.dependencies();
argument << arg.optionalDependencies();
argument.endStructure();
return argument;
}
const QDBusArgument &operator>>(const QDBusArgument &argument,
FcitxQtAddonInfoV2 &arg) {
QString uniqueName, name, comment;
int category;
bool configurable, enabled, onDemand;
QStringList dependencies, optionalDependencies;
argument.beginStructure();
argument >> uniqueName >> name >> comment >> category >> configurable >>
enabled >> onDemand >> dependencies >> optionalDependencies;
argument.endStructure();
arg.setUniqueName(uniqueName);
arg.setName(name);
arg.setComment(comment);
arg.setCategory(category);
arg.setConfigurable(configurable);
arg.setEnabled(enabled);
arg.setOnDemand(onDemand);
arg.setDependencies(dependencies);
arg.setOptionalDependencies(optionalDependencies);
return argument;
}
QDBusArgument &operator<<(QDBusArgument &argument,
const FcitxQtAddonState &arg) {
argument.beginStructure();
argument << arg.uniqueName();
argument << arg.enabled();
argument.endStructure();
return argument;
}
const QDBusArgument &operator>>(const QDBusArgument &argument,
FcitxQtAddonState &arg) {
QString uniqueName;
bool enabled;
argument.beginStructure();
argument >> uniqueName >> enabled;
argument.endStructure();
arg.setUniqueName(uniqueName);
arg.setEnabled(enabled);
return argument;
}
} // namespace fcitx

View File

@@ -0,0 +1,171 @@
/*
* SPDX-FileCopyrightText: 2012~2017 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#ifndef _DBUSADDONS_FCITXQTDBUSTYPES_H_
#define _DBUSADDONS_FCITXQTDBUSTYPES_H_
#include "fcitx5qt5dbusaddons_export.h"
#include <QDBusArgument>
#include <type_traits>
namespace fcitx {
FCITX5QT5DBUSADDONS_EXPORT void registerFcitxQtDBusTypes();
#define FCITX5_QT_BEGIN_DECLARE_DBUS_TYPE(TYPE) \
class FCITX5QT5DBUSADDONS_EXPORT TYPE { \
public:
#define FCITX5_QT_DECLARE_FIELD(TYPE, GETTER, SETTER) \
public: \
std::conditional_t<std::is_class<TYPE>::value, const TYPE &, TYPE> \
GETTER() const { \
return GETTER##_; \
} \
void SETTER( \
std::conditional_t<std::is_class<TYPE>::value, const TYPE &, TYPE> \
value) { \
GETTER##_ = value; \
} \
\
private: \
TYPE GETTER##_ = TYPE();
#define FCITX5_QT_END_DECLARE_DBUS_TYPE(TYPE) \
} \
; \
typedef QList<TYPE> TYPE##List; \
FCITX5QT5DBUSADDONS_EXPORT QDBusArgument &operator<<( \
QDBusArgument &argument, const TYPE &value); \
FCITX5QT5DBUSADDONS_EXPORT const QDBusArgument &operator>>( \
const QDBusArgument &argument, TYPE &value);
FCITX5_QT_BEGIN_DECLARE_DBUS_TYPE(FcitxQtFormattedPreedit);
FCITX5_QT_DECLARE_FIELD(QString, string, setString);
FCITX5_QT_DECLARE_FIELD(qint32, format, setFormat);
public:
bool operator==(const FcitxQtFormattedPreedit &preedit) const;
FCITX5_QT_END_DECLARE_DBUS_TYPE(FcitxQtFormattedPreedit);
FCITX5_QT_BEGIN_DECLARE_DBUS_TYPE(FcitxQtStringKeyValue);
FCITX5_QT_DECLARE_FIELD(QString, key, setKey);
FCITX5_QT_DECLARE_FIELD(QString, value, setValue);
FCITX5_QT_END_DECLARE_DBUS_TYPE(FcitxQtStringKeyValue);
FCITX5_QT_BEGIN_DECLARE_DBUS_TYPE(FcitxQtInputMethodEntry);
FCITX5_QT_DECLARE_FIELD(QString, uniqueName, setUniqueName);
FCITX5_QT_DECLARE_FIELD(QString, name, setName);
FCITX5_QT_DECLARE_FIELD(QString, nativeName, setNativeName);
FCITX5_QT_DECLARE_FIELD(QString, icon, setIcon);
FCITX5_QT_DECLARE_FIELD(QString, label, setLabel);
FCITX5_QT_DECLARE_FIELD(QString, languageCode, setLanguageCode);
FCITX5_QT_DECLARE_FIELD(bool, configurable, setConfigurable);
FCITX5_QT_END_DECLARE_DBUS_TYPE(FcitxQtInputMethodEntry);
FCITX5_QT_BEGIN_DECLARE_DBUS_TYPE(FcitxQtFullInputMethodEntry);
FCITX5_QT_DECLARE_FIELD(QString, uniqueName, setUniqueName);
FCITX5_QT_DECLARE_FIELD(QString, name, setName);
FCITX5_QT_DECLARE_FIELD(QString, nativeName, setNativeName);
FCITX5_QT_DECLARE_FIELD(QString, icon, setIcon);
FCITX5_QT_DECLARE_FIELD(QString, label, setLabel);
FCITX5_QT_DECLARE_FIELD(QString, languageCode, setLanguageCode);
FCITX5_QT_DECLARE_FIELD(QString, addon, setAddon);
FCITX5_QT_DECLARE_FIELD(bool, configurable, setConfigurable);
FCITX5_QT_DECLARE_FIELD(QString, layout, setLayout);
FCITX5_QT_DECLARE_FIELD(QVariantMap, properties, setProperties);
FCITX5_QT_END_DECLARE_DBUS_TYPE(FcitxQtFullInputMethodEntry);
FCITX5_QT_BEGIN_DECLARE_DBUS_TYPE(FcitxQtVariantInfo);
FCITX5_QT_DECLARE_FIELD(QString, variant, setVariant);
FCITX5_QT_DECLARE_FIELD(QString, description, setDescription);
FCITX5_QT_DECLARE_FIELD(QStringList, languages, setLanguages);
FCITX5_QT_END_DECLARE_DBUS_TYPE(FcitxQtVariantInfo);
FCITX5_QT_BEGIN_DECLARE_DBUS_TYPE(FcitxQtLayoutInfo);
FCITX5_QT_DECLARE_FIELD(QString, layout, setLayout);
FCITX5_QT_DECLARE_FIELD(QString, description, setDescription);
FCITX5_QT_DECLARE_FIELD(QStringList, languages, setLanguages);
FCITX5_QT_DECLARE_FIELD(FcitxQtVariantInfoList, variants, setVariants);
FCITX5_QT_END_DECLARE_DBUS_TYPE(FcitxQtLayoutInfo);
FCITX5_QT_BEGIN_DECLARE_DBUS_TYPE(FcitxQtConfigOption);
FCITX5_QT_DECLARE_FIELD(QString, name, setName);
FCITX5_QT_DECLARE_FIELD(QString, type, setType);
FCITX5_QT_DECLARE_FIELD(QString, description, setDescription);
FCITX5_QT_DECLARE_FIELD(QDBusVariant, defaultValue, setDefaultValue);
FCITX5_QT_DECLARE_FIELD(QVariantMap, properties, setProperties);
FCITX5_QT_END_DECLARE_DBUS_TYPE(FcitxQtConfigOption);
FCITX5_QT_BEGIN_DECLARE_DBUS_TYPE(FcitxQtConfigType);
FCITX5_QT_DECLARE_FIELD(QString, name, setName);
FCITX5_QT_DECLARE_FIELD(FcitxQtConfigOptionList, options, setOptions);
FCITX5_QT_END_DECLARE_DBUS_TYPE(FcitxQtConfigType);
FCITX5_QT_BEGIN_DECLARE_DBUS_TYPE(FcitxQtAddonInfo);
FCITX5_QT_DECLARE_FIELD(QString, uniqueName, setUniqueName);
FCITX5_QT_DECLARE_FIELD(QString, name, setName);
FCITX5_QT_DECLARE_FIELD(QString, comment, setComment);
FCITX5_QT_DECLARE_FIELD(int, category, setCategory);
FCITX5_QT_DECLARE_FIELD(bool, configurable, setConfigurable);
FCITX5_QT_DECLARE_FIELD(bool, enabled, setEnabled);
FCITX5_QT_END_DECLARE_DBUS_TYPE(FcitxQtAddonInfo);
FCITX5_QT_BEGIN_DECLARE_DBUS_TYPE(FcitxQtAddonInfoV2);
FCITX5_QT_DECLARE_FIELD(QString, uniqueName, setUniqueName);
FCITX5_QT_DECLARE_FIELD(QString, name, setName);
FCITX5_QT_DECLARE_FIELD(QString, comment, setComment);
FCITX5_QT_DECLARE_FIELD(int, category, setCategory);
FCITX5_QT_DECLARE_FIELD(bool, configurable, setConfigurable);
FCITX5_QT_DECLARE_FIELD(bool, enabled, setEnabled);
FCITX5_QT_DECLARE_FIELD(bool, onDemand, setOnDemand);
FCITX5_QT_DECLARE_FIELD(QStringList, dependencies, setDependencies);
FCITX5_QT_DECLARE_FIELD(QStringList, optionalDependencies,
setOptionalDependencies);
FCITX5_QT_END_DECLARE_DBUS_TYPE(FcitxQtAddonInfoV2);
FCITX5_QT_BEGIN_DECLARE_DBUS_TYPE(FcitxQtAddonState);
FCITX5_QT_DECLARE_FIELD(QString, uniqueName, setUniqueName);
FCITX5_QT_DECLARE_FIELD(bool, enabled, setEnabled);
FCITX5_QT_END_DECLARE_DBUS_TYPE(FcitxQtAddonState);
} // namespace fcitx
Q_DECLARE_METATYPE(fcitx::FcitxQtFormattedPreedit)
Q_DECLARE_METATYPE(fcitx::FcitxQtFormattedPreeditList)
Q_DECLARE_METATYPE(fcitx::FcitxQtStringKeyValue)
Q_DECLARE_METATYPE(fcitx::FcitxQtStringKeyValueList)
Q_DECLARE_METATYPE(fcitx::FcitxQtInputMethodEntry)
Q_DECLARE_METATYPE(fcitx::FcitxQtInputMethodEntryList)
Q_DECLARE_METATYPE(fcitx::FcitxQtFullInputMethodEntry)
Q_DECLARE_METATYPE(fcitx::FcitxQtFullInputMethodEntryList)
Q_DECLARE_METATYPE(fcitx::FcitxQtVariantInfo)
Q_DECLARE_METATYPE(fcitx::FcitxQtVariantInfoList)
Q_DECLARE_METATYPE(fcitx::FcitxQtLayoutInfo)
Q_DECLARE_METATYPE(fcitx::FcitxQtLayoutInfoList)
Q_DECLARE_METATYPE(fcitx::FcitxQtConfigOption)
Q_DECLARE_METATYPE(fcitx::FcitxQtConfigOptionList)
Q_DECLARE_METATYPE(fcitx::FcitxQtConfigType)
Q_DECLARE_METATYPE(fcitx::FcitxQtConfigTypeList)
Q_DECLARE_METATYPE(fcitx::FcitxQtAddonInfo)
Q_DECLARE_METATYPE(fcitx::FcitxQtAddonInfoList)
Q_DECLARE_METATYPE(fcitx::FcitxQtAddonInfoV2)
Q_DECLARE_METATYPE(fcitx::FcitxQtAddonInfoV2List)
Q_DECLARE_METATYPE(fcitx::FcitxQtAddonState)
Q_DECLARE_METATYPE(fcitx::FcitxQtAddonStateList)
#endif // _DBUSADDONS_FCITXQTDBUSTYPES_H_

View File

@@ -0,0 +1,134 @@
/*
* SPDX-FileCopyrightText: 2012~2017 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#include "fcitxqtinputcontextproxy_p.h"
namespace fcitx {
FcitxQtInputContextProxy::FcitxQtInputContextProxy(FcitxQtWatcher *watcher,
QObject *parent)
: QObject(parent),
d_ptr(new FcitxQtInputContextProxyPrivate(watcher, this)) {}
FcitxQtInputContextProxy::~FcitxQtInputContextProxy() { delete d_ptr; }
void FcitxQtInputContextProxy::setDisplay(const QString &display) {
Q_D(FcitxQtInputContextProxy);
d->display_ = display;
}
const QString &FcitxQtInputContextProxy::display() const {
Q_D(const FcitxQtInputContextProxy);
return d->display_;
}
bool FcitxQtInputContextProxy::isValid() const {
Q_D(const FcitxQtInputContextProxy);
return d->isValid();
}
QDBusPendingReply<> FcitxQtInputContextProxy::focusIn() {
Q_D(FcitxQtInputContextProxy);
return d->icproxy_->FocusIn();
}
QDBusPendingReply<> FcitxQtInputContextProxy::focusOut() {
Q_D(FcitxQtInputContextProxy);
return d->icproxy_->FocusOut();
}
QDBusPendingReply<> FcitxQtInputContextProxy::hideVirtualKeyboard() {
Q_D(FcitxQtInputContextProxy);
return d->icproxy_->HideVirtualKeyboard();
}
QDBusPendingReply<bool> FcitxQtInputContextProxy::processKeyEvent(
unsigned int keyval, unsigned int keycode, unsigned int state, bool type,
unsigned int time) {
Q_D(FcitxQtInputContextProxy);
return d->icproxy_->ProcessKeyEvent(keyval, keycode, state, type, time);
}
QDBusPendingReply<> FcitxQtInputContextProxy::reset() {
Q_D(FcitxQtInputContextProxy);
return d->icproxy_->Reset();
}
QDBusPendingReply<>
FcitxQtInputContextProxy::setSupportedCapability(qulonglong caps) {
Q_D(FcitxQtInputContextProxy);
return d->icproxy_->SetSupportedCapability(caps);
}
QDBusPendingReply<> FcitxQtInputContextProxy::setCapability(qulonglong caps) {
Q_D(FcitxQtInputContextProxy);
return d->icproxy_->SetCapability(caps);
}
QDBusPendingReply<> FcitxQtInputContextProxy::setCursorRect(int x, int y, int w,
int h) {
Q_D(FcitxQtInputContextProxy);
return d->icproxy_->SetCursorRect(x, y, w, h);
}
QDBusPendingReply<> FcitxQtInputContextProxy::setCursorRectV2(int x, int y,
int w, int h,
double scale) {
Q_D(FcitxQtInputContextProxy);
return d->icproxy_->SetCursorRectV2(x, y, w, h, scale);
}
QDBusPendingReply<> FcitxQtInputContextProxy::setSurroundingText(
const QString &text, unsigned int cursor, unsigned int anchor) {
Q_D(FcitxQtInputContextProxy);
return d->icproxy_->SetSurroundingText(text, cursor, anchor);
}
QDBusPendingReply<>
FcitxQtInputContextProxy::setSurroundingTextPosition(unsigned int cursor,
unsigned int anchor) {
Q_D(FcitxQtInputContextProxy);
return d->icproxy_->SetSurroundingTextPosition(cursor, anchor);
}
QDBusPendingReply<> FcitxQtInputContextProxy::showVirtualKeyboard() {
Q_D(FcitxQtInputContextProxy);
return d->icproxy_->ShowVirtualKeyboard();
}
QDBusPendingReply<> FcitxQtInputContextProxy::prevPage() {
Q_D(FcitxQtInputContextProxy);
return d->icproxy_->PrevPage();
}
QDBusPendingReply<> FcitxQtInputContextProxy::nextPage() {
Q_D(FcitxQtInputContextProxy);
return d->icproxy_->NextPage();
}
QDBusPendingReply<> FcitxQtInputContextProxy::selectCandidate(int i) {
Q_D(FcitxQtInputContextProxy);
return d->icproxy_->SelectCandidate(i);
}
QDBusPendingReply<> FcitxQtInputContextProxy::invokeAction(unsigned int action,
int cursor) {
Q_D(FcitxQtInputContextProxy);
return d->icproxy_->InvokeAction(action, cursor);
}
bool FcitxQtInputContextProxy::isVirtualKeyboardVisible() {
Q_D(FcitxQtInputContextProxy);
return d->isVirtualKeyboardVisible_;
}
bool FcitxQtInputContextProxy::supportInvokeAction() const {
Q_D(const FcitxQtInputContextProxy);
return d->supportInvokeAction_;
}
} // namespace fcitx

View File

@@ -0,0 +1,85 @@
/*
* SPDX-FileCopyrightText: 2012~2017 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#ifndef _DBUSADDONS_FCITXQTINPUTCONTEXTPROXY_H_
#define _DBUSADDONS_FCITXQTINPUTCONTEXTPROXY_H_
#include "fcitx5qt5dbusaddons_export.h"
#include "fcitxqtdbustypes.h"
#include <QDBusPendingReply>
namespace fcitx {
class FcitxQtWatcher;
class FcitxQtInputContextProxyPrivate;
class FCITX5QT5DBUSADDONS_EXPORT FcitxQtInputContextProxy : public QObject {
Q_OBJECT
public:
FcitxQtInputContextProxy(FcitxQtWatcher *watcher, QObject *parent);
~FcitxQtInputContextProxy();
bool isValid() const;
void setDisplay(const QString &display);
const QString &display() const;
public Q_SLOTS:
QDBusPendingReply<> focusIn();
QDBusPendingReply<> focusOut();
QDBusPendingReply<> hideVirtualKeyboard();
QDBusPendingReply<bool> processKeyEvent(unsigned int keyval,
unsigned int keycode,
unsigned int state, bool type,
unsigned int time);
QDBusPendingReply<> reset();
QDBusPendingReply<> setSupportedCapability(qulonglong caps);
QDBusPendingReply<> setCapability(qulonglong caps);
QDBusPendingReply<> setCursorRect(int x, int y, int w, int h);
QDBusPendingReply<> setCursorRectV2(int x, int y, int w, int h,
double scale);
QDBusPendingReply<> setSurroundingText(const QString &text,
unsigned int cursor,
unsigned int anchor);
QDBusPendingReply<> setSurroundingTextPosition(unsigned int cursor,
unsigned int anchor);
QDBusPendingReply<> showVirtualKeyboard();
QDBusPendingReply<> prevPage();
QDBusPendingReply<> nextPage();
QDBusPendingReply<> selectCandidate(int i);
QDBusPendingReply<> invokeAction(unsigned int action, int cursor);
bool isVirtualKeyboardVisible();
bool supportInvokeAction() const;
Q_SIGNALS:
void commitString(const QString &str);
void currentIM(const QString &name, const QString &uniqueName,
const QString &langCode);
void deleteSurroundingText(int offset, unsigned int nchar);
void forwardKey(unsigned int keyval, unsigned int state, bool isRelease);
void updateFormattedPreedit(const FcitxQtFormattedPreeditList &str,
int cursorpos);
void updateClientSideUI(const FcitxQtFormattedPreeditList &preedit,
int cursorpos,
const FcitxQtFormattedPreeditList &auxUp,
const FcitxQtFormattedPreeditList &auxDown,
const FcitxQtStringKeyValueList &candidates,
int candidateIndex, int layoutHint, bool hasPrev,
bool hasNext);
void inputContextCreated(const QByteArray &uuid);
void inputContextCreationFailed();
void notifyFocusOut();
void virtualKeyboardVisibilityChanged(bool visible);
private:
FcitxQtInputContextProxyPrivate *const d_ptr;
Q_DECLARE_PRIVATE(FcitxQtInputContextProxy);
};
} // namespace fcitx
#endif // _DBUSADDONS_FCITXQTINPUTCONTEXTPROXY_H_

View File

@@ -0,0 +1,271 @@
/*
* SPDX-FileCopyrightText: 2012~2017 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#ifndef _DBUSADDONS_FCITXQTINPUTCONTEXTPROXY_P_H_
#define _DBUSADDONS_FCITXQTINPUTCONTEXTPROXY_P_H_
#include "fcitxqtinputcontextproxy.h"
#include "fcitxqtinputcontextproxyimpl.h"
#include "fcitxqtinputmethodproxy.h"
#include "fcitxqtwatcher.h"
#include <QDBusServiceWatcher>
#include <cstddef>
namespace fcitx {
class FcitxQtInputContextProxyPrivate {
public:
FcitxQtInputContextProxyPrivate(FcitxQtWatcher *watcher,
FcitxQtInputContextProxy *q)
: q_ptr(q), fcitxWatcher_(watcher), watcher_(q) {
registerFcitxQtDBusTypes();
QObject::connect(fcitxWatcher_, &FcitxQtWatcher::availabilityChanged, q,
[this]() { availabilityChanged(); });
watcher_.setWatchMode(QDBusServiceWatcher::WatchForUnregistration);
QObject::connect(&watcher_, &QDBusServiceWatcher::serviceUnregistered,
q, [this]() {
cleanUp();
availabilityChanged();
});
availabilityChanged();
}
~FcitxQtInputContextProxyPrivate() {
Q_Q(FcitxQtInputContextProxy);
if (isValid()) {
icproxy_->DestroyIC();
}
QObject::disconnect(
q, &FcitxQtInputContextProxy::virtualKeyboardVisibilityChanged,
nullptr, nullptr);
cleanUp();
}
bool isValid() const { return (icproxy_ && icproxy_->isValid()); }
void availabilityChanged() {
QTimer::singleShot(100, q_ptr, [this]() { recheck(); });
}
void recheck() {
if (!isValid() && fcitxWatcher_->availability()) {
createInputContext();
}
if (!fcitxWatcher_->availability()) {
cleanUp();
}
}
void cleanUp() {
auto services = watcher_.watchedServices();
for (const auto &service : services) {
watcher_.removeWatchedService(service);
}
delete improxy_;
improxy_ = nullptr;
delete icproxy_;
icproxy_ = nullptr;
delete createInputContextWatcher_;
createInputContextWatcher_ = nullptr;
delete introspectWatcher_;
introspectWatcher_ = nullptr;
delete queryWatcher_;
queryWatcher_ = nullptr;
setVirtualKeyboardVisible(false);
supportInvokeAction_ = false;
}
void createInputContext() {
Q_Q(FcitxQtInputContextProxy);
if (!fcitxWatcher_->availability()) {
return;
}
cleanUp();
auto service = fcitxWatcher_->serviceName();
auto connection = fcitxWatcher_->connection();
auto owner = connection.interface()->serviceOwner(service);
if (!owner.isValid()) {
return;
}
watcher_.setConnection(connection);
watcher_.setWatchedServices(QStringList() << owner);
// Avoid race, query again.
if (!connection.interface()->isServiceRegistered(owner)) {
cleanUp();
return;
}
QFileInfo info(QCoreApplication::applicationFilePath());
improxy_ = new FcitxQtInputMethodProxy(
owner, "/org/freedesktop/portal/inputmethod", connection, q);
FcitxQtStringKeyValueList list;
FcitxQtStringKeyValue arg;
arg.setKey("program");
arg.setValue(info.fileName());
list << arg;
if (!display_.isEmpty()) {
FcitxQtStringKeyValue arg2;
arg2.setKey("display");
arg2.setValue(display_);
list << arg2;
}
// Qt has good support for showing virtual keyboard, so we should
// disable the default behavior supported by fcitx5
FcitxQtStringKeyValue clientControlVirtualkeyboardShow;
clientControlVirtualkeyboardShow.setKey(
"clientControlVirtualkeyboardShow");
clientControlVirtualkeyboardShow.setValue("true");
list << clientControlVirtualkeyboardShow;
// Qt has poor support for hiding virtual keyboard, so we should enable
// the default behavior supported by fcitx5
FcitxQtStringKeyValue clientControlVirtualkeyboardHide;
clientControlVirtualkeyboardHide.setKey(
"clientControlVirtualkeyboardHide");
clientControlVirtualkeyboardHide.setValue("false");
list << clientControlVirtualkeyboardHide;
auto result = improxy_->CreateInputContext(list);
createInputContextWatcher_ = new QDBusPendingCallWatcher(result);
QObject::connect(createInputContextWatcher_,
&QDBusPendingCallWatcher::finished, q,
[this]() { createInputContextFinished(); });
}
void createInputContextFinished() {
Q_Q(FcitxQtInputContextProxy);
if (createInputContextWatcher_->isError()) {
cleanUp();
Q_EMIT q->inputContextCreationFailed();
return;
}
QDBusPendingReply<QDBusObjectPath, QByteArray> reply(
*createInputContextWatcher_);
icproxy_ = new FcitxQtInputContextProxyImpl(improxy_->service(),
reply.value().path(),
improxy_->connection(), q);
QObject::connect(icproxy_, &FcitxQtInputContextProxyImpl::CommitString,
q, &FcitxQtInputContextProxy::commitString);
QObject::connect(icproxy_, &FcitxQtInputContextProxyImpl::CurrentIM, q,
&FcitxQtInputContextProxy::currentIM);
QObject::connect(icproxy_,
&FcitxQtInputContextProxyImpl::DeleteSurroundingText,
q, &FcitxQtInputContextProxy::deleteSurroundingText);
QObject::connect(icproxy_, &FcitxQtInputContextProxyImpl::ForwardKey, q,
&FcitxQtInputContextProxy::forwardKey);
QObject::connect(icproxy_,
&FcitxQtInputContextProxyImpl::UpdateFormattedPreedit,
q, &FcitxQtInputContextProxy::updateFormattedPreedit);
QObject::connect(icproxy_,
&FcitxQtInputContextProxyImpl::UpdateClientSideUI, q,
&FcitxQtInputContextProxy::updateClientSideUI);
QObject::connect(icproxy_,
&FcitxQtInputContextProxyImpl::NotifyFocusOut, q,
&FcitxQtInputContextProxy::notifyFocusOut);
QObject::connect(
icproxy_,
&FcitxQtInputContextProxyImpl::VirtualKeyboardVisibilityChanged, q,
[this](bool visible) {
if (queryWatcher_) {
queryWatcher_->deleteLater();
queryWatcher_ = nullptr;
}
setVirtualKeyboardVisible(visible);
});
delete createInputContextWatcher_;
createInputContextWatcher_ = nullptr;
Q_EMIT q->inputContextCreated(reply.argumentAt<1>());
introspect();
virtualKeyboardVisibilityQuery();
}
void introspect() {
Q_Q(FcitxQtInputContextProxy);
if (introspectWatcher_) {
delete introspectWatcher_;
introspectWatcher_ = nullptr;
}
QDBusMessage call = QDBusMessage::createMethodCall(
icproxy_->service(), icproxy_->path(),
"org.freedesktop.DBus.Introspectable", "Introspect");
introspectWatcher_ = new QDBusPendingCallWatcher(
fcitxWatcher_->connection().asyncCall(call));
QObject::connect(introspectWatcher_, &QDBusPendingCallWatcher::finished,
q, [this]() { introspectFinished(); });
}
void introspectFinished() {
if (introspectWatcher_->isFinished() &&
!introspectWatcher_->isError()) {
QDBusPendingReply<QString> reply = *introspectWatcher_;
if (reply.value().contains("InvokeAction")) {
supportInvokeAction_ = true;
}
}
delete introspectWatcher_;
introspectWatcher_ = nullptr;
}
void virtualKeyboardVisibilityQuery() {
Q_Q(FcitxQtInputContextProxy);
if (queryWatcher_) {
delete queryWatcher_;
queryWatcher_ = nullptr;
}
queryWatcher_ =
new QDBusPendingCallWatcher(icproxy_->IsVirtualKeyboardVisible());
QObject::connect(
queryWatcher_, &QDBusPendingCallWatcher::finished, q,
[this]() { virtualKeyboardVisibilityQueryFinished(); });
}
void virtualKeyboardVisibilityQueryFinished() {
if (queryWatcher_ && queryWatcher_->isFinished() &&
!queryWatcher_->isError()) {
QDBusPendingReply<bool> reply = *queryWatcher_;
setVirtualKeyboardVisible(reply.value());
}
delete queryWatcher_;
queryWatcher_ = nullptr;
}
void setVirtualKeyboardVisible(bool visible) {
Q_Q(FcitxQtInputContextProxy);
if (isVirtualKeyboardVisible_ != visible) {
isVirtualKeyboardVisible_ = visible;
Q_EMIT q->virtualKeyboardVisibilityChanged(
isVirtualKeyboardVisible_);
}
}
FcitxQtInputContextProxy *q_ptr;
Q_DECLARE_PUBLIC(FcitxQtInputContextProxy);
FcitxQtWatcher *fcitxWatcher_;
QDBusServiceWatcher watcher_;
FcitxQtInputMethodProxy *improxy_ = nullptr;
FcitxQtInputContextProxyImpl *icproxy_ = nullptr;
bool isVirtualKeyboardVisible_ = false;
bool supportInvokeAction_ = false;
QDBusPendingCallWatcher *createInputContextWatcher_ = nullptr;
QDBusPendingCallWatcher *introspectWatcher_ = nullptr;
QDBusPendingCallWatcher *queryWatcher_ = nullptr;
QString display_;
};
} // namespace fcitx
#endif // _DBUSADDONS_FCITXQTINPUTCONTEXTPROXY_P_H_

View File

@@ -0,0 +1,31 @@
/*
* This file was generated by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp -N -p fcitxqtinputcontextproxyimpl -c
* FcitxQtInputContextProxyImpl interfaces/org.fcitx.Fcitx.InputContext1.xml -i
* fcitxqtdbustypes.h -i fcitx5qt5dbusaddons_export.h
*
* qdbusxml2cpp is Copyright (C) 2022 The Qt Company Ltd.
*
* This is an auto-generated file.
* This file may have been hand-edited. Look for HAND-EDIT comments
* before re-generating it.
*/
#include "fcitxqtinputcontextproxyimpl.h"
namespace fcitx {
/*
* Implementation of interface class FcitxQtInputContextProxyImpl
*/
FcitxQtInputContextProxyImpl::FcitxQtInputContextProxyImpl(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
: QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
{
}
FcitxQtInputContextProxyImpl::~FcitxQtInputContextProxyImpl()
{
}
}

View File

@@ -0,0 +1,178 @@
/*
* This file was generated by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp -N -p fcitxqtinputcontextproxyimpl -c
* FcitxQtInputContextProxyImpl interfaces/org.fcitx.Fcitx.InputContext1.xml -i
* fcitxqtdbustypes.h -i fcitx5qt5dbusaddons_export.h
*
* qdbusxml2cpp is Copyright (C) 2022 The Qt Company Ltd.
*
* This is an auto-generated file.
* Do not edit! All changes made to it will be lost.
*/
#ifndef FCITXQTINPUTCONTEXTPROXYIMPL_H
#define FCITXQTINPUTCONTEXTPROXYIMPL_H
#include <QtCore/QObject>
#include <QtCore/QByteArray>
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QVariant>
#include <QtDBus/QtDBus>
#include "fcitxqtdbustypes.h"
#include "fcitx5qt5dbusaddons_export.h"
namespace fcitx {
/*
* Proxy class for interface org.fcitx.Fcitx.InputContext1
*/
class FCITX5QT5DBUSADDONS_EXPORT FcitxQtInputContextProxyImpl: public QDBusAbstractInterface
{
Q_OBJECT
public:
static inline const char *staticInterfaceName()
{ return "org.fcitx.Fcitx.InputContext1"; }
public:
FcitxQtInputContextProxyImpl(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = nullptr);
~FcitxQtInputContextProxyImpl();
public Q_SLOTS: // METHODS
inline QDBusPendingReply<> DestroyIC()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("DestroyIC"), argumentList);
}
inline QDBusPendingReply<> FocusIn()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("FocusIn"), argumentList);
}
inline QDBusPendingReply<> FocusOut()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("FocusOut"), argumentList);
}
inline QDBusPendingReply<> HideVirtualKeyboard()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("HideVirtualKeyboard"), argumentList);
}
inline QDBusPendingReply<> InvokeAction(unsigned int action, int cursor) {
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(action)
<< QVariant::fromValue(cursor);
return asyncCallWithArgumentList(QStringLiteral("InvokeAction"),
argumentList);
}
inline QDBusPendingReply<bool> IsVirtualKeyboardVisible() {
QList<QVariant> argumentList;
return asyncCallWithArgumentList(
QStringLiteral("IsVirtualKeyboardVisible"), argumentList);
}
inline QDBusPendingReply<> NextPage()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("NextPage"), argumentList);
}
inline QDBusPendingReply<> PrevPage()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("PrevPage"), argumentList);
}
inline QDBusPendingReply<bool>
ProcessKeyEvent(unsigned int keyval, unsigned int keycode,
unsigned int state, bool type, unsigned int time) {
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(keyval) << QVariant::fromValue(keycode) << QVariant::fromValue(state) << QVariant::fromValue(type) << QVariant::fromValue(time);
return asyncCallWithArgumentList(QStringLiteral("ProcessKeyEvent"), argumentList);
}
inline QDBusPendingReply<> Reset()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("Reset"), argumentList);
}
inline QDBusPendingReply<> SelectCandidate(int index)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(index);
return asyncCallWithArgumentList(QStringLiteral("SelectCandidate"), argumentList);
}
inline QDBusPendingReply<> SetCapability(qulonglong caps)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(caps);
return asyncCallWithArgumentList(QStringLiteral("SetCapability"), argumentList);
}
inline QDBusPendingReply<> SetCursorRect(int x, int y, int w, int h)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(x) << QVariant::fromValue(y) << QVariant::fromValue(w) << QVariant::fromValue(h);
return asyncCallWithArgumentList(QStringLiteral("SetCursorRect"), argumentList);
}
inline QDBusPendingReply<> SetCursorRectV2(int x, int y, int w, int h, double scale)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(x) << QVariant::fromValue(y) << QVariant::fromValue(w) << QVariant::fromValue(h) << QVariant::fromValue(scale);
return asyncCallWithArgumentList(QStringLiteral("SetCursorRectV2"), argumentList);
}
inline QDBusPendingReply<> SetSupportedCapability(qulonglong caps) {
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(caps);
return asyncCallWithArgumentList(
QStringLiteral("SetSupportedCapability"), argumentList);
}
inline QDBusPendingReply<> SetSurroundingText(const QString &text,
unsigned int cursor,
unsigned int anchor) {
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(text) << QVariant::fromValue(cursor) << QVariant::fromValue(anchor);
return asyncCallWithArgumentList(QStringLiteral("SetSurroundingText"), argumentList);
}
inline QDBusPendingReply<> SetSurroundingTextPosition(unsigned int cursor,
unsigned int anchor) {
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(cursor) << QVariant::fromValue(anchor);
return asyncCallWithArgumentList(QStringLiteral("SetSurroundingTextPosition"), argumentList);
}
inline QDBusPendingReply<> ShowVirtualKeyboard()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("ShowVirtualKeyboard"), argumentList);
}
Q_SIGNALS: // SIGNALS
void CommitString(const QString &str);
void CurrentIM(const QString &name, const QString &uniqueName, const QString &langCode);
void DeleteSurroundingText(int offset, unsigned int nchar);
void ForwardKey(unsigned int keyval, unsigned int state, bool type);
void NotifyFocusOut();
void UpdateClientSideUI(FcitxQtFormattedPreeditList preedit, int cursorpos, FcitxQtFormattedPreeditList auxUp, FcitxQtFormattedPreeditList auxDown, FcitxQtStringKeyValueList candidates, int candidateIndex, int layoutHint, bool hasPrev, bool hasNext);
void UpdateFormattedPreedit(FcitxQtFormattedPreeditList str, int cursorpos);
void VirtualKeyboardVisibilityChanged(bool visible);
};
}
#endif

View File

@@ -0,0 +1,31 @@
/*
* This file was generated by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp -N -p fcitxqtinputmethodproxy -c
* FcitxQtInputMethodProxy interfaces/org.fcitx.Fcitx.InputMethod1.xml -i
* fcitxqtdbustypes.h -i fcitx5qt5dbusaddons_export.h
*
* qdbusxml2cpp is Copyright (C) 2022 The Qt Company Ltd.
*
* This is an auto-generated file.
* This file may have been hand-edited. Look for HAND-EDIT comments
* before re-generating it.
*/
#include "fcitxqtinputmethodproxy.h"
namespace fcitx {
/*
* Implementation of interface class FcitxQtInputMethodProxy
*/
FcitxQtInputMethodProxy::FcitxQtInputMethodProxy(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
: QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
{
}
FcitxQtInputMethodProxy::~FcitxQtInputMethodProxy()
{
}
}

View File

@@ -0,0 +1,67 @@
/*
* This file was generated by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp -N -p fcitxqtinputmethodproxy -c
* FcitxQtInputMethodProxy interfaces/org.fcitx.Fcitx.InputMethod1.xml -i
* fcitxqtdbustypes.h -i fcitx5qt5dbusaddons_export.h
*
* qdbusxml2cpp is Copyright (C) 2022 The Qt Company Ltd.
*
* This is an auto-generated file.
* Do not edit! All changes made to it will be lost.
*/
#ifndef FCITXQTINPUTMETHODPROXY_H
#define FCITXQTINPUTMETHODPROXY_H
#include <QtCore/QObject>
#include <QtCore/QByteArray>
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QVariant>
#include <QtDBus/QtDBus>
#include "fcitxqtdbustypes.h"
#include "fcitx5qt5dbusaddons_export.h"
namespace fcitx {
/*
* Proxy class for interface org.fcitx.Fcitx.InputMethod1
*/
class FCITX5QT5DBUSADDONS_EXPORT FcitxQtInputMethodProxy: public QDBusAbstractInterface
{
Q_OBJECT
public:
static inline const char *staticInterfaceName()
{ return "org.fcitx.Fcitx.InputMethod1"; }
public:
FcitxQtInputMethodProxy(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = nullptr);
~FcitxQtInputMethodProxy();
public Q_SLOTS: // METHODS
inline QDBusPendingReply<QDBusObjectPath, QByteArray> CreateInputContext(FcitxQtStringKeyValueList in0)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(in0);
return asyncCallWithArgumentList(QStringLiteral("CreateInputContext"), argumentList);
}
inline QDBusReply<QDBusObjectPath> CreateInputContext(FcitxQtStringKeyValueList in0, QByteArray &out1)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(in0);
QDBusMessage reply = callWithArgumentList(QDBus::Block, QStringLiteral("CreateInputContext"), argumentList);
if (reply.type() == QDBusMessage::ReplyMessage && reply.arguments().count() == 2) {
out1 = qdbus_cast<QByteArray>(reply.arguments().at(1));
}
return reply;
}
Q_SIGNALS: // SIGNALS
};
}
#endif

View File

@@ -0,0 +1,137 @@
/*
* SPDX-FileCopyrightText: 2012~2017 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#include "fcitxqtwatcher_p.h"
#include <QDBusConnectionInterface>
namespace fcitx {
FcitxQtWatcher::FcitxQtWatcher(QObject *parent)
: QObject(parent), d_ptr(new FcitxQtWatcherPrivate(this)) {}
FcitxQtWatcher::FcitxQtWatcher(const QDBusConnection &connection,
QObject *parent)
: FcitxQtWatcher(parent) {
setConnection(connection);
}
FcitxQtWatcher::~FcitxQtWatcher() { delete d_ptr; }
bool FcitxQtWatcher::availability() const {
Q_D(const FcitxQtWatcher);
return d->availability_;
}
void FcitxQtWatcher::setConnection(const QDBusConnection &connection) {
Q_D(FcitxQtWatcher);
return d->serviceWatcher_.setConnection(connection);
}
QDBusConnection FcitxQtWatcher::connection() const {
Q_D(const FcitxQtWatcher);
return d->serviceWatcher_.connection();
}
void FcitxQtWatcher::setWatchPortal(bool portal) {
Q_D(FcitxQtWatcher);
d->watchPortal_ = portal;
}
bool FcitxQtWatcher::watchPortal() const {
Q_D(const FcitxQtWatcher);
return d->watchPortal_;
}
QString FcitxQtWatcher::serviceName() const {
Q_D(const FcitxQtWatcher);
if (d->mainPresent_) {
return FCITX_MAIN_SERVICE_NAME;
}
if (d->portalPresent_) {
return FCITX_PORTAL_SERVICE_NAME;
}
return QString();
}
void FcitxQtWatcher::setAvailability(bool availability) {
Q_D(FcitxQtWatcher);
if (d->availability_ != availability) {
d->availability_ = availability;
Q_EMIT availabilityChanged(d->availability_);
}
}
void FcitxQtWatcher::watch() {
Q_D(FcitxQtWatcher);
if (d->watched_) {
return;
}
connect(&d->serviceWatcher_, &QDBusServiceWatcher::serviceOwnerChanged,
this, &FcitxQtWatcher::imChanged);
d->serviceWatcher_.addWatchedService(FCITX_MAIN_SERVICE_NAME);
if (d->watchPortal_) {
d->serviceWatcher_.addWatchedService(FCITX_PORTAL_SERVICE_NAME);
}
if (connection().interface()->isServiceRegistered(
FCITX_MAIN_SERVICE_NAME)) {
d->mainPresent_ = true;
}
if (d->watchPortal_ && connection().interface()->isServiceRegistered(
FCITX_PORTAL_SERVICE_NAME)) {
d->portalPresent_ = true;
}
updateAvailability();
d->watched_ = true;
}
void FcitxQtWatcher::unwatch() {
Q_D(FcitxQtWatcher);
if (!d->watched_) {
return;
}
disconnect(&d->serviceWatcher_, &QDBusServiceWatcher::serviceOwnerChanged,
this, &FcitxQtWatcher::imChanged);
d->mainPresent_ = false;
d->portalPresent_ = false;
d->watched_ = false;
updateAvailability();
}
bool FcitxQtWatcher::isWatching() const {
Q_D(const FcitxQtWatcher);
return d->watched_;
}
void FcitxQtWatcher::imChanged(const QString &service, const QString &,
const QString &newOwner) {
Q_D(FcitxQtWatcher);
if (service == FCITX_MAIN_SERVICE_NAME) {
if (!newOwner.isEmpty()) {
d->mainPresent_ = true;
} else {
d->mainPresent_ = false;
}
} else if (service == FCITX_PORTAL_SERVICE_NAME) {
if (!newOwner.isEmpty()) {
d->portalPresent_ = true;
} else {
d->portalPresent_ = false;
}
}
updateAvailability();
}
void FcitxQtWatcher::updateAvailability() {
Q_D(FcitxQtWatcher);
setAvailability(d->mainPresent_ || d->portalPresent_);
}
} // namespace fcitx

View File

@@ -0,0 +1,54 @@
/*
* SPDX-FileCopyrightText: 2012~2017 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#ifndef _DBUSADDONS_FCITXQTWATCHER_H_
#define _DBUSADDONS_FCITXQTWATCHER_H_
#include "fcitx5qt5dbusaddons_export.h"
#include <QDBusConnection>
#include <QObject>
namespace fcitx {
class FcitxQtWatcherPrivate;
class FCITX5QT5DBUSADDONS_EXPORT FcitxQtWatcher : public QObject {
Q_OBJECT
public:
explicit FcitxQtWatcher(QObject *parent = nullptr);
explicit FcitxQtWatcher(const QDBusConnection &connection,
QObject *parent = nullptr);
~FcitxQtWatcher();
void watch();
void unwatch();
void setConnection(const QDBusConnection &connection);
QDBusConnection connection() const;
void setWatchPortal(bool portal);
bool watchPortal() const;
bool isWatching() const;
bool availability() const;
QString serviceName() const;
Q_SIGNALS:
void availabilityChanged(bool);
private Q_SLOTS:
void imChanged(const QString &service, const QString &oldOwner,
const QString &newOwner);
private:
void setAvailability(bool availability);
void updateAvailability();
FcitxQtWatcherPrivate *const d_ptr;
Q_DECLARE_PRIVATE(FcitxQtWatcher);
};
} // namespace fcitx
#endif // _DBUSADDONS_FCITXQTWATCHER_H_

View File

@@ -0,0 +1,32 @@
/*
* SPDX-FileCopyrightText: 2012~2017 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#ifndef _DBUSADDONS_FCITXQTWATCHER_P_H_
#define _DBUSADDONS_FCITXQTWATCHER_P_H_
#include "fcitxqtwatcher.h"
#include <QDBusServiceWatcher>
#define FCITX_MAIN_SERVICE_NAME "org.fcitx.Fcitx5"
#define FCITX_PORTAL_SERVICE_NAME "org.freedesktop.portal.Fcitx"
namespace fcitx {
class FcitxQtWatcherPrivate {
public:
FcitxQtWatcherPrivate(FcitxQtWatcher *q) : serviceWatcher_(q) {}
QDBusServiceWatcher serviceWatcher_;
bool watchPortal_ = false;
bool availability_ = false;
bool mainPresent_ = false;
bool portalPresent_ = false;
bool watched_ = false;
};
} // namespace fcitx
#endif // _DBUSADDONS_FCITXQTWATCHER_P_H_

View File

@@ -0,0 +1,5 @@
#!/bin/sh
qdbusxml2cpp-qt5 -N -p fcitxqtinputcontextproxyimpl -c FcitxQtInputContextProxyImpl interfaces/org.fcitx.Fcitx.InputContext1.xml -i fcitxqtdbustypes.h -i fcitx5qt5dbusaddons_export.h
qdbusxml2cpp-qt5 -N -p fcitxqtinputmethodproxy -c FcitxQtInputMethodProxy interfaces/org.fcitx.Fcitx.InputMethod1.xml -i fcitxqtdbustypes.h -i fcitx5qt5dbusaddons_export.h
qdbusxml2cpp-qt5 -N -p fcitxqtcontrollerproxy -c FcitxQtControllerProxy interfaces/org.fcitx.Fcitx.Controller1.xml -i fcitxqtdbustypes.h -i fcitx5qt5dbusaddons_export.h

View File

@@ -0,0 +1,117 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.fcitx.Fcitx.Controller1">
<method name="Exit">
</method>
<method name="Restart">
</method>
<method name="Configure">
</method>
<method name="ConfigureAddon">
<arg type="s" direction="in"/>
</method>
<method name="ConfigureIM">
<arg type="s" direction="in"/>
</method>
<method name="CurrentUI">
<arg type="s" direction="out"/>
</method>
<method name="AddonForIM">
<arg type="s" direction="in"/>
<arg type="s" direction="out"/>
</method>
<method name="Activate">
</method>
<method name="Toggle">
</method>
<method name="ResetIMList">
</method>
<method name="State">
<arg type="i" direction="out"/>
</method>
<method name="ReloadConfig">
</method>
<method name="ReloadAddonConfig">
<arg type="s" direction="in"/>
</method>
<method name="CurrentInputMethod">
<arg type="s" direction="out"/>
</method>
<method name="SetCurrentIM">
<arg type="s" direction="in"/>
</method>
<method name="FullInputMethodGroupInfo">
<arg type="s" direction="in"/>
<arg type="s" name="groupName" direction="out"/>
<arg type="s" name="defaultInputMethod" direction="out"/>
<arg type="s" name="defaultLayout" direction="out"/>
<arg type="a{sv}" name="properties" direction="out"/>
<arg type="a(sssssssbsa{sv})" name="inputMethodEntryList" direction="out"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out3" value="QVariantMap" />
<annotation name="org.qtproject.QtDBus.QtTypeName.Out4" value="FcitxQtFullInputMethodEntryList" />
</method>
<method name="InputMethodGroupInfo">
<arg type="s" direction="in"/>
<arg type="s" name="layout" direction="out"/>
<arg type="a(ss)" name="items" direction="out"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="FcitxQtStringKeyValueList" />
</method>
<method name="InputMethodGroups">
<arg type="as" direction="out"/>
</method>
<method name="AvailableInputMethods">
<arg type="a(ssssssb)" direction="out"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="FcitxQtInputMethodEntryList" />
</method>
<signal name="InputMethodGroupsChanged">
</signal>
<method name="AvailableKeyboardLayouts">
<arg type="a(ssasa(ssas))" direction="out" />
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="FcitxQtLayoutInfoList" />
</method>
<method name="SetInputMethodGroupInfo">
<arg type="s" name="name" direction="in"/>
<arg type="s" name="layout" direction="in"/>
<arg type="a(ss)" name="entries" direction="in"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="FcitxQtStringKeyValueList" />
</method>
<method name="AddInputMethodGroup">
<arg type="s" direction="in"/>
</method>
<method name="RemoveInputMethodGroup">
<arg type="s" direction="in"/>
</method>
<method name="GetConfig">
<arg type="s" direction="in"/>
<arg type="v" direction="out"/>
<arg type="a(sa(sssva{sv}))" direction="out"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="FcitxQtConfigTypeList" />
</method>
<method name="SetConfig">
<arg type="s" direction="in"/>
<arg type="v" direction="in"/>
</method>
<method name="GetAddons">
<arg type="a(sssibb)" direction="out"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="FcitxQtAddonInfoList" />
</method>
<method name="GetAddonsV2">
<arg type="a(sssibbbasas)" direction="out"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="FcitxQtAddonInfoV2List" />
</method>
<method name="SetAddonsState">
<arg type="a(sb)" direction="in"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="FcitxQtAddonStateList" />
</method>
<method name="Refresh">
</method>
<method name="CheckUpdate">
<arg type="b" direction="out"/>
</method>
<method name="CanRestart">
<arg type="b" direction="out"/>
</method>
</interface>
</node>

View File

@@ -0,0 +1,117 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.fcitx.Fcitx.InputContext1">
<method name="FocusIn">
</method>
<method name="FocusOut">
</method>
<method name="Reset">
</method>
<method name="SetCursorRect">
<arg name="x" direction="in" type="i"/>
<arg name="y" direction="in" type="i"/>
<arg name="w" direction="in" type="i"/>
<arg name="h" direction="in" type="i"/>
</method>
<method name="SetCursorRectV2">
<arg name="x" direction="in" type="i"/>
<arg name="y" direction="in" type="i"/>
<arg name="w" direction="in" type="i"/>
<arg name="h" direction="in" type="i"/>
<arg name="scale" direction="in" type="d"/>
</method>
<method name="SetSupportedCapability">
<arg name="caps" direction="in" type="t"/>
</method>
<method name="SetCapability">
<arg name="caps" direction="in" type="t"/>
</method>
<method name="SetSurroundingText">
<arg name="text" direction="in" type="s"/>
<arg name="cursor" direction="in" type="u"/>
<arg name="anchor" direction="in" type="u"/>
</method>
<method name="SetSurroundingTextPosition">
<arg name="cursor" direction="in" type="u"/>
<arg name="anchor" direction="in" type="u"/>
</method>
<method name="DestroyIC">
</method>
<method name="ProcessKeyEvent">
<arg name="keyval" direction="in" type="u"/>
<arg name="keycode" direction="in" type="u"/>
<arg name="state" direction="in" type="u"/>
<arg name="type" direction="in" type="b"/>
<arg name="time" direction="in" type="u"/>
<arg name="ret" direction="out" type="b"/>
</method>
<method name="PrevPage">
</method>
<method name="NextPage">
</method>
<method name="SelectCandidate">
<arg name="index" direction="in" type="i"/>
</method>
<method name="InvokeAction">
<arg name="action" direction="in" type="u"/>
<arg name="cursor" direction="in" type="i"/>
</method>
<method name="ShowVirtualKeyboard">
</method>
<method name="HideVirtualKeyboard">
</method>
<method name="IsVirtualKeyboardVisible">
<arg name="visible" direction="out" type="b"/>
</method>
<signal name="CommitString">
<arg name="str" type="s"/>
</signal>
<signal name="CurrentIM">
<arg name="name" type="s"/>
<arg name="uniqueName" type="s"/>
<arg name="langCode" type="s"/>
</signal>
<signal name="UpdateFormattedPreedit">
<arg name="str" type="a(si)" />
<arg name="cursorpos" type="i"/>
<!-- qt4 / 5 seems use in/out differently -->
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="FcitxQtFormattedPreeditList" />
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="FcitxQtFormattedPreeditList" />
</signal>
<signal name="UpdateClientSideUI">
<arg name="preedit" type="a(si)" />
<arg name="cursorpos" type="i"/>
<arg name="auxUp" type="a(si)" />
<arg name="auxDown" type="a(si)" />
<arg name="candidates" type="a(ss)" />
<arg name="candidateIndex" type="i"/>
<arg name="layoutHint" type="i"/>
<arg name="hasPrev" type="b" />
<arg name="hasNext" type="b" />
<!-- qt4 / 5 seems use in/out differently -->
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="FcitxQtFormattedPreeditList" />
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="FcitxQtFormattedPreeditList" />
<annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="FcitxQtFormattedPreeditList" />
<annotation name="org.qtproject.QtDBus.QtTypeName.Out2" value="FcitxQtFormattedPreeditList" />
<annotation name="org.qtproject.QtDBus.QtTypeName.In3" value="FcitxQtFormattedPreeditList" />
<annotation name="org.qtproject.QtDBus.QtTypeName.Out3" value="FcitxQtFormattedPreeditList" />
<annotation name="org.qtproject.QtDBus.QtTypeName.In4" value="FcitxQtFormattedPreeditList" />
<annotation name="org.qtproject.QtDBus.QtTypeName.Out4" value="FcitxQtStringKeyValueList" />
</signal>
<signal name="DeleteSurroundingText">
<arg name="offset" type="i"/>
<arg name="nchar" type="u"/>
</signal>
<signal name="ForwardKey">
<arg name="keyval" type="u"/>
<arg name="state" type="u"/>
<arg name="type" type="b"/>
</signal>
<signal name="NotifyFocusOut">
</signal>
<signal name="VirtualKeyboardVisibilityChanged">
<arg name="visible" type="b"/>
</signal>
</interface>
</node>

View File

@@ -0,0 +1,12 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.fcitx.Fcitx.InputMethod1">
<method name="CreateInputContext">
<arg type="a(ss)" direction="in"/>
<arg type="o" direction="out"/>
<arg type="ay" direction="out"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="FcitxQtStringKeyValueList" />
</method>
</interface>
</node>

View File

@@ -0,0 +1,25 @@
set(QT_WRAPPER_SRCS
main.cpp
wrapperapp.cpp
mainwindow.cpp
)
add_executable(fcitx5-qt5-gui-wrapper ${QT_WRAPPER_SRCS})
set_target_properties(fcitx5-qt5-gui-wrapper
PROPERTIES AUTOMOC TRUE AUTOUIC TRUE AUTOUIC_OPTIONS "-tr=fcitx::tr2fcitx;--include=fcitxqti18nhelper.h")
target_link_libraries(fcitx5-qt5-gui-wrapper
Fcitx5::Utils
Qt5::Core
Qt5::Gui
Qt5::Widgets
Fcitx5Qt5::DBusAddons
Fcitx5Qt5::WidgetsAddons
)
install(TARGETS fcitx5-qt5-gui-wrapper DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}")
configure_file(org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in.in ${CMAKE_CURRENT_BINARY_DIR}/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in @ONLY)
fcitx5_translate_desktop_file(${CMAKE_CURRENT_BINARY_DIR}/org.fcitx.fcitx5-qt5-gui-wrapper.desktop.in
org.fcitx.fcitx5-qt5-gui-wrapper.desktop)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.fcitx.fcitx5-qt5-gui-wrapper.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)

View File

@@ -0,0 +1,18 @@
/*
* SPDX-FileCopyrightText: 2012~2017 CSSlayer <wengxt@gmail.com>
* SPDX-FileCopyrightText: 2017~2017 xzhao <i@xuzhao.net>
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "wrapperapp.h"
#include <QCommandLineParser>
#include <locale.h>
int main(int argc, char *argv[]) {
setlocale(LC_ALL, "");
QGuiApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
fcitx::WrapperApp app(argc, argv);
app.init();
return app.exec();
}

View File

@@ -0,0 +1,150 @@
/*
* SPDX-FileCopyrightText: 2012~2017 CSSlayer <wengxt@gmail.com>
* SPDX-FileCopyrightText: 2017~2017 xzhao <i@xuzhao.net>
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "mainwindow.h"
#include "fcitxqtconfiguifactory.h"
#include "fcitxqtcontrollerproxy.h"
#include "fcitxqtwatcher.h"
#include <QDebug>
#include <QLocale>
#include <QMessageBox>
#include <QPushButton>
#include <QWindow>
#include <fcitx-utils/i18n.h>
namespace fcitx {
MainWindow::MainWindow(const QString &path, FcitxQtConfigUIWidget *pluginWidget,
QWidget *parent)
: QDialog(parent), path_(path), watcher_(new FcitxQtWatcher(this)),
pluginWidget_(pluginWidget), proxy_(0) {
setupUi(this);
watcher_->setConnection(QDBusConnection::sessionBus());
verticalLayout->insertWidget(0, pluginWidget_);
buttonBox->button(QDialogButtonBox::Ok)->setText(_("&Ok"));
buttonBox->button(QDialogButtonBox::Apply)->setText(_("&Apply"));
buttonBox->button(QDialogButtonBox::Reset)->setText(_("&Reset"));
buttonBox->button(QDialogButtonBox::Close)->setText(_("&Close"));
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false);
buttonBox->button(QDialogButtonBox::Reset)->setEnabled(false);
setWindowIcon(QIcon::fromTheme(pluginWidget_->icon()));
setWindowTitle(pluginWidget_->title());
connect(pluginWidget_, &FcitxQtConfigUIWidget::changed, this,
&MainWindow::changed);
if (pluginWidget_->asyncSave()) {
connect(pluginWidget_, &FcitxQtConfigUIWidget::saveFinished, this,
&MainWindow::saveFinished);
}
connect(pluginWidget_, &FcitxQtConfigUIWidget::saveSubConfig, this,
&MainWindow::saveSubConfig);
connect(buttonBox, &QDialogButtonBox::clicked, this, &MainWindow::clicked);
connect(watcher_, &FcitxQtWatcher::availabilityChanged, this,
&MainWindow::availabilityChanged);
watcher_->watch();
}
void MainWindow::availabilityChanged(bool avail) {
if (!avail) {
return;
}
if (proxy_) {
delete proxy_;
}
proxy_ = new FcitxQtControllerProxy(watcher_->serviceName(),
QLatin1String("/controller"),
watcher_->connection(), this);
}
void MainWindow::clicked(QAbstractButton *button) {
QDialogButtonBox::StandardButton standardButton =
buttonBox->standardButton(button);
if (standardButton == QDialogButtonBox::Apply ||
standardButton == QDialogButtonBox::Ok) {
if (pluginWidget_->asyncSave())
pluginWidget_->setEnabled(false);
if (standardButton == QDialogButtonBox::Ok) {
closeAfterSave_ = true;
}
pluginWidget_->save();
if (!pluginWidget_->asyncSave())
saveFinished();
} else if (standardButton == QDialogButtonBox::Close) {
qApp->quit();
} else if (standardButton == QDialogButtonBox::Reset) {
pluginWidget_->load();
}
}
void MainWindow::saveFinished() {
if (proxy_) {
// Pass some arbitrary thing.
auto watcher = new QDBusPendingCallWatcher(
proxy_->SetConfig(path_, QDBusVariant(0)), this);
connect(watcher, &QDBusPendingCallWatcher::finished, this,
&MainWindow::saveFinishedPhase2);
} else {
saveFinishedPhase2(nullptr);
}
}
void MainWindow::saveFinishedPhase2(QDBusPendingCallWatcher *watcher) {
if (watcher) {
watcher->deleteLater();
}
if (pluginWidget_->asyncSave()) {
pluginWidget_->setEnabled(true);
}
if (!watcher || watcher->isError()) {
QMessageBox::warning(
this, _("Failed to notify Fcitx"),
_("Failed to notify Fcitx about the configuration change."));
closeAfterSave_ = false;
return;
}
if (closeAfterSave_) {
qApp->quit();
}
}
void MainWindow::saveSubConfig(const QString &path) {
if (proxy_) {
// Pass some arbitrary thing.
proxy_->SetConfig(path, QDBusVariant(0));
}
}
void MainWindow::changed(bool changed) {
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(changed);
buttonBox->button(QDialogButtonBox::Apply)->setEnabled(changed);
buttonBox->button(QDialogButtonBox::Reset)->setEnabled(changed);
}
void MainWindow::setParentWindow(WId id) { wid_ = id; }
void MainWindow::showEvent(QShowEvent *event) {
if (!wid_) {
return;
}
setAttribute(Qt::WA_NativeWindow, true);
QWindow *subWindow = windowHandle();
Q_ASSERT(subWindow);
QWindow *mainWindow = QWindow::fromWinId(wid_);
wid_ = 0;
if (!mainWindow) {
// foreign windows not supported on all platforms
return;
}
connect(this, &QObject::destroyed, mainWindow, &QObject::deleteLater);
subWindow->setTransientParent(mainWindow);
QDialog::showEvent(event);
}
} // namespace fcitx

View File

@@ -0,0 +1,53 @@
/*
* SPDX-FileCopyrightText: 2012~2012 CSSlayer <wengxt@gmail.com>
* SPDX-FileCopyrightText: 2017~2017 xzhao
* i@xuzhao.net
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#ifndef FCITX5QT_GUIWRAPPER_MAINWINDOW_H
#define FCITX5QT_GUIWRAPPER_MAINWINDOW_H
#include <QDialog>
#include "fcitxqtconfiguiwidget.h"
#include "ui_mainwindow.h"
#include <QDBusPendingCallWatcher>
namespace fcitx {
class FcitxQtControllerProxy;
class FcitxQtWatcher;
class MainWindow : public QDialog, public Ui::MainWindow {
Q_OBJECT
public:
explicit MainWindow(const QString &path,
FcitxQtConfigUIWidget *pluginWidget,
QWidget *parent = 0);
void setParentWindow(WId id);
public Q_SLOTS:
void changed(bool changed);
void clicked(QAbstractButton *button);
void availabilityChanged(bool avail);
void saveSubConfig(const QString &path);
protected:
void showEvent(QShowEvent *event) override;
private Q_SLOTS:
void saveFinished();
void saveFinishedPhase2(QDBusPendingCallWatcher *watcher);
private:
QString path_;
FcitxQtWatcher *watcher_;
FcitxQtConfigUIWidget *pluginWidget_;
FcitxQtControllerProxy *proxy_;
WId wid_ = 0;
bool closeAfterSave_ = false;
};
} // namespace fcitx
#endif // FCITXQT5_GUIWRAPPER_MAINWINDOW_H

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QWidget" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Apply|QDialogButtonBox::Close|QDialogButtonBox::Ok|QDialogButtonBox::Reset</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,9 @@
[Desktop Entry]
Name=Fcitx 5 Qt5 Gui Wrapper
GenericName=Input Method Configuration helper
Comment=Load configuration plugin for Fcitx Addon
Icon=fcitx
Exec=@CMAKE_INSTALL_FULL_LIBEXECDIR@/fcitx5-qt5-gui-wrapper
Type=Application
Categories=Settings;
NoDisplay=true

View File

@@ -0,0 +1,89 @@
/*
* SPDX-FileCopyrightText: 2012~2012 CSSlayer <wengxt@gmail.com>
* SPDX-FileCopyrightText: 2017~2017 xzhao <i@xuzhao.net>
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include <QDebug>
#include "fcitxqtconfiguifactory.h"
#include "mainwindow.h"
#include "wrapperapp.h"
#include <QCommandLineParser>
#include <QWindow>
#include <fcitx-utils/i18n.h>
#include <fcitx-utils/standardpath.h>
namespace fcitx {
WrapperApp::WrapperApp(int &argc, char **argv)
: QApplication(argc, argv), factory_(new FcitxQtConfigUIFactory(this)),
mainWindow_(0) {
setApplicationName(QLatin1String(
"fcitx5-qt" QT_STRINGIFY(QT_VERSION_MAJOR) "-gui-wrapper"));
setApplicationVersion(QLatin1String(FCITX5_QT_VERSION));
setOrganizationDomain("fcitx.org");
}
void WrapperApp::init() {
QCommandLineParser parser;
parser.setApplicationDescription(_("A launcher for Fcitx Gui plugin."));
parser.addHelpOption();
parser.addOptions({
{{"w", "winid"}, _("Parent window ID"), _("winid")},
{{"t", "test"}, _("Test if config exists")},
});
parser.addPositionalArgument(_("path"), _("Config path"));
parser.process(*this);
auto args = parser.positionalArguments();
if (args.empty()) {
qWarning("Missing path argument.");
::exit(1);
return;
}
QString path = args[0];
if (!path.startsWith("fcitx://config/addon/")) {
path.prepend("fcitx://config/addon/");
}
if (parser.isSet("test")) {
if (factory_->test(path)) {
::exit(0);
} else {
::exit(1);
}
} else {
WId winid = 0;
bool ok = false;
if (parser.isSet("winid")) {
winid = parser.value("winid").toLong(&ok, 0);
}
FcitxQtConfigUIWidget *widget = factory_->create(path);
if (!widget) {
qWarning("Could not find plugin for file.");
QMetaObject::invokeMethod(this, "errorExit", Qt::QueuedConnection);
return;
}
mainWindow_ = new MainWindow(path, widget);
if (ok && winid) {
mainWindow_->setParentWindow(winid);
}
QMetaObject::invokeMethod(this, "run", Qt::QueuedConnection);
}
}
void WrapperApp::run() {
mainWindow_->exec();
QMetaObject::invokeMethod(this, "quit", Qt::QueuedConnection);
}
WrapperApp::~WrapperApp() {
if (mainWindow_) {
delete mainWindow_;
}
}
void WrapperApp::errorExit() { exit(1); }
} // namespace fcitx

View File

@@ -0,0 +1,35 @@
/*
* SPDX-FileCopyrightText: 2012~2012 CSSlayer <wengxt@gmail.com>
* SPDX-FileCopyrightText: 2017~2017 xzhao <i@xuzhao.net>
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#ifndef _GUIWRAPPER_WRAPPERAPP_H_
#define _GUIWRAPPER_WRAPPERAPP_H_
#include "mainwindow.h"
#include <QApplication>
namespace fcitx {
class FcitxQtConfigUIFactory;
class WrapperApp : public QApplication {
Q_OBJECT
public:
WrapperApp(int &argc, char **argv);
virtual ~WrapperApp();
void init();
public Q_SLOTS:
void run();
private Q_SLOTS:
void errorExit();
private:
FcitxQtConfigUIFactory *factory_;
MainWindow *mainWindow_;
};
} // namespace fcitx
#endif // _GUIWRAPPER_WRAPPERAPP_H_

View File

@@ -0,0 +1,5 @@
add_executable(fcitx5-qt5-immodule-probing main.cpp)
target_include_directories(fcitx5-qt5-immodule-probing PRIVATE ${Qt5Gui_PRIVATE_INCLUDE_DIRS})
target_link_libraries(fcitx5-qt5-immodule-probing Qt5::Gui)
install(TARGETS fcitx5-qt5-immodule-probing DESTINATION "${CMAKE_INSTALL_BINDIR}")

View File

@@ -0,0 +1,29 @@
/*
* SPDX-FileCopyrightText: 2023~2023 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
*/
#include <QGuiApplication>
#include <iostream>
#include <private/qguiapplication_p.h>
#include <qpa/qplatforminputcontext.h>
#include <qpa/qplatforminputcontextfactory_p.h>
#include <qpa/qplatformintegration.h>
int main(int argc, char *argv[]) {
QGuiApplication app(argc, argv);
std::cout << "QT_QPA_PLATFORM=" << app.platformName().toStdString()
<< std::endl;
std::cout << "QT_IM_MODULE="
<< QPlatformInputContextFactory::requested().toStdString()
<< std::endl;
auto inputContext =
QGuiApplicationPrivate::platformIntegration()->inputContext();
std::cout << "IM_MODULE_CLASSNAME=";
if (inputContext) {
std::cout << inputContext->metaObject()->className();
}
std::cout << std::endl;
return 0;
}

View File

@@ -0,0 +1,57 @@
set(FCITX5_QT_EXTRA_PLUGIN_NAME "")
if (WITH_FCITX_PLUGIN_NAME)
set(FCITX5_QT_EXTRA_PLUGIN_NAME "\"fcitx\",")
endif()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/fcitx5.json.in" "${CMAKE_CURRENT_BINARY_DIR}/fcitx5.json")
set(plugin_SRCS
fcitx4watcher.cpp
fcitx4inputcontextproxy.cpp
fcitx4inputcontextproxyimpl.cpp
fcitx4inputmethodproxy.cpp
hybridinputcontext.cpp
qfcitxplatforminputcontext.cpp
fcitxcandidatewindow.cpp
fcitxtheme.cpp
font.cpp
qtkey.cpp
main.cpp
)
if (BUILD_ONLY_PLUGIN AND BUILD_STATIC_PLUGIN)
set(plugin_SRCS ${plugin_SRCS} $<TARGET_OBJECTS:Fcitx5Qt5DBusAddons>)
endif()
add_library(fcitx5platforminputcontextplugin ${PLUGIN_LIBRARY_TYPE} ${plugin_SRCS})
set_target_properties(fcitx5platforminputcontextplugin PROPERTIES
AUTOMOC TRUE
)
target_include_directories(fcitx5platforminputcontextplugin PRIVATE ${Qt5Gui_PRIVATE_INCLUDE_DIRS} "${PROJECT_SOURCE_DIR}/common")
if (BUILD_ONLY_PLUGIN AND BUILD_STATIC_PLUGIN)
target_compile_definitions(fcitx5platforminputcontextplugin PRIVATE "-DQT_STATICPLUGIN")
endif()
target_compile_definitions(fcitx5platforminputcontextplugin PRIVATE "-DFCITX_PLUGIN_DATA_FILE_PATH=\"${CMAKE_CURRENT_BINARY_DIR}/fcitx5.json\"")
if (WITH_FCITX_PLUGIN_NAME)
# This is not really necessary, but can trigger a cmake rebuild.
target_compile_definitions(fcitx5platforminputcontextplugin PRIVATE "-DFCITX5_QT_WITH_FCITX_NAME")
endif()
target_link_libraries(fcitx5platforminputcontextplugin
Qt5::Core
Qt5::Gui
Qt5::DBus
Qt5::Widgets
Fcitx5Qt5::DBusAddons
XKBCommon::XKBCommon
)
if (ENABLE_X11)
target_link_libraries(fcitx5platforminputcontextplugin XCB::XCB)
target_compile_definitions(fcitx5platforminputcontextplugin PRIVATE "-DENABLE_X11")
endif()
include(ECMQueryQmake)
query_qmake(_QT5PLUGINDIR QT_INSTALL_PLUGINS)
set(CMAKE_INSTALL_QT5PLUGINDIR ${_QT5PLUGINDIR} CACHE PATH "Qt5 plugin dir")
install(TARGETS fcitx5platforminputcontextplugin DESTINATION ${CMAKE_INSTALL_QT5PLUGINDIR}/platforminputcontexts)

View File

@@ -0,0 +1,86 @@
/*
* SPDX-FileCopyrightText: 2012~2023 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#include "fcitx4inputcontextproxy_p.h"
#include <QCoreApplication>
#include <QDBusConnectionInterface>
#include <QDBusInterface>
#include <QDBusMetaType>
#include <QFileInfo>
#include <QTimer>
namespace fcitx {
Fcitx4InputContextProxy::Fcitx4InputContextProxy(Fcitx4Watcher *watcher,
QObject *parent)
: QObject(parent),
d_ptr(new Fcitx4InputContextProxyPrivate(watcher, this)) {}
Fcitx4InputContextProxy::~Fcitx4InputContextProxy() { delete d_ptr; }
void Fcitx4InputContextProxy::setDisplay(const QString &display) {
Q_D(Fcitx4InputContextProxy);
d->display_ = display;
}
const QString &Fcitx4InputContextProxy::display() const {
Q_D(const Fcitx4InputContextProxy);
return d->display_;
}
bool Fcitx4InputContextProxy::isValid() const {
Q_D(const Fcitx4InputContextProxy);
return d->isValid();
}
QDBusPendingReply<> Fcitx4InputContextProxy::focusIn() {
Q_D(Fcitx4InputContextProxy);
return d->icproxy_->FocusIn();
}
QDBusPendingReply<> Fcitx4InputContextProxy::focusOut() {
Q_D(Fcitx4InputContextProxy);
return d->icproxy_->FocusOut();
}
QDBusPendingReply<int> Fcitx4InputContextProxy::processKeyEvent(
unsigned int keyval, unsigned int keycode, unsigned int state, int type,
unsigned int time) {
Q_D(Fcitx4InputContextProxy);
return d->icproxy_->ProcessKeyEvent(keyval, keycode, state, type, time);
}
QDBusPendingReply<> Fcitx4InputContextProxy::reset() {
Q_D(Fcitx4InputContextProxy);
return d->icproxy_->Reset();
}
QDBusPendingReply<> Fcitx4InputContextProxy::setCapability(unsigned int caps) {
Q_D(Fcitx4InputContextProxy);
return d->icproxy_->SetCapacity(caps);
}
QDBusPendingReply<> Fcitx4InputContextProxy::setCursorRect(int x, int y, int w,
int h) {
Q_D(Fcitx4InputContextProxy);
return d->icproxy_->SetCursorRect(x, y, w, h);
}
QDBusPendingReply<> Fcitx4InputContextProxy::setSurroundingText(
const QString &text, unsigned int cursor, unsigned int anchor) {
Q_D(Fcitx4InputContextProxy);
return d->icproxy_->SetSurroundingText(text, cursor, anchor);
}
QDBusPendingReply<>
Fcitx4InputContextProxy::setSurroundingTextPosition(unsigned int cursor,
unsigned int anchor) {
Q_D(Fcitx4InputContextProxy);
return d->icproxy_->SetSurroundingTextPosition(cursor, anchor);
}
} // namespace fcitx

View File

@@ -0,0 +1,67 @@
/*
* SPDX-FileCopyrightText: 2012~2023 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#ifndef _FCITX4INPUTCONTEXTPROXY_H_
#define _FCITX4INPUTCONTEXTPROXY_H_
#include "fcitxqtdbustypes.h"
#include <QDBusConnection>
#include <QDBusPendingReply>
#include <QDBusServiceWatcher>
#include <QObject>
class QDBusPendingCallWatcher;
namespace fcitx {
class Fcitx4Watcher;
class Fcitx4InputContextProxyPrivate;
class Fcitx4InputContextProxy : public QObject {
Q_OBJECT
public:
Fcitx4InputContextProxy(Fcitx4Watcher *watcher, QObject *parent);
~Fcitx4InputContextProxy();
bool isValid() const;
void setDisplay(const QString &display);
const QString &display() const;
public Q_SLOTS:
QDBusPendingReply<> focusIn();
QDBusPendingReply<> focusOut();
QDBusPendingReply<int> processKeyEvent(unsigned int keyval,
unsigned int keycode,
unsigned int state, int type,
unsigned int time);
QDBusPendingReply<> reset();
QDBusPendingReply<> setCapability(unsigned int caps);
QDBusPendingReply<> setCursorRect(int x, int y, int w, int h);
QDBusPendingReply<> setSurroundingText(const QString &text,
unsigned int cursor,
unsigned int anchor);
QDBusPendingReply<> setSurroundingTextPosition(unsigned int cursor,
unsigned int anchor);
Q_SIGNALS:
void commitString(const QString &str);
void currentIM(const QString &name, const QString &uniqueName,
const QString &langCode);
void deleteSurroundingText(int offset, unsigned int nchar);
void forwardKey(unsigned int keyval, unsigned int state, bool isRelease);
void updateFormattedPreedit(const FcitxQtFormattedPreeditList &str,
int cursorpos);
void inputContextCreated();
private:
Fcitx4InputContextProxyPrivate *const d_ptr;
Q_DECLARE_PRIVATE(Fcitx4InputContextProxy);
};
} // namespace fcitx
#endif // _FCITX4INPUTCONTEXTPROXY_H_

View File

@@ -0,0 +1,152 @@
/*
* SPDX-FileCopyrightText: 2012~2023 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#ifndef _FCITX4INPUTCONTEXTPROXY_P_H_
#define _FCITX4INPUTCONTEXTPROXY_P_H_
#include "fcitx4inputcontextproxy.h"
#include "fcitx4inputcontextproxyimpl.h"
#include "fcitx4inputmethodproxy.h"
#include "fcitx4watcher.h"
#include <QDBusServiceWatcher>
#include <cstddef>
#include <unistd.h>
namespace fcitx {
class Fcitx4InputContextProxyPrivate {
public:
Fcitx4InputContextProxyPrivate(Fcitx4Watcher *watcher,
Fcitx4InputContextProxy *q)
: q_ptr(q), fcitxWatcher_(watcher), watcher_(q) {
registerFcitxQtDBusTypes();
QObject::connect(fcitxWatcher_, &Fcitx4Watcher::availabilityChanged, q,
[this]() { availabilityChanged(); });
watcher_.setWatchMode(QDBusServiceWatcher::WatchForUnregistration);
QObject::connect(&watcher_, &QDBusServiceWatcher::serviceUnregistered,
q, [this]() {
cleanUp();
availabilityChanged();
});
availabilityChanged();
}
~Fcitx4InputContextProxyPrivate() {
if (isValid()) {
icproxy_->DestroyIC();
}
cleanUp();
}
bool isValid() const { return (icproxy_ && icproxy_->isValid()); }
void availabilityChanged() {
QTimer::singleShot(100, q_ptr, [this]() { recheck(); });
}
void recheck() {
if (!isValid() && fcitxWatcher_->availability()) {
createInputContext();
}
if (!fcitxWatcher_->availability()) {
cleanUp();
}
}
void cleanUp() {
auto services = watcher_.watchedServices();
for (const auto &service : services) {
watcher_.removeWatchedService(service);
}
delete improxy_;
improxy_ = nullptr;
delete icproxy_;
icproxy_ = nullptr;
delete createInputContextWatcher_;
createInputContextWatcher_ = nullptr;
}
void createInputContext() {
Q_Q(Fcitx4InputContextProxy);
if (!fcitxWatcher_->availability()) {
return;
}
cleanUp();
auto service = fcitxWatcher_->service();
auto connection = fcitxWatcher_->connection();
auto owner = connection.interface()->serviceOwner(service);
if (!owner.isValid()) {
return;
}
watcher_.setConnection(connection);
watcher_.setWatchedServices(QStringList() << owner);
// Avoid race, query again.
if (!connection.interface()->isServiceRegistered(owner)) {
cleanUp();
return;
}
QFileInfo info(QCoreApplication::applicationFilePath());
improxy_ =
new Fcitx4InputMethodProxy(owner, "/inputmethod", connection, q);
auto result = improxy_->CreateICv3(info.fileName(), getpid());
createInputContextWatcher_ = new QDBusPendingCallWatcher(result);
QObject::connect(createInputContextWatcher_,
&QDBusPendingCallWatcher::finished, q,
[this]() { createInputContextFinished(); });
}
void createInputContextFinished() {
Q_Q(Fcitx4InputContextProxy);
if (createInputContextWatcher_->isError()) {
cleanUp();
return;
}
QDBusPendingReply<int, bool, unsigned int, unsigned int, unsigned int,
unsigned int>
reply(*createInputContextWatcher_);
QString path = QString("/inputcontext_%1").arg(reply.value());
icproxy_ = new Fcitx4InputContextProxyImpl(improxy_->service(), path,
improxy_->connection(), q);
QObject::connect(icproxy_, &Fcitx4InputContextProxyImpl::CommitString,
q, &Fcitx4InputContextProxy::commitString);
QObject::connect(icproxy_, &Fcitx4InputContextProxyImpl::CurrentIM, q,
&Fcitx4InputContextProxy::currentIM);
QObject::connect(icproxy_,
&Fcitx4InputContextProxyImpl::DeleteSurroundingText, q,
&Fcitx4InputContextProxy::deleteSurroundingText);
QObject::connect(icproxy_, &Fcitx4InputContextProxyImpl::ForwardKey, q,
&Fcitx4InputContextProxy::forwardKey);
QObject::connect(icproxy_,
&Fcitx4InputContextProxyImpl::UpdateFormattedPreedit,
q, &Fcitx4InputContextProxy::updateFormattedPreedit);
delete createInputContextWatcher_;
createInputContextWatcher_ = nullptr;
Q_EMIT q->inputContextCreated();
}
Fcitx4InputContextProxy *q_ptr;
Q_DECLARE_PUBLIC(Fcitx4InputContextProxy);
Fcitx4Watcher *fcitxWatcher_;
QDBusServiceWatcher watcher_;
Fcitx4InputMethodProxy *improxy_ = nullptr;
Fcitx4InputContextProxyImpl *icproxy_ = nullptr;
QDBusPendingCallWatcher *createInputContextWatcher_ = nullptr;
QString display_;
};
} // namespace fcitx
#endif // _FCITX4INPUTCONTEXTPROXY_P_H_

View File

@@ -0,0 +1,30 @@
/*
* This file was generated by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp -N -p fcitx4inputcontextproxyimpl -c
* Fcitx4InputContextProxy org.fcitx.Fcitx.InputContext.xml
* org.fcitx.Fcitx.InputContext
*
* qdbusxml2cpp is Copyright (C) 2022 The Qt Company Ltd.
*
* This is an auto-generated file.
* This file may have been hand-edited. Look for HAND-EDIT comments
* before re-generating it.
*/
#include "fcitx4inputcontextproxyimpl.h"
namespace fcitx {
/*
* Implementation of interface class Fcitx4InputContextProxy
*/
Fcitx4InputContextProxyImpl::Fcitx4InputContextProxyImpl(
const QString &service, const QString &path,
const QDBusConnection &connection, QObject *parent)
: QDBusAbstractInterface(service, path, staticInterfaceName(), connection,
parent) {}
Fcitx4InputContextProxyImpl::~Fcitx4InputContextProxyImpl() {}
} // namespace fcitx

View File

@@ -0,0 +1,126 @@
/*
* This file was generated by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp -N -p fcitx4inputcontextproxyimpl -c
* Fcitx4InputContextProxyImpl org.fcitx.Fcitx.InputContext.xml
* org.fcitx.Fcitx.InputContext
*
* qdbusxml2cpp is Copyright (C) 2022 The Qt Company Ltd.
*
* This is an auto-generated file.
* Do not edit! All changes made to it will be lost.
*/
#ifndef FCITX4INPUTCONTEXTPROXYIMPL_H
#define FCITX4INPUTCONTEXTPROXYIMPL_H
#include "fcitxqtdbustypes.h"
#include <QtCore/QByteArray>
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QVariant>
#include <QtDBus/QtDBus>
namespace fcitx {
/*
* Proxy class for interface org.fcitx.Fcitx.InputContext
*/
class Fcitx4InputContextProxyImpl : public QDBusAbstractInterface {
Q_OBJECT
public:
static inline const char *staticInterfaceName() {
return "org.fcitx.Fcitx.InputContext";
}
public:
Fcitx4InputContextProxyImpl(const QString &service, const QString &path,
const QDBusConnection &connection,
QObject *parent = nullptr);
~Fcitx4InputContextProxyImpl();
public Q_SLOTS: // METHODS
inline QDBusPendingReply<> DestroyIC() {
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("DestroyIC"),
argumentList);
}
inline QDBusPendingReply<> FocusIn() {
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("FocusIn"),
argumentList);
}
inline QDBusPendingReply<> FocusOut() {
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("FocusOut"),
argumentList);
}
inline QDBusPendingReply<int> ProcessKeyEvent(unsigned int keyval,
unsigned int keycode,
unsigned int state, int type,
unsigned int time) {
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(keyval)
<< QVariant::fromValue(keycode)
<< QVariant::fromValue(state) << QVariant::fromValue(type)
<< QVariant::fromValue(time);
return asyncCallWithArgumentList(QStringLiteral("ProcessKeyEvent"),
argumentList);
}
inline QDBusPendingReply<> Reset() {
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("Reset"), argumentList);
}
inline QDBusPendingReply<> SetCapacity(unsigned int caps) {
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(caps);
return asyncCallWithArgumentList(QStringLiteral("SetCapacity"),
argumentList);
}
inline QDBusPendingReply<> SetCursorRect(int x, int y, int w, int h) {
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(x) << QVariant::fromValue(y)
<< QVariant::fromValue(w) << QVariant::fromValue(h);
return asyncCallWithArgumentList(QStringLiteral("SetCursorRect"),
argumentList);
}
inline QDBusPendingReply<> SetSurroundingText(const QString &text,
unsigned int cursor,
unsigned int anchor) {
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(text) << QVariant::fromValue(cursor)
<< QVariant::fromValue(anchor);
return asyncCallWithArgumentList(QStringLiteral("SetSurroundingText"),
argumentList);
}
inline QDBusPendingReply<> SetSurroundingTextPosition(unsigned int cursor,
unsigned int anchor) {
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(cursor)
<< QVariant::fromValue(anchor);
return asyncCallWithArgumentList(
QStringLiteral("SetSurroundingTextPosition"), argumentList);
}
Q_SIGNALS: // SIGNALS
void CommitString(const QString &str);
void CurrentIM(const QString &name, const QString &uniqueName,
const QString &langCode);
void DeleteSurroundingText(int offset, unsigned int nchar);
void ForwardKey(unsigned int keyval, unsigned int state, int type);
void UpdateFormattedPreedit(FcitxQtFormattedPreeditList str, int cursorpos);
};
} // namespace fcitx
#endif

View File

@@ -0,0 +1,29 @@
/*
* This file was generated by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp -N -p fcitx4inputmethodproxy -c
* Fcitx4InputMethodProxy org.fcitx.Fcitx.InputMethod.xml
* org.fcitx.Fcitx.InputMethod
*
* qdbusxml2cpp is Copyright (C) 2022 The Qt Company Ltd.
*
* This is an auto-generated file.
* This file may have been hand-edited. Look for HAND-EDIT comments
* before re-generating it.
*/
#include "fcitx4inputmethodproxy.h"
namespace fcitx {
/*
* Implementation of interface class Fcitx4InputMethodProxy
*/
Fcitx4InputMethodProxy::Fcitx4InputMethodProxy(
const QString &service, const QString &path,
const QDBusConnection &connection, QObject *parent)
: QDBusAbstractInterface(service, path, staticInterfaceName(), connection,
parent) {}
Fcitx4InputMethodProxy::~Fcitx4InputMethodProxy() {}
} // namespace fcitx

View File

@@ -0,0 +1,80 @@
/*
* This file was generated by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp -N -p fcitx4inputmethodproxy -c
* Fcitx4InputMethodProxy org.fcitx.Fcitx.InputMethod.xml
* org.fcitx.Fcitx.InputMethod
*
* qdbusxml2cpp is Copyright (C) 2022 The Qt Company Ltd.
*
* This is an auto-generated file.
* Do not edit! All changes made to it will be lost.
*/
#ifndef FCITX4INPUTMETHODPROXY_H
#define FCITX4INPUTMETHODPROXY_H
#include <QtCore/QByteArray>
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QVariant>
#include <QtDBus/QtDBus>
namespace fcitx {
/*
* Proxy class for interface org.fcitx.Fcitx.InputMethod
*/
class Fcitx4InputMethodProxy : public QDBusAbstractInterface {
Q_OBJECT
public:
static inline const char *staticInterfaceName() {
return "org.fcitx.Fcitx.InputMethod";
}
public:
Fcitx4InputMethodProxy(const QString &service, const QString &path,
const QDBusConnection &connection,
QObject *parent = nullptr);
~Fcitx4InputMethodProxy();
public Q_SLOTS: // METHODS
inline QDBusPendingReply<int, bool, unsigned int, unsigned int,
unsigned int, unsigned int>
CreateICv3(const QString &appname, int pid) {
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(appname)
<< QVariant::fromValue(pid);
return asyncCallWithArgumentList(QStringLiteral("CreateICv3"),
argumentList);
}
inline QDBusReply<int> CreateICv3(const QString &appname, int pid,
bool &enable, unsigned int &keyval1,
unsigned int &state1,
unsigned int &keyval2,
unsigned int &state2) {
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(appname)
<< QVariant::fromValue(pid);
QDBusMessage reply = callWithArgumentList(
QDBus::Block, QStringLiteral("CreateICv3"), argumentList);
if (reply.type() == QDBusMessage::ReplyMessage &&
reply.arguments().count() == 6) {
enable = qdbus_cast<bool>(reply.arguments().at(1));
keyval1 = qdbus_cast<unsigned int>(reply.arguments().at(2));
state1 = qdbus_cast<unsigned int>(reply.arguments().at(3));
keyval2 = qdbus_cast<unsigned int>(reply.arguments().at(4));
state2 = qdbus_cast<unsigned int>(reply.arguments().at(5));
}
return reply;
}
Q_SIGNALS: // SIGNALS
};
} // namespace fcitx
#endif

View File

@@ -0,0 +1,267 @@
/*
* SPDX-FileCopyrightText: 2011~2023 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#include "fcitx4watcher.h"
#include <QDBusConnection>
#include <QDBusConnectionInterface>
#include <QDBusServiceWatcher>
#include <QDebug>
#include <QDir>
#include <QFileSystemWatcher>
#include <errno.h>
#include <signal.h>
#include <unistd.h>
// utils function in fcitx-utils and fcitx-config
bool _pid_exists(pid_t pid) {
if (pid <= 0)
return 0;
return !(kill(pid, 0) && (errno == ESRCH));
}
int displayNumber() {
QByteArray display(qgetenv("DISPLAY"));
QByteArray displayNumber("0");
int pos = display.indexOf(':');
if (pos >= 0) {
++pos;
int pos2 = display.indexOf('.', pos);
if (pos2 > 0) {
displayNumber = display.mid(pos, pos2 - pos);
} else {
displayNumber = display.mid(pos);
}
}
bool ok;
int d = displayNumber.toInt(&ok);
if (ok) {
return d;
}
return 0;
}
QString socketFile() {
QString filename =
QString("%1-%2")
.arg(QString::fromLatin1(QDBusConnection::localMachineId()))
.arg(displayNumber());
QString home = QString::fromLocal8Bit(qgetenv("XDG_CONFIG_HOME"));
if (home.isEmpty()) {
home = QDir::homePath().append(QLatin1String("/.config"));
}
return QString("%1/fcitx/dbus/%2").arg(home).arg(filename);
}
namespace fcitx {
QString newUniqueConnectionName() {
static int idx = 0;
const auto newIdx = idx++;
return QString("_fcitx4_%1").arg(newIdx);
}
Fcitx4Watcher::Fcitx4Watcher(QDBusConnection sessionBus, QObject *parent)
: QObject(parent), connection_(nullptr), sessionBus_(sessionBus),
socketFile_(socketFile()),
serviceName_(QString("org.fcitx.Fcitx-%1").arg(displayNumber())),
availability_(false), uniqueConnectionName_(newUniqueConnectionName()) {}
Fcitx4Watcher::~Fcitx4Watcher() {
cleanUpConnection();
unwatchSocketFile();
}
bool Fcitx4Watcher::availability() const { return availability_; }
QDBusConnection Fcitx4Watcher::connection() const {
if (connection_) {
return *connection_;
}
return sessionBus_;
}
QString Fcitx4Watcher::service() const {
if (connection_) {
return serviceName_;
}
if (mainPresent_) {
return serviceName_;
}
return QString();
}
void Fcitx4Watcher::setAvailability(bool availability) {
if (availability_ != availability) {
availability_ = availability;
Q_EMIT availabilityChanged(availability_);
}
}
void Fcitx4Watcher::watch() {
if (watched_) {
return;
}
serviceWatcher_ = new QDBusServiceWatcher(this);
connect(serviceWatcher_, &QDBusServiceWatcher::serviceOwnerChanged, this,
&Fcitx4Watcher::imChanged);
serviceWatcher_->setConnection(sessionBus_);
serviceWatcher_->addWatchedService(serviceName_);
if (sessionBus_.interface()->isServiceRegistered(serviceName_)) {
mainPresent_ = true;
}
watchSocketFile();
createConnection();
updateAvailability();
watched_ = true;
}
void Fcitx4Watcher::unwatch() {
if (!watched_) {
return;
}
delete serviceWatcher_;
serviceWatcher_ = nullptr;
unwatchSocketFile();
cleanUpConnection();
mainPresent_ = false;
watched_ = false;
updateAvailability();
}
QString Fcitx4Watcher::address() {
QString addr;
QByteArray addrVar = qgetenv("FCITX_DBUS_ADDRESS");
if (!addrVar.isNull())
return QString::fromLocal8Bit(addrVar);
QFile file(socketFile_);
if (!file.open(QIODevice::ReadOnly))
return QString();
const int BUFSIZE = 1024;
char buffer[BUFSIZE];
size_t sz = file.read(buffer, BUFSIZE);
file.close();
if (sz == 0)
return QString();
char *p = buffer;
while (*p)
p++;
size_t addrlen = p - buffer;
if (sz != addrlen + 2 * sizeof(pid_t) + 1)
return QString();
/* skip '\0' */
p++;
pid_t *ppid = (pid_t *)p;
pid_t daemonpid = ppid[0];
pid_t fcitxpid = ppid[1];
if (!_pid_exists(daemonpid) || !_pid_exists(fcitxpid))
return QString();
addr = QLatin1String(buffer);
return addr;
}
void Fcitx4Watcher::cleanUpConnection() {
QDBusConnection::disconnectFromBus(uniqueConnectionName_);
delete connection_;
connection_ = nullptr;
}
void Fcitx4Watcher::socketFileChanged() {
cleanUpConnection();
createConnection();
}
void Fcitx4Watcher::createConnection() {
QString addr = address();
if (!addr.isNull()) {
QDBusConnection connection(
QDBusConnection::connectToBus(addr, uniqueConnectionName_));
if (connection.isConnected()) {
connection_ = new QDBusConnection(connection);
} else {
QDBusConnection::disconnectFromBus(uniqueConnectionName_);
}
}
if (connection_) {
connection_->connect("org.freedesktop.DBus.Local",
"/org/freedesktop/DBus/Local",
"org.freedesktop.DBus.Local", "Disconnected", this,
SLOT(dbusDisconnected()));
unwatchSocketFile();
}
updateAvailability();
}
void Fcitx4Watcher::dbusDisconnected() {
cleanUpConnection();
watchSocketFile();
// Try recreation immediately to avoid race.
createConnection();
}
void Fcitx4Watcher::watchSocketFile() {
if (socketFile_.isEmpty()) {
return;
}
QFileInfo info(socketFile_);
QDir dir(info.path());
if (!dir.exists()) {
QDir rt(QDir::root());
rt.mkpath(info.path());
}
fsWatcher_ = new QFileSystemWatcher(this);
fsWatcher_->addPath(info.path());
if (info.exists()) {
fsWatcher_->addPath(info.filePath());
}
connect(fsWatcher_, &QFileSystemWatcher::fileChanged, this,
&Fcitx4Watcher::socketFileChanged);
connect(fsWatcher_, &QFileSystemWatcher::directoryChanged, this,
&Fcitx4Watcher::socketFileChanged);
}
void Fcitx4Watcher::unwatchSocketFile() {
if (fsWatcher_) {
fsWatcher_->disconnect(this);
fsWatcher_->deleteLater();
fsWatcher_ = nullptr;
}
}
void Fcitx4Watcher::imChanged(const QString &service, const QString &,
const QString &newOwner) {
if (service == serviceName_) {
if (!newOwner.isEmpty()) {
mainPresent_ = true;
} else {
mainPresent_ = false;
}
}
updateAvailability();
}
void Fcitx4Watcher::updateAvailability() {
setAvailability(mainPresent_ || connection_);
}
} // namespace fcitx

View File

@@ -0,0 +1,68 @@
/*
* SPDX-FileCopyrightText: 2011~2023 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#ifndef FCITXWATCHER_H_
#define FCITXWATCHER_H_
#include <QDBusConnection>
#include <QObject>
class QFileSystemWatcher;
class QDBusServiceWatcher;
namespace fcitx {
// A FcitxQtConnection replacement, to implement compatibility with fcitx 5.
// Since we have three thing to monitor, the situation becomes much more
// complexer.
class Fcitx4Watcher : public QObject {
Q_OBJECT
public:
explicit Fcitx4Watcher(QDBusConnection sessionBus,
QObject *parent = nullptr);
~Fcitx4Watcher();
void watch();
void unwatch();
bool availability() const;
QDBusConnection connection() const;
QString service() const;
Q_SIGNALS:
void availabilityChanged(bool);
private Q_SLOTS:
void dbusDisconnected();
void socketFileChanged();
void imChanged(const QString &service, const QString &oldOwner,
const QString &newOwner);
private:
QString address();
void watchSocketFile();
void unwatchSocketFile();
void createConnection();
void cleanUpConnection();
void setAvailability(bool availability);
void updateAvailability();
QFileSystemWatcher *fsWatcher_ = nullptr;
QDBusServiceWatcher *serviceWatcher_ = nullptr;
QDBusConnection *connection_;
QDBusConnection sessionBus_;
QString socketFile_;
QString serviceName_;
bool availability_ = false;
bool mainPresent_ = false;
bool watched_ = false;
QString uniqueConnectionName_;
};
} // namespace fcitx
#endif // FCITXWATCHER_H_

View File

@@ -0,0 +1,6 @@
{
"Keys": [
@FCITX5_QT_EXTRA_PLUGIN_NAME@
"fcitx5"
]
}

View File

@@ -0,0 +1,791 @@
/*
* SPDX-FileCopyrightText: 2021~2021 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#include "fcitxcandidatewindow.h"
#include "fcitxflags.h"
#include "fcitxtheme.h"
#include "qfcitxplatforminputcontext.h"
#include <QDebug>
#include <QExposeEvent>
#include <QFont>
#include <QGuiApplication>
#include <QMouseEvent>
#include <QPalette>
#include <QResizeEvent>
#include <QScreen>
#include <QTextLayout>
#include <QVariant>
#include <QtMath>
#include <utility>
#if defined(FCITX_ENABLE_QT6_WAYLAND_WORKAROUND) && \
QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)
#include <QtGui/private/qhighdpiscaling_p.h>
#include <QtWaylandClient/private/qwayland-xdg-shell.h>
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
#include <QtWaylandClient/private/qwaylandintegration_p.h>
#include <QtWaylandClient/private/qwaylandwindow_p.h>
#include <QtWaylandClient/private/wayland-xdg-shell-client-protocol.h>
#include <qpa/qplatformnativeinterface.h>
#endif
namespace fcitx {
namespace {
#if defined(FCITX_ENABLE_QT6_WAYLAND_WORKAROUND) && \
QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)
class XdgWmBase : public QtWayland::xdg_wm_base {
public:
using xdg_wm_base::xdg_wm_base;
protected:
// This is required for all xdg_wm_base bind.
void xdg_wm_base_ping(uint32_t serial) override { pong(serial); }
};
#endif
void doLayout(QTextLayout &layout) {
QFontMetrics fontMetrics(layout.font());
auto minH = fontMetrics.ascent() + fontMetrics.descent();
layout.setCacheEnabled(true);
layout.beginLayout();
int height = 0;
while (1) {
QTextLine line = layout.createLine();
if (!line.isValid())
break;
line.setLineWidth(INT_MAX);
line.setLeadingIncluded(true);
line.setPosition(
QPoint(0, height - line.ascent() + fontMetrics.ascent()));
height += minH;
}
layout.endLayout();
}
} // namespace
class MultilineText {
public:
MultilineText(const QFont &font, const QString &text) {
QStringList lines = text.split("\n");
int width = 0;
QFontMetrics fontMetrics(font);
fontHeight_ = fontMetrics.ascent() + fontMetrics.descent();
for (const auto &line : lines) {
layouts_.emplace_back(std::make_unique<QTextLayout>(line));
layouts_.back()->setFont(font);
doLayout(*layouts_.back());
width = std::max(width,
layouts_.back()->boundingRect().toRect().width());
}
boundingRect_.setTopLeft(QPoint(0, 0));
boundingRect_.setSize(QSize(width, lines.size() * fontHeight_));
}
bool isEmpty() const { return layouts_.empty(); }
void draw(QPainter *painter, QColor color, QPoint position) {
painter->save();
painter->setPen(color);
int currentY = 0;
for (const auto &layout : layouts_) {
layout->draw(painter, position + QPoint(0, currentY));
currentY += fontHeight_;
}
painter->restore();
}
QRect boundingRect() { return boundingRect_; }
private:
std::vector<std::unique_ptr<QTextLayout>> layouts_;
int fontHeight_;
QRect boundingRect_;
};
FcitxCandidateWindow::FcitxCandidateWindow(QWindow *window,
QFcitxPlatformInputContext *context)
: QRasterWindow(), context_(context), theme_(context->theme()),
parent_(window) {
constexpr Qt::WindowFlags commonFlags = Qt::FramelessWindowHint |
Qt::WindowDoesNotAcceptFocus |
Qt::NoDropShadowWindowHint;
if (isWayland_) {
// Qt::ToolTip ensures wayland doesn't grab focus.
// Not using Qt::BypassWindowManagerHint ensures wayland handle
// fractional scale.
setFlags(Qt::ToolTip | commonFlags);
#if defined(FCITX_ENABLE_QT6_WAYLAND_WORKAROUND) && \
QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)
if (auto instance = QtWaylandClient::QWaylandIntegration::instance()) {
for (QtWaylandClient::QWaylandDisplay::RegistryGlobal global :
instance->display()->globals()) {
if (global.interface == QLatin1String("xdg_wm_base")) {
xdgWmBase_.reset(
new XdgWmBase(instance->display()->wl_registry(),
global.id, global.version));
break;
}
}
}
setProperty("_q_waylandPopupAnchor",
QVariant::fromValue(Qt::BottomEdge | Qt::LeftEdge));
setProperty("_q_waylandPopupGravity",
QVariant::fromValue(Qt::BottomEdge | Qt::RightEdge));
setProperty(
"_q_waylandPopupConstraintAdjustment",
static_cast<unsigned int>(
QtWayland::xdg_positioner::constraint_adjustment_slide_x |
QtWayland::xdg_positioner::constraint_adjustment_flip_y));
#endif
} else {
// Qt::Popup ensures X11 doesn't apply tooltip animation under kwin.
setFlags(Qt::Popup | Qt::BypassWindowManagerHint | commonFlags);
}
if (isWayland_) {
setTransientParent(parent_);
}
QSurfaceFormat surfaceFormat = format();
surfaceFormat.setAlphaBufferSize(8);
setFormat(surfaceFormat);
connect(this, &QWindow::visibleChanged, this, [this] { hoverIndex_ = -1; });
}
FcitxCandidateWindow::~FcitxCandidateWindow() {}
bool FcitxCandidateWindow::event(QEvent *event) {
if (event->type() == QEvent::Leave) {
auto oldHighlight = highlight();
hoverIndex_ = -1;
if (highlight() != oldHighlight) {
update();
}
}
return QRasterWindow::event(event);
}
void FcitxCandidateWindow::render(QPainter *painter) {
theme_->paint(painter, theme_->background(),
QRect(QPoint(0, 0), actualSize_));
auto contentMargin = theme_->contentMargin();
const QPoint topLeft(contentMargin.left(), contentMargin.top());
painter->setPen(theme_->normalColor());
auto minH =
theme_->fontMetrics().ascent() + theme_->fontMetrics().descent();
auto textMargin = theme_->textMargin();
auto extraW = textMargin.left() + textMargin.right();
auto extraH = textMargin.top() + textMargin.bottom();
size_t currentHeight = 0;
if (!upperLayout_.text().isEmpty()) {
upperLayout_.draw(
painter, topLeft + QPoint(textMargin.left(), textMargin.top()));
// Draw cursor
currentHeight += minH + extraH;
if (cursor_ >= 0) {
auto line = upperLayout_.lineForTextPosition(cursor_);
if (line.isValid()) {
int cursorX = line.cursorToX(cursor_);
line.lineNumber();
painter->save();
QPen pen = painter->pen();
pen.setWidth(2);
painter->setPen(pen);
QPoint start = topLeft + QPoint(textMargin.left() + cursorX + 1,
textMargin.top() +
line.lineNumber() * minH);
painter->drawLine(start, start + QPoint(0, minH));
painter->restore();
}
}
}
if (!lowerLayout_.text().isEmpty()) {
lowerLayout_.draw(painter,
topLeft + QPoint(textMargin.left(),
textMargin.top() + currentHeight));
currentHeight += minH + extraH;
}
bool vertical = theme_->vertical();
if (layoutHint_ == FcitxCandidateLayoutHint::Vertical) {
vertical = true;
} else if (layoutHint_ == FcitxCandidateLayoutHint::Horizontal) {
vertical = false;
}
candidateRegions_.clear();
candidateRegions_.reserve(labelLayouts_.size());
size_t wholeW = 0, wholeH = 0;
// size of text = textMargin + actual text size.
// HighLight = HighLight margin + TEXT.
// Click region = HighLight - click
for (size_t i = 0; i < labelLayouts_.size(); i++) {
int x, y;
if (vertical) {
x = 0;
y = currentHeight + wholeH;
} else {
x = wholeW;
y = currentHeight;
}
x += textMargin.left();
y += textMargin.top();
int labelW = 0, labelH = 0, candidateW = 0, candidateH = 0;
if (!labelLayouts_[i]->isEmpty()) {
auto size = labelLayouts_[i]->boundingRect();
labelW = size.width();
labelH = size.height();
}
if (!candidateLayouts_[i]->isEmpty()) {
auto size = candidateLayouts_[i]->boundingRect();
candidateW = size.width();
candidateH = size.height();
}
int vheight;
if (vertical) {
vheight = std::max({minH, labelH, candidateH});
wholeH += vheight + extraH;
} else {
vheight = candidatesHeight_ - extraH;
wholeW += candidateW + labelW + extraW;
}
QMargins highlightMargin = theme_->highlightMargin();
QMargins clickMargin = theme_->highlightClickMargin();
auto highlightWidth = labelW + candidateW;
bool fullWidthHighlight = true;
if (fullWidthHighlight && vertical) {
// Last candidate, fill.
highlightWidth = actualSize_.width() - contentMargin.left() -
contentMargin.right() - textMargin.left() -
textMargin.right();
}
const int highlightIndex = highlight();
QColor color = theme_->normalColor();
if (highlightIndex >= 0 && i == static_cast<size_t>(highlightIndex)) {
// Paint highlight
theme_->paint(
painter, theme_->highlight(),
QRect(topLeft + QPoint(x, y) -
QPoint(highlightMargin.left(), highlightMargin.top()),
QSize(highlightWidth + highlightMargin.left() +
highlightMargin.right(),
vheight + highlightMargin.top() +
highlightMargin.bottom())));
color = theme_->highlightCandidateColor();
}
QRect candidateRegion(
topLeft + QPoint(x, y) -
QPoint(highlightMargin.left(), highlightMargin.right()) +
QPoint(clickMargin.left(), clickMargin.right()),
QSize(highlightWidth + highlightMargin.left() +
highlightMargin.right() - clickMargin.left() -
clickMargin.right(),
vheight + highlightMargin.top() + highlightMargin.bottom() -
clickMargin.top() - clickMargin.bottom()));
candidateRegions_.push_back(candidateRegion);
if (!labelLayouts_[i]->isEmpty()) {
labelLayouts_[i]->draw(painter, color, topLeft + QPoint(x, y));
}
if (!candidateLayouts_[i]->isEmpty()) {
candidateLayouts_[i]->draw(painter, color,
topLeft + QPoint(x + labelW, y));
}
}
prevRegion_ = QRect();
nextRegion_ = QRect();
if (labelLayouts_.size() && (hasPrev_ || hasNext_)) {
if (theme_->prev().valid() && theme_->next().valid()) {
int prevY = 0, nextY = 0;
if (theme_->buttonAlignment() == "Top") {
prevY = contentMargin.top();
nextY = contentMargin.top();
} else if (theme_->buttonAlignment() == "First Candidate") {
prevY = candidateRegions_.front().top() +
(candidateRegions_.front().height() -
theme_->prev().height()) /
2.0;
nextY = candidateRegions_.front().top() +
(candidateRegions_.front().height() -
theme_->next().height()) /
2.0;
} else if (theme_->buttonAlignment() == "Center") {
prevY = contentMargin.top() +
(actualSize_.height() - contentMargin.top() -
contentMargin.bottom() - theme_->prev().height()) /
2.0;
nextY = contentMargin.top() +
(actualSize_.height() - contentMargin.top() -
contentMargin.bottom() - theme_->next().height()) /
2.0;
} else if (theme_->buttonAlignment() == "Last Candidate") {
prevY = candidateRegions_.back().top() +
(candidateRegions_.back().height() -
theme_->prev().height()) /
2.0;
nextY = candidateRegions_.back().top() +
(candidateRegions_.back().height() -
theme_->next().height()) /
2.0;
} else {
prevY = actualSize_.height() - contentMargin.bottom() -
theme_->prev().height();
nextY = actualSize_.height() - contentMargin.bottom() -
theme_->next().height();
}
nextRegion_ =
QRect(QPoint(actualSize_.width() - contentMargin.right() -
theme_->prev().width(),
nextY),
theme_->next().size());
double alpha = 1.0;
if (!hasNext_) {
alpha = 0.3;
} else if (nextHovered_) {
alpha = 0.7;
}
theme_->paint(painter, theme_->next(), nextRegion_.topLeft(),
alpha);
nextRegion_ = nextRegion_.marginsRemoved(theme_->next().margin());
prevRegion_ = QRect(
QPoint(actualSize_.width() - contentMargin.right() -
theme_->next().width() - theme_->prev().width(),
prevY),
theme_->prev().size());
alpha = 1.0;
if (!hasPrev_) {
alpha = 0.3;
} else if (prevHovered_) {
alpha = 0.7;
}
theme_->paint(painter, theme_->prev(), prevRegion_.topLeft(),
alpha);
prevRegion_ = prevRegion_.marginsRemoved(theme_->prev().margin());
}
}
}
void UpdateLayout(QTextLayout &layout, const FcitxTheme &theme,
std::initializer_list<
std::reference_wrapper<const FcitxQtFormattedPreeditList>>
texts) {
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
layout.clearFormats();
#endif
layout.setFont(theme.font());
QVector<QTextLayout::FormatRange> formats;
QString str;
int pos = 0;
for (const auto &text : texts) {
for (const auto &preedit : text.get()) {
str += preedit.string();
QTextCharFormat format;
if (preedit.format() & FcitxTextFormatFlag_Underline) {
format.setUnderlineStyle(QTextCharFormat::DashUnderline);
}
if (preedit.format() & FcitxTextFormatFlag_Strike) {
format.setFontStrikeOut(true);
}
if (preedit.format() & FcitxTextFormatFlag_Bold) {
format.setFontWeight(QFont::Bold);
}
if (preedit.format() & FcitxTextFormatFlag_Italic) {
format.setFontItalic(true);
}
if (preedit.format() & FcitxTextFormatFlag_HighLight) {
format.setBackground(theme.highlightBackgroundColor());
format.setForeground(theme.highlightColor());
}
formats.append(QTextLayout::FormatRange{
pos, static_cast<int>(preedit.string().length()), format});
pos += preedit.string().length();
}
}
layout.setText(str);
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
layout.setFormats(formats);
#endif
}
void FcitxCandidateWindow::updateClientSideUI(
const FcitxQtFormattedPreeditList &preedit, int cursorpos,
const FcitxQtFormattedPreeditList &auxUp,
const FcitxQtFormattedPreeditList &auxDown,
const FcitxQtStringKeyValueList &candidates, int candidateIndex,
int layoutHint, bool hasPrev, bool hasNext) {
bool preeditVisible = !preedit.isEmpty();
bool auxUpVisbile = !auxUp.isEmpty();
bool auxDownVisible = !auxDown.isEmpty();
bool candidatesVisible = !candidates.isEmpty();
bool visible =
preeditVisible || auxUpVisbile || auxDownVisible || candidatesVisible;
auto window = context_->focusWindowWrapper();
if (!theme_ || !visible || !window || window != parent_) {
hide();
return;
}
UpdateLayout(upperLayout_, *theme_, {auxUp, preedit});
if (cursorpos >= 0) {
int auxUpLength = 0;
for (const auto &auxUpText : auxUp) {
auxUpLength += auxUpText.string().length();
}
// Get the preedit part
auto preeditString = upperLayout_.text().mid(auxUpLength).toUtf8();
preeditString = preeditString.mid(0, cursorpos);
cursor_ = auxUpLength + QString::fromUtf8(preeditString).length();
} else {
cursor_ = -1;
}
doLayout(upperLayout_);
UpdateLayout(lowerLayout_, *theme_, {auxDown});
doLayout(lowerLayout_);
labelLayouts_.clear();
candidateLayouts_.clear();
for (int i = 0; i < candidates.size(); i++) {
labelLayouts_.emplace_back(std::make_unique<MultilineText>(
theme_->font(), candidates[i].key()));
candidateLayouts_.emplace_back(std::make_unique<MultilineText>(
theme_->font(), candidates[i].value()));
}
highlight_ = candidateIndex;
hasPrev_ = hasPrev;
hasNext_ = hasNext;
layoutHint_ = static_cast<FcitxCandidateLayoutHint>(layoutHint);
actualSize_ = sizeHint();
if (actualSize_.width() <= 0 || actualSize_.height() <= 0) {
hide();
return;
}
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QSize sizeWithoutShadow = actualSize_.shrunkBy(theme_->shadowMargin());
#else
QSize sizeWithoutShadow =
actualSize_ -
QSize(theme_->shadowMargin().left() + theme_->shadowMargin().right(),
theme_->shadowMargin().top() + theme_->shadowMargin().bottom());
#endif
if (sizeWithoutShadow.width() < 0) {
sizeWithoutShadow.setWidth(0);
}
if (sizeWithoutShadow.height() < 0) {
sizeWithoutShadow.setHeight(0);
}
if (size() != actualSize_) {
resize(actualSize_);
}
update();
QRect cursorRect = context_->cursorRectangleWrapper();
QRect screenGeometry;
#if defined(FCITX_ENABLE_QT6_WAYLAND_WORKAROUND) && \
QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)
if (isWayland_) {
auto *waylandWindow =
static_cast<QtWaylandClient::QWaylandWindow *>(window->handle());
const auto windowMargins = waylandWindow->windowContentMargins() -
waylandWindow->clientSideMargins();
auto windowGeometry = waylandWindow->windowContentGeometry();
if (!cursorRect.isValid()) {
if (cursorRect.width() <= 0) {
cursorRect.setWidth(1);
}
if (cursorRect.height() <= 0) {
cursorRect.setHeight(1);
}
}
QRect nativeCursorRect = QHighDpi::toNativePixels(cursorRect, this);
// valid the anchor rect.
if (!nativeCursorRect.intersects(windowGeometry)) {
if (nativeCursorRect.right() < windowGeometry.left()) {
nativeCursorRect.setLeft(windowGeometry.left());
nativeCursorRect.setWidth(1);
}
if (nativeCursorRect.left() > windowGeometry.right()) {
nativeCursorRect.setLeft(windowGeometry.right());
nativeCursorRect.setWidth(1);
}
if (nativeCursorRect.bottom() < windowGeometry.top()) {
nativeCursorRect.setTop(windowGeometry.top());
nativeCursorRect.setHeight(1);
}
if (nativeCursorRect.top() > windowGeometry.bottom()) {
nativeCursorRect.setTop(windowGeometry.bottom());
nativeCursorRect.setHeight(1);
}
}
bool wasVisible = isVisible();
bool cursorRectChanged = false;
if (property("_q_waylandPopupAnchorRect") != nativeCursorRect) {
cursorRectChanged = true;
setProperty("_q_waylandPopupAnchorRect", nativeCursorRect);
}
// This try to ensure xdg_popup is available.
show();
xdg_popup *xdgPopup = static_cast<xdg_popup *>(
QGuiApplication::platformNativeInterface()->nativeResourceForWindow(
"xdg_popup", this));
if (xdgWmBase_ && xdgPopup &&
xdg_popup_get_version(xdgPopup) >=
XDG_POPUP_REPOSITION_SINCE_VERSION) {
nativeCursorRect.translate(-windowMargins.left(),
-windowMargins.top());
auto *positioner =
new QtWayland::xdg_positioner(xdgWmBase_->create_positioner());
positioner->set_anchor_rect(
nativeCursorRect.x(), nativeCursorRect.y(),
nativeCursorRect.width(), nativeCursorRect.height());
positioner->set_anchor(
QtWayland::xdg_positioner::anchor_bottom_left);
positioner->set_gravity(
QtWayland::xdg_positioner::gravity_bottom_right);
auto *waylandCandidateWindow =
static_cast<QtWaylandClient::QWaylandWindow *>(handle());
QRect nativeGeometry =
waylandCandidateWindow->windowContentGeometry();
positioner->set_size(nativeGeometry.width(),
nativeGeometry.height());
positioner->set_reactive();
positioner->set_constraint_adjustment(
QtWayland::xdg_positioner::constraint_adjustment_slide_x |
QtWayland::xdg_positioner::constraint_adjustment_flip_y);
xdg_popup_reposition(xdgPopup, positioner->object(),
repositionToken_++);
positioner->destroy();
return;
}
// Check if we need remap.
// If it was invisible, nothing need to be done.
// If cursor rect changed, the window must be remapped.
// If adjustment is already happening (flip/slide), then remap.
// If we predict adjustment may be happening, then remap.
const auto predictGeometry =
QRect(QPoint(cursorRect.x(), cursorRect.y() + cursorRect.height()),
actualSize_);
if (wasVisible &&
(cursorRectChanged || position() != predictGeometry.topLeft() ||
!windowGeometry.contains(predictGeometry))) {
hide();
show();
}
return;
}
#endif
// Try to apply the screen edge detection over the window, because if we
// intent to use this with wayland. It we have no information above screen
// edge.
if (isWayland_) {
screenGeometry = window->frameGeometry();
cursorRect.translate(window->framePosition());
auto margins = window->frameMargins();
cursorRect.translate(margins.left(), margins.top());
} else {
screenGeometry = window->screen()->geometry();
auto pos = window->mapToGlobal(cursorRect.topLeft());
cursorRect.moveTo(pos);
}
int x = cursorRect.left();
int y = cursorRect.bottom();
if (cursorRect.left() + sizeWithoutShadow.width() >
screenGeometry.right()) {
x = screenGeometry.right() - sizeWithoutShadow.width() + 1;
}
if (x < screenGeometry.left()) {
x = screenGeometry.left();
}
if (y + sizeWithoutShadow.height() > screenGeometry.bottom()) {
if (y > screenGeometry.bottom()) {
y = screenGeometry.bottom() - sizeWithoutShadow.height() - 40;
} else { /* better position the window */
y = y - sizeWithoutShadow.height() -
((cursorRect.height() == 0) ? 40 : cursorRect.height());
}
}
if (y < screenGeometry.top()) {
y = screenGeometry.top();
}
QPoint newPosition(x, y);
newPosition -=
QPoint(theme_->shadowMargin().left(), theme_->shadowMargin().top());
if (newPosition != position()) {
if (isWayland_ && isVisible()) {
hide();
}
setPosition(newPosition);
}
show();
}
void FcitxCandidateWindow::mouseMoveEvent(QMouseEvent *event) {
bool needRepaint = false;
bool prevHovered = false;
bool nextHovered = false;
auto oldHighlight = highlight();
hoverIndex_ = -1;
prevHovered = prevRegion_.contains(event->pos());
if (!prevHovered) {
nextHovered = nextRegion_.contains(event->pos());
if (!nextHovered) {
for (int idx = 0, e = candidateRegions_.size(); idx < e; idx++) {
if (candidateRegions_[idx].contains(event->pos())) {
hoverIndex_ = idx;
break;
}
}
}
}
needRepaint = needRepaint || prevHovered_ != prevHovered;
prevHovered_ = prevHovered;
needRepaint = needRepaint || nextHovered_ != nextHovered;
nextHovered_ = nextHovered;
needRepaint = needRepaint || oldHighlight != highlight();
if (needRepaint) {
update();
}
}
void FcitxCandidateWindow::mouseReleaseEvent(QMouseEvent *event) {
if (event->button() != Qt::LeftButton) {
return;
}
if (prevRegion_.contains(event->pos())) {
Q_EMIT prevClicked();
return;
}
if (nextRegion_.contains(event->pos())) {
Q_EMIT nextClicked();
return;
}
for (int idx = 0, e = candidateRegions_.size(); idx < e; idx++) {
if (candidateRegions_[idx].contains(event->pos())) {
Q_EMIT candidateSelected(idx);
return;
}
}
}
QSize FcitxCandidateWindow::sizeHint() {
auto minH =
theme_->fontMetrics().ascent() + theme_->fontMetrics().descent();
size_t width = 0;
size_t height = 0;
auto updateIfLarger = [](size_t &m, size_t n) {
if (n > m) {
m = n;
}
};
auto textMargin = theme_->textMargin();
auto extraW = textMargin.left() + textMargin.right();
auto extraH = textMargin.top() + textMargin.bottom();
if (!upperLayout_.text().isEmpty()) {
auto size = upperLayout_.boundingRect();
height += minH + extraH;
updateIfLarger(width, size.width() + extraW);
}
if (!lowerLayout_.text().isEmpty()) {
auto size = lowerLayout_.boundingRect();
height += minH + extraH;
updateIfLarger(width, size.width() + extraW);
}
bool vertical = theme_->vertical();
if (layoutHint_ == FcitxCandidateLayoutHint::Vertical) {
vertical = true;
} else if (layoutHint_ == FcitxCandidateLayoutHint::Horizontal) {
vertical = false;
}
size_t wholeH = 0, wholeW = 0;
for (size_t i = 0; i < labelLayouts_.size(); i++) {
size_t candidateW = 0, candidateH = 0;
if (!labelLayouts_[i]->isEmpty()) {
auto size = labelLayouts_[i]->boundingRect();
candidateW += size.width();
updateIfLarger(candidateH,
std::max(minH, qCeil(size.height())) + extraH);
}
if (!candidateLayouts_[i]->isEmpty()) {
auto size = candidateLayouts_[i]->boundingRect();
candidateW += size.width();
updateIfLarger(candidateH,
std::max(minH, qCeil(size.height())) + extraH);
}
candidateW += extraW;
if (vertical) {
wholeH += candidateH;
updateIfLarger(wholeW, candidateW);
} else {
wholeW += candidateW;
updateIfLarger(wholeH, candidateH);
}
}
updateIfLarger(width, wholeW);
candidatesHeight_ = wholeH;
height += wholeH;
auto contentMargin = theme_->contentMargin();
width += contentMargin.left() + contentMargin.right();
height += contentMargin.top() + contentMargin.bottom();
if (!labelLayouts_.empty() && (hasPrev_ || hasNext_)) {
if (theme_->prev().valid() && theme_->next().valid()) {
width += theme_->prev().width() + theme_->next().width();
}
}
return {static_cast<int>(width), static_cast<int>(height)};
}
void FcitxCandidateWindow::wheelEvent(QWheelEvent *event) {
if (!theme_ || !theme_->wheelForPaging()) {
return;
}
accAngle_ += event->angleDelta().y();
auto angleForClick = 120;
while (accAngle_ >= angleForClick) {
accAngle_ -= angleForClick;
Q_EMIT prevClicked();
}
while (accAngle_ <= -angleForClick) {
accAngle_ += angleForClick;
Q_EMIT nextClicked();
}
}
void FcitxCandidateWindow::paintEvent(QPaintEvent *) {
QPainter p(this);
render(&p);
}
} // namespace fcitx

View File

@@ -0,0 +1,105 @@
/*
* SPDX-FileCopyrightText: 2021~2021 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#ifndef _PLATFORMINPUTCONTEXT_FCITXCANDIDATEWINDOW_H_
#define _PLATFORMINPUTCONTEXT_FCITXCANDIDATEWINDOW_H_
#include "fcitxflags.h"
#include "fcitxqtdbustypes.h"
#include <QGuiApplication>
#include <QPainter>
#include <QPointer>
#include <QRasterWindow>
#include <QTextLayout>
#include <memory>
#include <qscopedpointer.h>
#include <vector>
#if defined(FCITX_ENABLE_QT6_WAYLAND_WORKAROUND) && \
QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)
#include <QtWaylandClient/private/qwayland-xdg-shell.h>
#endif
namespace fcitx {
class FcitxTheme;
class MultilineText;
class QFcitxPlatformInputContext;
class FcitxCandidateWindow : public QRasterWindow {
Q_OBJECT
public:
explicit FcitxCandidateWindow(QWindow *window,
QFcitxPlatformInputContext *context);
~FcitxCandidateWindow();
void render(QPainter *painter);
public Q_SLOTS:
void updateClientSideUI(const FcitxQtFormattedPreeditList &preedit,
int cursorpos,
const FcitxQtFormattedPreeditList &auxUp,
const FcitxQtFormattedPreeditList &auxDown,
const FcitxQtStringKeyValueList &candidates,
int candidateIndex, int layoutHint, bool hasPrev,
bool hasNext);
QSize sizeHint();
Q_SIGNALS:
void candidateSelected(int i);
void prevClicked();
void nextClicked();
protected:
bool event(QEvent *event) override;
void paintEvent(QPaintEvent *event) override;
void mouseMoveEvent(QMouseEvent *) override;
void mouseReleaseEvent(QMouseEvent *) override;
void wheelEvent(QWheelEvent *) override;
int highlight() const {
int highlightIndex = (hoverIndex_ >= 0) ? hoverIndex_ : highlight_;
return highlightIndex;
}
private:
const bool isWayland_ =
QGuiApplication::platformName().startsWith("wayland");
uint32_t repositionToken_ = 0;
QSize actualSize_;
QPointer<QFcitxPlatformInputContext> context_;
QPointer<FcitxTheme> theme_;
QTextLayout upperLayout_;
QTextLayout lowerLayout_;
std::vector<std::unique_ptr<MultilineText>> candidateLayouts_;
std::vector<std::unique_ptr<MultilineText>> labelLayouts_;
int cursor_ = -1;
int highlight_ = -1;
int hoverIndex_ = -1;
int accAngle_ = 0;
bool prevHovered_ = false;
bool nextHovered_ = false;
bool hasPrev_ = false;
bool hasNext_ = false;
FcitxCandidateLayoutHint layoutHint_ = FcitxCandidateLayoutHint::NotSet;
int candidatesHeight_ = 0;
QRect prevRegion_;
QRect nextRegion_;
std::vector<QRect> candidateRegions_;
QPointer<QWindow> parent_;
#if defined(FCITX_ENABLE_QT6_WAYLAND_WORKAROUND) && \
QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)
QScopedPointer<QtWayland::xdg_wm_base> xdgWmBase_;
#endif
};
} // namespace fcitx
#endif // _PLATFORMINPUTCONTEXT_FCITXCANDIDATEWINDOW_H_

View File

@@ -0,0 +1,451 @@
/*
* SPDX-FileCopyrightText: 2021~2021 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#include "fcitxtheme.h"
#include "font.h"
#include <QDebug>
#include <QMargins>
#include <QPixmap>
#include <QSettings>
#include <QStandardPaths>
namespace fcitx {
bool readBool(const QSettings &settings, const QString &name,
bool defaultValue) {
return settings.value(name, defaultValue ? "True" : "False").toString() ==
"True";
}
QMargins readMargin(const QSettings &settings) {
settings.allKeys();
return QMargins(settings.value("Left", 0).toInt(),
settings.value("Top", 0).toInt(),
settings.value("Right", 0).toInt(),
settings.value("Bottom", 0).toInt());
}
QColor readColor(const QSettings &settings, const QString &name,
const QString &defaultValue) {
QString colorString = settings.value(name, defaultValue).toString();
QColor color(defaultValue);
if (colorString.startsWith("#")) {
if (colorString.size() == 7) {
// Parse #RRGGBB
color = QColor(colorString.toUpper());
} else if (colorString.size() == 9) {
// Qt accept "#AARRGGBB"
auto newColorString =
QString("#%1%2")
.arg(colorString.mid(7, 2), colorString.mid(1, 6))
.toUpper();
color = QColor(newColorString);
}
}
return color;
}
void BackgroundImage::load(const QString &name, QSettings &settings) {
settings.allKeys();
image_ = QPixmap();
overlay_ = QPixmap();
if (auto image = settings.value("Image").toString(); !image.isEmpty()) {
auto file = QStandardPaths::locate(
QStandardPaths::GenericDataLocation,
QString("fcitx5/themes/%1/%2").arg(name, image));
image_.load(file);
}
if (auto image = settings.value("Overlay").toString(); !image.isEmpty()) {
auto file = QStandardPaths::locate(
QStandardPaths::GenericDataLocation,
QString("fcitx5/themes/%1/%2").arg(name, image));
overlay_.load(file);
}
settings.beginGroup("Margin");
margin_ = readMargin(settings);
settings.endGroup();
if (image_.isNull()) {
QColor color = readColor(settings, "Color", "#ffffff");
QColor borderColor = readColor(settings, "BorderColor", "#00ffffff");
int borderWidth = settings.value("BorderWidth", 0).toInt();
fillBackground(borderColor, color, borderWidth);
}
settings.beginGroup("OverlayClipMargin");
overlayClipMargin_ = readMargin(settings);
settings.endGroup();
hideOverlayIfOversize_ =
settings.value("HideOverlayIfOversize", "False").toString() == "True";
overlayOffsetX_ = settings.value("OverlayOffsetX", 0).toInt();
overlayOffsetY_ = settings.value("OverlayOffsetY", 0).toInt();
gravity_ = settings.value("Gravity", "TopLeft").toString();
}
void BackgroundImage::loadFromValue(const QColor &border,
const QColor &background, QMargins margin,
int borderWidth) {
image_ = QPixmap();
overlay_ = QPixmap();
margin_ = margin;
fillBackground(border, background, borderWidth);
overlayClipMargin_ = QMargins();
hideOverlayIfOversize_ = false;
overlayOffsetX_ = 0;
overlayOffsetY_ = 0;
gravity_ = QString();
}
void BackgroundImage::fillBackground(const QColor &border,
const QColor &background,
int borderWidth) {
image_ = QPixmap(margin_.left() + margin_.right() + 1,
margin_.top() + margin_.bottom() + 1);
borderWidth = std::min({borderWidth, margin_.left(), margin_.right(),
margin_.top(), margin_.bottom()});
borderWidth = std::max(0, borderWidth);
QPainter painter;
painter.begin(&image_);
painter.setCompositionMode(QPainter::CompositionMode_Source);
if (borderWidth) {
painter.fillRect(image_.rect(), border);
}
painter.fillRect(QRect(borderWidth, borderWidth,
image_.width() - borderWidth * 2,
image_.height() - borderWidth * 2),
background);
painter.end();
}
void ActionImage::load(const QString &name, QSettings &settings) {
settings.allKeys();
image_ = QPixmap();
valid_ = false;
if (auto image = settings.value("Image").toString(); !image.isEmpty()) {
auto file = QStandardPaths::locate(
QStandardPaths::GenericDataLocation,
QString("fcitx5/themes/%1/%2").arg(name, image));
image_.load(file);
valid_ = !image_.isNull();
}
settings.beginGroup("ClickMargin");
margin_ = readMargin(settings);
settings.endGroup();
}
void ActionImage::reset() {
image_ = QPixmap();
valid_ = false;
margin_ = QMargins(0, 0, 0, 0);
}
FcitxTheme::FcitxTheme(QObject *parent)
: QObject(parent), configPath_(QStandardPaths::writableLocation(
QStandardPaths::GenericConfigLocation)
.append("/fcitx5/conf/classicui.conf")),
watcher_(new QFileSystemWatcher) {
connect(watcher_, &QFileSystemWatcher::fileChanged, this,
&FcitxTheme::configChanged);
watcher_->addPath(configPath_);
configChanged();
}
FcitxTheme::~FcitxTheme() {}
void FcitxTheme::configChanged() {
// Since fcitx is doing things like delete and move, we need to re-add the
// path.
watcher_->removePath(configPath_);
watcher_->addPath(configPath_);
QSettings settings(configPath_, QSettings::IniFormat);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
settings.setIniCodec("UTF-8");
#endif
settings.childGroups();
font_ = parseFont(settings.value("Font", "Sans Serif 9").toString());
fontMetrics_ = QFontMetrics(font_);
vertical_ =
settings.value("Vertical Candidate List", "False").toString() == "True";
wheelForPaging_ =
settings.value("WheelForPaging", "True").toString() == "True";
theme_ = settings.value("Theme", "default").toString();
themeChanged();
}
void FcitxTheme::themeChanged() {
if (!themeConfigPath_.isEmpty()) {
watcher_->removePath(themeConfigPath_);
}
auto themeConfig = QString("/fcitx5/themes/%1/theme.conf").arg(theme_);
themeConfigPath_ =
QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)
.append(themeConfig);
auto file = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
themeConfig);
if (file.isEmpty()) {
file = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
"fcitx5/themes/default/theme.conf");
themeConfigPath_ = QStandardPaths::writableLocation(
QStandardPaths::GenericDataLocation)
.append("fcitx5/themes/default/theme.conf");
theme_ = "default";
}
watcher_->addPath(themeConfigPath_);
// We can not locate default theme.
if (file.isEmpty()) {
normalColor_ = QColor("#000000");
highlightCandidateColor_ = QColor("#ffffff");
fullWidthHighlight_ = true;
highlightColor_ = QColor("#ffffff");
highlightBackgroundColor_ = QColor("#a5a5a5");
contentMargin_ = QMargins{2, 2, 2, 2};
textMargin_ = QMargins{5, 5, 5, 5};
highlightClickMargin_ = QMargins{0, 0, 0, 0};
shadowMargin_ = QMargins{0, 0, 0, 0};
background_.loadFromValue(highlightBackgroundColor_, highlightColor_,
contentMargin_, 2);
highlight_.loadFromValue(highlightBackgroundColor_,
highlightBackgroundColor_, textMargin_, 0);
prev_.reset();
next_.reset();
return;
}
QSettings settings(file, QSettings::IniFormat);
settings.childGroups();
settings.beginGroup("InputPanel");
normalColor_ = readColor(settings, "NormalColor", "#000000");
highlightCandidateColor_ =
readColor(settings, "HighlightCandidateColor", "#ffffff");
fullWidthHighlight_ = readBool(settings, "FullWidthHighlight", true);
highlightColor_ = readColor(settings, "HighlightColor", "#ffffff");
highlightBackgroundColor_ =
readColor(settings, "HighlightBackgroundColor", "#a5a5a5");
buttonAlignment_ =
settings.value("PageButtonAlignment", "Bottom").toString();
settings.beginGroup("ContentMargin");
contentMargin_ = readMargin(settings);
settings.endGroup();
settings.beginGroup("TextMargin");
textMargin_ = readMargin(settings);
settings.endGroup();
settings.beginGroup("ShadowMargin");
shadowMargin_ = readMargin(settings);
settings.endGroup();
settings.beginGroup("Background");
background_.load(theme_, settings);
settings.endGroup();
settings.beginGroup("Highlight");
highlight_.load(theme_, settings);
settings.beginGroup("HighlightClickMargin");
highlightClickMargin_ = readMargin(settings);
settings.endGroup();
settings.endGroup();
settings.beginGroup("PrevPage");
prev_.load(theme_, settings);
settings.endGroup();
settings.beginGroup("NextPage");
next_.load(theme_, settings);
settings.endGroup();
}
} // namespace fcitx
void fcitx::FcitxTheme::paint(QPainter *painter,
const fcitx::BackgroundImage &image,
QRect region) {
auto marginTop = image.margin_.top();
auto marginBottom = image.margin_.bottom();
auto marginLeft = image.margin_.left();
auto marginRight = image.margin_.right();
int resizeHeight = image.image_.height() - marginTop - marginBottom;
int resizeWidth = image.image_.width() - marginLeft - marginRight;
if (resizeHeight <= 0) {
resizeHeight = 1;
}
if (resizeWidth <= 0) {
resizeWidth = 1;
}
if (region.height() < 0) {
region.setHeight(resizeHeight);
}
if (region.width() < 0) {
region.setWidth(resizeWidth);
}
/*
* 7 8 9
* 4 5 6
* 1 2 3
*/
if (marginLeft && marginBottom) {
/* part 1 */
painter->drawPixmap(
QRect(0, region.height() - marginBottom, marginLeft, marginBottom)
.translated(region.topLeft()),
image.image_,
QRect(0, marginTop + resizeHeight, marginLeft, marginBottom));
}
if (marginRight && marginBottom) {
/* part 3 */
painter->drawPixmap(
QRect(region.width() - marginRight, region.height() - marginBottom,
marginRight, marginBottom)
.translated(region.topLeft()),
image.image_,
QRect(marginLeft + resizeWidth, marginTop + resizeHeight,
marginRight, marginBottom));
}
if (marginLeft && marginTop) {
/* part 7 */
painter->drawPixmap(
QRect(0, 0, marginLeft, marginTop).translated(region.topLeft()),
image.image_, QRect(0, 0, marginLeft, marginTop));
}
if (marginRight && marginTop) {
/* part 9 */
painter->drawPixmap(
QRect(region.width() - marginRight, 0, marginRight, marginTop)
.translated(region.topLeft()),
image.image_,
QRect(marginLeft + resizeWidth, 0, marginRight, marginTop));
}
/* part 2 & 8 */
if (marginTop) {
painter->drawPixmap(
QRect(marginLeft, 0, region.width() - marginLeft - marginRight,
marginTop)
.translated(region.topLeft()),
image.image_, QRect(marginLeft, 0, resizeWidth, marginTop));
}
if (marginBottom) {
painter->drawPixmap(QRect(marginLeft, region.height() - marginBottom,
region.width() - marginLeft - marginRight,
marginBottom)
.translated(region.topLeft()),
image.image_,
QRect(marginLeft, marginTop + resizeHeight,
resizeWidth, marginBottom));
}
/* part 4 & 6 */
if (marginLeft) {
painter->drawPixmap(QRect(0, marginTop, marginLeft,
region.height() - marginTop - marginBottom)
.translated(region.topLeft()),
image.image_,
QRect(0, marginTop, marginLeft, resizeHeight));
}
if (marginRight) {
painter->drawPixmap(QRect(region.width() - marginRight, marginTop,
marginRight,
region.height() - marginTop - marginBottom)
.translated(region.topLeft()),
image.image_,
QRect(marginLeft + resizeWidth, marginTop,
marginRight, resizeHeight));
}
/* part 5 */
{
painter->drawPixmap(
QRect(marginLeft, marginTop,
region.width() - marginLeft - marginRight,
region.height() - marginTop - marginBottom)
.translated(region.topLeft()),
image.image_,
QRect(marginLeft, marginTop, resizeWidth, resizeHeight));
}
if (image.overlay_.isNull()) {
return;
}
auto clipWidth = region.width() - image.overlayClipMargin_.left() -
image.overlayClipMargin_.right();
auto clipHeight = region.height() - image.overlayClipMargin_.top() -
image.overlayClipMargin_.bottom();
if (clipWidth <= 0 || clipHeight <= 0) {
return;
}
QRect clipRect(region.topLeft() + QPoint(image.overlayClipMargin_.left(),
image.overlayClipMargin_.top()),
QSize(clipWidth, clipHeight));
int x = 0, y = 0;
if (image.gravity_ == "Top Left" || image.gravity_ == "Center Left" ||
image.gravity_ == "Bottom Left") {
x = image.overlayOffsetX_;
} else if (image.gravity_ == "Top Center" || image.gravity_ == "Center" ||
image.gravity_ == "Bottom Center") {
x = (region.width() - image.overlay_.width()) / 2 +
image.overlayOffsetX_;
} else {
x = region.width() - image.overlay_.width() - image.overlayOffsetX_;
}
if (image.gravity_ == "Top Left" || image.gravity_ == "Top Center" ||
image.gravity_ == "Top Right") {
y = image.overlayOffsetY_;
} else if (image.gravity_ == "Center Left" || image.gravity_ == "Center" ||
image.gravity_ == "Center Right") {
y = (region.height() - image.overlay_.height()) / 2 +
image.overlayOffsetY_;
} else {
y = region.height() - image.overlay_.height() - image.overlayOffsetY_;
}
QRect rect(QPoint(x, y) + region.topLeft(), image.overlay_.size());
QRect finalRect = rect.intersected(clipRect);
if (finalRect.isEmpty()) {
return;
}
if (image.hideOverlayIfOversize_ && !clipRect.contains(rect)) {
return;
}
painter->save();
painter->setClipRect(clipRect);
painter->drawPixmap(rect, image.overlay_);
painter->restore();
}
void fcitx::FcitxTheme::paint(QPainter *painter,
const fcitx::ActionImage &image, QPoint position,
float alpha) {
painter->save();
painter->setOpacity(alpha);
painter->drawPixmap(position, image.image_);
painter->restore();
}
QMargins fcitx::FcitxTheme::highlightMargin() const {
return highlight_.margin_;
}

View File

@@ -0,0 +1,124 @@
/*
* SPDX-FileCopyrightText: 2021~2021 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#ifndef _PLATFORMINPUTCONTEXT_FCITXTHEME_H_
#define _PLATFORMINPUTCONTEXT_FCITXTHEME_H_
#include <QColor>
#include <QFileSystemWatcher>
#include <QFont>
#include <QFontMetrics>
#include <QMargins>
#include <QObject>
#include <QPainter>
#include <QPixmap>
#include <QSettings>
namespace fcitx {
class BackgroundImage {
friend class FcitxTheme;
public:
void load(const QString &name, QSettings &settings);
void loadFromValue(const QColor &border, const QColor &background,
QMargins margin, int borderWidth);
private:
void fillBackground(const QColor &border, const QColor &background,
int borderWidth);
QPixmap image_, overlay_;
QMargins margin_, overlayClipMargin_;
bool hideOverlayIfOversize_ = false;
QString gravity_;
int overlayOffsetX_ = 0;
int overlayOffsetY_ = 0;
};
class ActionImage {
friend class FcitxTheme;
public:
void load(const QString &name, QSettings &settings);
void reset();
bool valid() const { return valid_; }
int width() const { return image_.width(); }
int height() const { return image_.height(); }
QSize size() const { return image_.size(); }
const QMargins &margin() const { return margin_; }
private:
bool valid_ = false;
QPixmap image_;
QMargins margin_;
};
class FcitxTheme : public QObject {
Q_OBJECT
public:
FcitxTheme(QObject *parent = nullptr);
~FcitxTheme();
void paint(QPainter *painter, const BackgroundImage &image, QRect region);
void paint(QPainter *painter, const ActionImage &image, QPoint position,
float alpha);
const auto &background() const { return background_; }
const auto &highlight() const { return highlight_; }
const auto &prev() const { return prev_; }
const auto &next() const { return next_; }
const auto &font() const { return font_; }
const auto &fontMetrics() const { return fontMetrics_; }
const auto &highlightBackgroundColor() const {
return highlightBackgroundColor_;
}
const auto &highlightColor() const { return highlightColor_; }
const auto &buttonAlignment() const { return buttonAlignment_; }
auto contentMargin() const { return contentMargin_; }
auto textMargin() const { return textMargin_; }
auto highlightClickMargin() const { return highlightClickMargin_; }
QMargins highlightMargin() const;
auto shadowMargin() const { return shadowMargin_; }
auto normalColor() const { return normalColor_; }
auto highlightCandidateColor() const { return highlightCandidateColor_; }
auto vertical() const { return vertical_; }
auto wheelForPaging() const { return wheelForPaging_; }
private Q_SLOTS:
void configChanged();
void themeChanged();
private:
QString configPath_;
QString themeConfigPath_;
QFileSystemWatcher *watcher_;
QFont font_;
QFontMetrics fontMetrics_{font_};
bool vertical_ = false;
bool wheelForPaging_ = true;
QString theme_ = "default";
BackgroundImage background_;
BackgroundImage highlight_;
ActionImage prev_;
ActionImage next_;
QColor normalColor_{Qt::black};
QColor highlightCandidateColor_{Qt::white};
bool fullWidthHighlight_ = true;
QColor highlightColor_{Qt::white};
QColor highlightBackgroundColor_{0xa5, 0xa5, 0xa5};
QString buttonAlignment_;
QMargins highlightClickMargin_;
QMargins contentMargin_;
QMargins textMargin_;
QMargins shadowMargin_;
};
} // namespace fcitx
#endif // _PLATFORMINPUTCONTEXT_FCITXTHEME_H_

View File

@@ -0,0 +1,69 @@
/*
* SPDX-FileCopyrightText: 2020~2020 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
*/
#include "font.h"
#include <QMap>
QFont fcitx::parseFont(const QString &string) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
auto list = string.split(" ", QString::SkipEmptyParts);
#else
auto list = string.split(" ", Qt::SkipEmptyParts);
#endif
int size = 9; // Default size.
if (!list.empty()) {
bool ok = false;
auto fontSize = list.back().toInt(&ok);
if (ok) {
if (fontSize > 0) {
size = fontSize;
}
list.pop_back();
}
}
QFont::Style style = QFont::StyleNormal;
QFont::Weight weight = QFont::Normal;
const QMap<QString, QFont::Weight> strToWeight = {
{"Thin", QFont::Thin},
{"Ultra-Light", QFont::Thin},
{"Extra-Light", QFont::ExtraLight},
{"Light", QFont::Light},
{"Semi-Light", QFont::Light},
{"Demi-Light", QFont::Light},
{"Book", QFont::Light},
{"Regular", QFont::Normal},
{"Medium", QFont::Medium},
{"Semi-Bold", QFont::Medium},
{"Demi-Bold", QFont::DemiBold},
{"Bold", QFont::Bold},
{"Ultra-Bold", QFont::Bold},
{"Extra-Bold", QFont::ExtraBold},
{"Black", QFont::Black},
{"Ultra-Black", QFont::Black},
{"Extra-Black", QFont::Black},
};
const QMap<QString, QFont::Style> strToStyle = {
{"Italic", QFont::StyleItalic}, {"Oblique", QFont::StyleOblique}};
while (!list.empty()) {
if (strToWeight.contains(list.back())) {
weight = strToWeight.value(list.back(), QFont::Normal);
list.pop_back();
} else if (strToStyle.contains(list.back())) {
style = strToStyle.value(list.back(), QFont::StyleNormal);
list.pop_back();
} else {
break;
}
}
QString family = list.join(" ");
QFont font;
font.setFamily(family);
font.setWeight(weight);
font.setStyle(style);
font.setPointSize(size);
return font;
}

View File

@@ -0,0 +1,19 @@
/*
* SPDX-FileCopyrightText: 2020~2020 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
*/
#ifndef _CONFIGLIB_FONT_H_
#define _CONFIGLIB_FONT_H_
#include <QFont>
#include <QString>
namespace fcitx {
QFont parseFont(const QString &str);
} // namespace fcitx
#endif // _CONFIGLIB_FONT_H_

View File

@@ -0,0 +1,280 @@
/*
* SPDX-FileCopyrightText: 2023~2023 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#include "hybridinputcontext.h"
#include "fcitx4inputcontextproxy.h"
#include "fcitxqtinputcontextproxy.h"
#include "fcitxqtwatcher.h"
#include <cstddef>
namespace fcitx {
HybridInputContext::HybridInputContext(FcitxQtWatcher *watcher,
Fcitx4Watcher *fcitx4Watcher,
QObject *parent)
: QObject(parent), watcher_(watcher), fcitx4Watcher_(fcitx4Watcher) {
// We use a timer here to avoid recheck being triggered multiple times.
// For fcitx5, the fcitx4frontend and dbusfrontend will be initialized
// around the same time. 50ms is specifically selected to be smaller than
// the 100ms timer within input context.
timer_.setInterval(50);
timer_.setSingleShot(true);
connect(&timer_, &QTimer::timeout, this,
[this]() { doRecheck(/*skipFcitx5=*/false); });
connect(watcher_, &FcitxQtWatcher::availabilityChanged, this,
&HybridInputContext::recheck);
connect(fcitx4Watcher_, &Fcitx4Watcher::availabilityChanged, this,
&HybridInputContext::recheck);
recheck();
}
void HybridInputContext::recheck() { timer_.start(); }
void HybridInputContext::doRecheck(bool skipFcitx5) {
const bool fcitx5Available = !skipFcitx5 && watcher_->availability();
if (!fcitx5Available) {
delete proxy_;
proxy_ = nullptr;
}
if (!fcitx4Watcher_->availability()) {
delete proxy4_;
proxy4_ = nullptr;
}
if (fcitx5Available) {
delete proxy4_;
proxy4_ = nullptr;
if (!proxy_) {
proxy_ = new FcitxQtInputContextProxy(watcher_, this);
proxy_->setDisplay(display_);
connect(proxy_, &FcitxQtInputContextProxy::commitString, this,
&HybridInputContext::commitString);
connect(proxy_, &FcitxQtInputContextProxy::currentIM, this,
&HybridInputContext::currentIM);
connect(proxy_, &FcitxQtInputContextProxy::deleteSurroundingText,
this, &HybridInputContext::deleteSurroundingText);
connect(proxy_, &FcitxQtInputContextProxy::forwardKey, this,
&HybridInputContext::forwardKey);
connect(proxy_, &FcitxQtInputContextProxy::updateFormattedPreedit,
this, &HybridInputContext::updateFormattedPreedit);
connect(proxy_, &FcitxQtInputContextProxy::updateClientSideUI, this,
&HybridInputContext::updateClientSideUI);
connect(proxy_, &FcitxQtInputContextProxy::inputContextCreated,
this, &HybridInputContext::inputContextCreated);
connect(proxy_,
&FcitxQtInputContextProxy::inputContextCreationFailed, this,
&HybridInputContext::inputContextCreationFailed);
connect(proxy_, &FcitxQtInputContextProxy::notifyFocusOut, this,
&HybridInputContext::notifyFocusOut);
connect(proxy_,
&FcitxQtInputContextProxy::virtualKeyboardVisibilityChanged,
this,
&HybridInputContext::virtualKeyboardVisibilityChanged);
}
} else if (fcitx4Watcher_->availability()) {
if (!proxy4_) {
proxy4_ = new Fcitx4InputContextProxy(fcitx4Watcher_, this);
connect(proxy4_, &Fcitx4InputContextProxy::commitString, this,
&HybridInputContext::commitString);
connect(proxy4_, &Fcitx4InputContextProxy::currentIM, this,
&HybridInputContext::currentIM);
connect(proxy4_, &Fcitx4InputContextProxy::deleteSurroundingText,
this, &HybridInputContext::deleteSurroundingText);
connect(proxy4_, &Fcitx4InputContextProxy::forwardKey, this,
&HybridInputContext::forwardKey);
connect(
proxy4_, &Fcitx4InputContextProxy::updateFormattedPreedit, this,
[this](const FcitxQtFormattedPreeditList &list, int cursorpos) {
auto newList = list;
for (auto item : newList) {
const qint32 underlineBit = (1 << 3);
// revert non underline and "underline"
item.setFormat(item.format() ^ underlineBit);
}
Q_EMIT updateFormattedPreedit(newList, cursorpos);
});
connect(proxy4_, &Fcitx4InputContextProxy::inputContextCreated,
this,
[this]() { Q_EMIT inputContextCreated(QByteArray()); });
}
}
}
void HybridInputContext::inputContextCreationFailed() {
doRecheck(/*skipFcitx5=*/true);
}
bool HybridInputContext::isValid() const {
if (proxy_) {
return proxy_->isValid();
} else if (proxy4_) {
return proxy4_->isValid();
}
return false;
}
void HybridInputContext::reset() {
if (proxy_) {
proxy_->reset();
} else if (proxy4_) {
proxy4_->reset();
}
}
void HybridInputContext::selectCandidate(int i) {
if (proxy_) {
proxy_->selectCandidate(i);
}
}
void HybridInputContext::prevPage() {
if (proxy_) {
proxy_->prevPage();
}
}
void HybridInputContext::nextPage() {
if (proxy_) {
proxy_->nextPage();
}
}
bool HybridInputContext::supportInvokeAction() const {
if (proxy_) {
return proxy_->supportInvokeAction();
}
return false;
}
void HybridInputContext::invokeAction(unsigned int action, int cursor) {
if (proxy_) {
proxy_->invokeAction(action, cursor);
}
}
void HybridInputContext::setSurroundingText(const QString &text,
unsigned int cursor,
unsigned int anchor) {
if (proxy_) {
proxy_->setSurroundingText(text, cursor, anchor);
} else if (proxy4_) {
proxy4_->setSurroundingText(text, cursor, anchor);
}
}
void HybridInputContext::setSurroundingTextPosition(unsigned int cursor,
unsigned int anchor) {
if (proxy_) {
proxy_->setSurroundingTextPosition(cursor, anchor);
} else if (proxy4_) {
proxy4_->setSurroundingTextPosition(cursor, anchor);
}
}
void HybridInputContext::focusIn() {
if (proxy_) {
proxy_->focusIn();
} else if (proxy4_) {
proxy4_->focusIn();
}
}
void HybridInputContext::focusOut() {
if (proxy_) {
proxy_->focusOut();
} else if (proxy4_) {
proxy4_->focusOut();
}
}
void HybridInputContext::setCursorRectV2(int x, int y, int w, int h,
double scale) {
if (proxy_) {
proxy_->setCursorRectV2(x, y, w, h, scale);
} else if (proxy4_) {
proxy4_->setCursorRect(x, y, w, h);
}
}
void HybridInputContext::setCursorRect(int x, int y, int w, int h) {
if (proxy_) {
proxy_->setCursorRect(x, y, w, h);
} else if (proxy4_) {
proxy4_->setCursorRect(x, y, w, h);
}
}
void HybridInputContext::setSupportedCapability(quint64 supported) {
if (proxy_) {
proxy_->setSupportedCapability(supported);
}
}
void HybridInputContext::setCapability(quint64 capability) {
if (proxy_) {
proxy_->setCapability(capability);
} else if (proxy4_) {
proxy4_->setCapability(capability & 0xfffffffffULL);
}
}
void HybridInputContext::showVirtualKeyboard() {
if (proxy_) {
proxy_->showVirtualKeyboard();
}
}
void HybridInputContext::hideVirtualKeyboard() {
if (proxy_) {
proxy_->hideVirtualKeyboard();
}
}
bool HybridInputContext::isVirtualKeyboardVisible() const {
if (proxy_) {
return proxy_->isVirtualKeyboardVisible();
}
return false;
}
void HybridInputContext::setDisplay(const QString &display) {
if (proxy_) {
proxy_->setDisplay(display);
}
display_ = display;
}
QDBusPendingCall HybridInputContext::processKeyEvent(unsigned int keyval,
unsigned int keycode,
unsigned int state,
bool type,
unsigned int time) {
if (proxy_) {
return proxy_->processKeyEvent(keyval, keycode, state, type, time);
}
return proxy4_->processKeyEvent(keyval, keycode, state, type ? 1 : 0, time);
}
bool HybridInputContext::processKeyEventResult(const QDBusPendingCall &call) {
if (call.isError()) {
return false;
}
if (call.reply().signature() == "b") {
QDBusPendingReply<bool> reply = call;
return reply.value();
} else if (call.reply().signature() == "i") {
QDBusPendingReply<int> reply = call;
return reply.value() > 0;
}
return false;
}
} // namespace fcitx

View File

@@ -0,0 +1,95 @@
/*
* SPDX-FileCopyrightText: 2023~2023 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#ifndef HYBRIDINPUTCONTEXT_H
#define HYBRIDINPUTCONTEXT_H
#include "fcitx4inputcontextproxy.h"
#include "fcitx4watcher.h"
#include "fcitxqtdbustypes.h"
#include "fcitxqtinputcontextproxy.h"
#include "fcitxqtwatcher.h"
#include <QDBusPendingReply>
#include <QObject>
#include <QString>
#include <QTimer>
namespace fcitx {
class HybridInputContext : public QObject {
Q_OBJECT
public:
HybridInputContext(FcitxQtWatcher *watcher, Fcitx4Watcher *fcitx4Watcher,
QObject *parent);
void focusIn();
void focusOut();
void setSurroundingText(const QString &text, unsigned int cursor,
unsigned int anchor);
void setSurroundingTextPosition(unsigned int cursor, unsigned int anchor);
void prevPage();
void nextPage();
void reset();
void selectCandidate(int index);
bool supportInvokeAction() const;
void invokeAction(unsigned int action, int cursor);
bool isValid() const;
void showVirtualKeyboard();
void hideVirtualKeyboard();
bool isVirtualKeyboardVisible() const;
void setDisplay(const QString &display);
void setCapability(quint64 capability);
void setCursorRect(int x, int y, int w, int h);
void setCursorRectV2(int x, int y, int w, int h, double scale);
void setSupportedCapability(quint64 supported);
QDBusPendingCall processKeyEvent(unsigned int keyval, unsigned int keycode,
unsigned int state, bool type,
unsigned int time);
static bool processKeyEventResult(const QDBusPendingCall &call);
Q_SIGNALS:
void commitString(const QString &str);
void currentIM(const QString &name, const QString &uniqueName,
const QString &langCode);
void deleteSurroundingText(int offset, unsigned int nchar);
void forwardKey(unsigned int keyval, unsigned int state, bool isRelease);
void updateFormattedPreedit(const FcitxQtFormattedPreeditList &str,
int cursorpos);
void updateClientSideUI(const FcitxQtFormattedPreeditList &preedit,
int cursorpos,
const FcitxQtFormattedPreeditList &auxUp,
const FcitxQtFormattedPreeditList &auxDown,
const FcitxQtStringKeyValueList &candidates,
int candidateIndex, int layoutHint, bool hasPrev,
bool hasNext);
void inputContextCreated(const QByteArray &uuid);
void notifyFocusOut();
void virtualKeyboardVisibilityChanged(bool visible);
private Q_SLOTS:
void recheck();
void doRecheck(bool skipFcitx5);
void inputContextCreationFailed();
private:
QTimer timer_;
FcitxQtWatcher *watcher_;
Fcitx4Watcher *fcitx4Watcher_;
FcitxQtInputContextProxy *proxy_ = nullptr;
Fcitx4InputContextProxy *proxy4_ = nullptr;
QString display_;
};
} // namespace fcitx
#endif

View File

@@ -0,0 +1,21 @@
/*
* SPDX-FileCopyrightText: 2012~2017 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#include "main.h"
fcitx::QFcitxPlatformInputContext *
QFcitx5PlatformInputContextPlugin::create(const QString &system,
const QStringList &paramList) {
Q_UNUSED(paramList);
if (system.compare(system, QStringLiteral("fcitx5"), Qt::CaseInsensitive) ==
0 ||
system.compare(system, QStringLiteral("fcitx"), Qt::CaseInsensitive) ==
0) {
return new fcitx::QFcitxPlatformInputContext;
}
return 0;
}

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