Improve key sequence widget.

- Add key code mode support.
- Remove QKeysequence and replace with QList<fcitx::Key>, no need to
  convert back and forth on application side.
- Remove libintl.h and replace with our i18n.h.
This commit is contained in:
Weng Xuetian 2017-11-16 17:24:08 -08:00
parent b22f2e953a
commit ddede0e5f7
28 changed files with 18386 additions and 264 deletions

View File

@ -19,6 +19,7 @@ if (BUILD_ONLY_PLUGIN)
else()
set(LIBRARY_TYPE SHARED)
set(LIBRARY_COMPILE_FLAGS "-fvisibility=hidden")
add_definitions(-DFCITX_GETTEXT_DOMAIN=\"fcitx5-qt\")
endif()
include(GNUInstallDirs)
@ -50,4 +51,9 @@ if(ENABLE_QT5)
add_subdirectory(qt5)
endif()
if(NOT BUILD_ONLY_PLUGIN)
find_package(Gettext REQUIRED)
add_subdirectory(po)
endif()
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)

17
Messages.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
DOMAIN=$(basename $PWD)
POT_FILE=po/$DOMAIN.pot
set -x
source_files=$(find . -name \*.cpp -o -name \*.h)
xgettext --keyword=_ --language=C++ --add-comments --sort-output -o ${POT_FILE} $source_files
desktop_files=$(find . -name \*.conf.in -o -name \*.desktop)
xgettext --language=Desktop $desktop_files -j -o ${POT_FILE}
echo > po/LINGUAS
for pofile in $(ls po/*.po | sort); do
pofilebase=$(basename $pofile)
pofilebase=${pofilebase/.po/}
msgmerge -U --backup=none $pofile ${POT_FILE}
echo $pofilebase >> po/LINGUAS
done

2
po/CMakeLists.txt Normal file
View File

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

11
po/LINGUAS Normal file
View File

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

2504
po/ca.po Normal file

File diff suppressed because it is too large Load Diff

973
po/da.po Normal file
View File

@ -0,0 +1,973 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# scootergrisen, 2017
msgid ""
msgstr ""
"Project-Id-Version: fcitx\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-11-16 16:56-0800\n"
"PO-Revision-Date: 2017-09-23 10:41+0000\n"
"Last-Translator: scootergrisen\n"
"Language-Team: Danish (http://www.transifex.com/fcitx/fcitx/language/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/guiwrapper/mainwindow.cpp:43
msgid "&Close"
msgstr "&Luk"
#: qt5/guiwrapper/mainwindow.cpp:42
msgid "&Reset"
msgstr "&Nulstil"
#: qt5/guiwrapper/mainwindow.cpp:41
msgid "&Save"
msgstr "&Gem"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:269
msgid "Empty"
msgstr "Tøm"
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:307
msgid "The key you just pressed is not supported by Qt."
msgstr ""
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:308
msgid "Unsupported Key"
msgstr "Ikke-understøttet tast"
#~ msgid "&Add"
#~ msgstr "&Tilføj"
#~ msgid "&Batch Edit"
#~ msgstr "&Batch-redigering"
#~ msgid "&Delete"
#~ msgstr "&Slet"
#~ msgid "&Import"
#~ msgstr "&Importér"
#~ msgid "&Operation"
#~ msgstr "&Handling"
#~ msgid "Add File"
#~ msgstr "Tilføj fil"
#~ msgid "Are you sure to delete %1?"
#~ msgstr "Er du sikker på, at du vil slette %1?"
#~ msgid "Cannot create file %1."
#~ msgstr "Kan ikke oprette filen %1."
#~ msgid "Cannot remove system file"
#~ msgstr "Kan ikke fjerne systemfil"
#~ msgid "Confirm deletion"
#~ msgstr "Bekræft sletning"
#~ msgid "Create new file"
#~ msgstr "Opret ny fil"
#~ msgid "De&lete All"
#~ msgstr "Slet &alle"
#~ msgid "Default"
#~ msgstr "Standard"
#~ msgid "E&xport"
#~ msgstr "&Eksportér"
#~ msgid "Error while deleting %1."
#~ msgstr "Fejl ved sletning af %1."
#~ msgid "File Operation Failed"
#~ msgstr "Filhandling mislykkedes"
#~ msgid "File name should not contain '/'."
#~ msgstr "Filnavn må ikke indeholde '/'."
#~ msgid "Invalid filename"
#~ msgstr "Ugyldigt filnavn"
#~ msgid "Keyword"
#~ msgstr "Nøgleord"
#~ msgid "Keyword:"
#~ msgstr "Nøgleord:"
#~ msgid "Refresh List"
#~ msgstr "Genopfrisk liste"
#~ msgid "Remove File"
#~ msgstr "Fjern fil"
#~ msgid "Save Changes"
#~ msgstr "Gem ændringer"
#~ msgid " Ctrl+Delete To Delete"
#~ msgstr " Ctrl+Delete for at slette"
#~ msgid "${1} Environment Variables:"
#~ msgstr "${1} miljøvariabler:"
#~ msgid "${1} is not set."
#~ msgstr "${1} er ikke sat."
#~ msgid "${1} is set to ${2}."
#~ msgstr "${1} er sat til ${2}."
#~ msgid "${1} not found."
#~ msgstr "${1} ikke fundet."
#~ msgid "${1} works properly."
#~ msgstr "${1} virker korrekt."
#~ msgid "(Unavailable)"
#~ msgstr "(utilgængelig)"
#~ msgid "/Beginner%27s_Guide"
#~ msgstr "/Begynder%27s_guide"
#~ msgid "/Input_method_related_environment_variables"
#~ msgstr "/Inputmetode_som_er_har_relation_til_miljøvariabler"
#~ msgid "/Note_for_GNOME_Later_than_3.6"
#~ msgstr "/Bemærkning_til_GNOME_senere_end_3.6"
#~ msgid "/XIM"
#~ msgstr "/XIM"
#~ msgid "<Low Surrogate>"
#~ msgstr "<Low Surrogate>"
#~ msgid "<Non Private Use High Surrogate>"
#~ msgstr "<Non Private Use High Surrogate>"
#~ msgid "<Private Use High Surrogate>"
#~ msgstr "<Private Use High Surrogate>"
#~ msgid "<Private Use>"
#~ msgstr "<Private Use>"
#~ msgid "<not assigned>"
#~ msgstr "<not assigned>"
#~ msgid "ABC"
#~ msgstr "ABC"
#~ msgid "ALT Both"
#~ msgstr "ALT begge"
#~ msgid "ALT_L_SHIFT"
#~ msgstr "ALT_V_SKIFT"
#~ msgid "ALT_R_SHIFT"
#~ msgstr "ALT_H_SKIFT"
#~ msgid "ALT_SHIFT"
#~ msgstr "ALT_SKIFT"
#~ msgid "ALT_SUPER"
#~ msgstr "ALT_SUPER"
#~ msgid "Active"
#~ msgstr "Aktiv"
#~ msgid "Addon"
#~ msgstr "Tilføjelse"
#~ msgid "Addon Libraries:"
#~ msgstr "Tilføjelsesbiblioteker:"
#~ msgid "Addon List:"
#~ msgstr "Tilføjelsesliste:"
#~ msgid "All"
#~ msgstr "Alle"
#~ msgid "All found Gtk ${1} immodule files exist."
#~ msgstr "Alle fundne Gtk ${1} immodule-filer findes."
#~ msgid "All locale:"
#~ msgstr "Alle sprog:"
#~ msgid "Alt"
#~ msgstr "Alt"
#~ msgid "Appearance"
#~ msgstr "Udseende"
#~ msgid "Aspell"
#~ msgstr "Aspell"
#~ msgid "Auto"
#~ msgstr "Automatisk"
#~ msgid "Available Value:"
#~ msgstr "Tilgængelig værdi:"
#~ msgid "Background Image"
#~ msgstr "Baggrundsbillede"
#~ msgid "Bash Version:"
#~ msgstr "Bash-version:"
#~ msgid "Beginner's Guide"
#~ msgstr "Begynderguide"
#~ msgid "Bingchan"
#~ msgstr "Bingchan"
#~ msgid "CTRL Both"
#~ msgstr "CTRL begge"
#~ msgid "CTRL_SHIFT"
#~ msgstr "CTRL_SKIFT"
#~ msgid "CTRL_SUPER"
#~ msgstr "CTRL_SUPER"
#~ msgid "Can't Create imWindow"
#~ msgstr "Kan ikke oprette imWindow"
#~ msgid "Can't open socket %s: %s"
#~ msgstr "Kan ikke åbne socket %s: %s"
#~ msgid "Cangjie"
#~ msgstr "Cangjie"
#~ msgid "Cannot connect to fcitx correctly."
#~ msgstr "Kan ikke oprette forbindelse til fcitx korrekt."
#~ msgid "Cannot determine desktop environment."
#~ msgstr "Kan ikke bestemme skrivebordsmiljø."
#~ msgid "Cannot find ${2} for gtk ${1}"
#~ msgstr "Kan ikke finde ${2} til gtk ${1}"
#~ msgid "Cannot find DBus name ${1} owner."
#~ msgstr "Kan ikke finde ejer af DBus-navnet ${1}."
#~ msgid "Cannot find fcitx executable!"
#~ msgstr "Kan ikke finde fcitx-eksekverbar!"
#~ msgid "Cannot found Pinyin"
#~ msgstr "Kan ikke finde Pinyin"
#~ msgid "Cannot interpret XMODIFIERS: ${1}."
#~ msgstr "Kan ikke fortolke XMODIFIERS: ${1}."
#~ msgid "Category"
#~ msgstr "Kategori"
#~ msgid "Change Fcitx Configuration"
#~ msgstr "Skift Fcitx-konfiguration"
#~ msgid "Choose"
#~ msgstr "Vælg"
#~ msgid "Classic"
#~ msgstr "Klassisk"
#~ msgid "ClassicUI"
#~ msgstr "Klassisk grænseflade"
#~ msgid "Clear"
#~ msgstr "Ryd"
#~ msgid "Clipboard"
#~ msgstr "Udklipsholder"
#~ msgid "Close virtual keyboard"
#~ msgstr "Luk virtuelt tastatur"
#~ msgid "Code is "
#~ msgstr "Kode is"
#~ msgid "Comment"
#~ msgstr "Kommentar"
#~ msgid "ConfigFile"
#~ msgstr "KonfigurationsFil"
#~ msgid "Configuration:"
#~ msgstr "Konfiguration:"
#~ msgid "Configure"
#~ msgstr "Konfigurer"
#~ msgid "Configure Current Input Method"
#~ msgstr "Konfigurer nuværende inputmetode"
#~ msgid "Copy"
#~ msgstr "Kopiér"
#~ msgid "Ctrl"
#~ msgstr "Ctrl"
#~ msgid "Ctrl+Left Super"
#~ msgstr "Ctrl+Venstre Super"
#~ msgid "Ctrl+Right Super"
#~ msgstr "Ctrl+Højre Super"
#~ msgid "Current fcitx settings directory is ${1} (${2})."
#~ msgstr "Nuværende fcitx-indstillingsmappe er ${1} (${2})."
#~ msgid "Current locale:"
#~ msgstr "Nuværende sprog:"
#~ msgid "Current user:"
#~ msgstr "Nuværende bruger:"
#~ msgid "Current value of ${1} is ${2} (${3})."
#~ msgstr "Nuværende værdi af ${1} er ${2} (${3})."
#~ msgid "Custom"
#~ msgstr "Tilpasset"
#~ msgid "DBus"
#~ msgstr "DBus"
#~ msgid "DBus Support"
#~ msgstr "DBus-understøttelse"
#~ msgid "DBus interface:"
#~ msgstr "DBus-grænseflade:"
#~ msgid "Default input methods:"
#~ msgstr "Standard inputmetoder:"
#~ msgid "Dependency"
#~ msgstr "Afhængighed"
#~ msgid "Description of Skin"
#~ msgstr "Beskrivelse af skin"
#~ msgid "Desktop Environment:"
#~ msgstr "Skrivebordsmiljø:"
#~ msgid "Desktop environment is ${1}."
#~ msgstr "Skrivebordsmiljø er ${1}."
#~ msgid "Dianbaoma"
#~ msgstr "Dianbaoma"
#~ msgid "Directories:"
#~ msgstr "Mapper:"
#~ msgid "Disabled"
#~ msgstr "Deaktiveret"
#~ msgid "Do not show again"
#~ msgstr "Vis ikke igen"
#~ msgid "Do not show in GUI"
#~ msgstr "Vis ikke i grafisk brugerflade"
#~ msgid "Enable"
#~ msgstr "Aktivér"
#~ msgid "Enabled"
#~ msgstr "Aktiveret"
#~ msgid "English (US)"
#~ msgstr "Engelsk (USA)"
#~ msgid "Environment variable ${1} is not set."
#~ msgstr "Miljøvariablen ${1} er ikke sat."
#~ msgid "Environment variable ${1} is set to ${2}."
#~ msgstr "Miljøvariablen ${1} er ikke sat ${2}."
#~ msgid "Environment:"
#~ msgstr "Miljø:"
#~ msgid "Erbi"
#~ msgstr "Erbi"
#~ msgid "Error occurs when running ${1}. Please check your locale settings."
#~ msgstr ""
#~ "Der opstod en fejl under kørsel af ${1}. Tjek venligst dine lokale "
#~ "indstillinger."
#~ msgid "Exit"
#~ msgstr "Afslut"
#~ msgid "Failed to find fcitx in the output of ${1}"
#~ msgstr "Kunne ikke finde fcitx i outputtet af ${1}"
#~ msgid "Fcitx"
#~ msgstr "Fcitx"
#~ msgid "Fcitx Addons:"
#~ msgstr "Fcitx-tilføjelser:"
#~ msgid "Fcitx Configuration"
#~ msgstr "Fcitx-konfiguration"
#~ msgid "Fcitx DBus Frontend"
#~ msgstr "Fcitx DBus-frontend"
#~ msgid "Fcitx Settings Directory:"
#~ msgstr "Fcitx-indstillingsmappe:"
#~ msgid "Fcitx State:"
#~ msgstr "Fcitx-tilstand:"
#~ msgid "Fcitx XIM Frontend"
#~ msgstr "Fcitx XIM-frontend"
#~ msgid "Fcitx is not running."
#~ msgstr "Fcitx kører ikke."
#~ msgid "Fcitx version: ${1}"
#~ msgstr "Fcitx-version: ${1}"
#~ msgid "Font"
#~ msgstr "Skrifttype"
#~ msgid "Font Size"
#~ msgstr "Skriftstørrelse"
#~ msgid "Found ${1} at ${2}."
#~ msgstr "Fandt ${1} ved ${2}."
#~ msgid "Found ${1} fcitx process:"
#~ msgstr "Fandt ${1} fcitx-processer:"
#~ msgid "Found ${1} fcitx processes:"
#~ msgstr "Fandt ${1} fcitx-processer:"
#~ msgid "Found ${2} for unknown gtk version at ${1}."
#~ msgstr "Fandt ${2} til ukendt gtk-version ved ${1}."
#~ msgid "Found ${3} for gtk ${1} at ${2}."
#~ msgstr "Fandt ${3} til gtk ${1} ved ${2}."
#~ msgid "Found fcitx at ${1}."
#~ msgstr "Fandt fcitx ved ${1}."
#~ msgid "Found fcitx im module for ${2}: ${1}."
#~ msgstr "Fandt fcitx im-modul til ${2}: ${1}."
#~ msgid "Found fcitx im modules for gtk ${1}."
#~ msgstr "Fandt fcitx im-modul til gtk ${1}."
#~ msgid "Found fcitx kcm module."
#~ msgstr "Fandt fcitx kcm-modul."
#~ msgid "Found fcitx qt module: ${1}."
#~ msgstr "Fandt fcitx qt-modul: ${1}."
#~ msgid "Found unknown fcitx qt module: ${1}."
#~ msgstr "Fandt ukendt fcitx qt-modul: ${1}."
#~ msgid "Frontend"
#~ msgstr "Frontend"
#~ msgid "Frontend Used by IM Modules"
#~ msgstr "Frontend brugt af IM-moduler"
#~ msgid "Full width Character"
#~ msgstr "Fuld tegnbrede"
#~ msgid "Fullwidth"
#~ msgstr "Fuld brede"
#~ msgid "Greek"
#~ msgstr "Græsk"
#~ msgid "Half width Character"
#~ msgstr "Halv tegnbrede"
#~ msgid "Hide"
#~ msgstr "Skjul"
#~ msgid "Hiragana"
#~ msgstr "Hiragana"
#~ msgid "Home:"
#~ msgstr "Hjem:"
#~ msgid "Horizontal"
#~ msgstr "Vandret"
#~ msgid "Hotkey"
#~ msgstr "Hottast"
#~ msgid "IconName"
#~ msgstr "IkonNavn"
#~ msgid "Inactive"
#~ msgstr "Inaktiv"
#~ msgid "Index"
#~ msgstr "Indeks"
#~ msgid "Input Method"
#~ msgstr "Inputmetode"
#~ msgid "Input Method Configuration"
#~ msgstr "Konfiguration af inputmetode"
#~ msgid "Input Method Disabled"
#~ msgstr "Inputmetode deaktiveret"
#~ msgid "Input Method Related Environment Variables: "
#~ msgstr "Inputmetode som er har relation til miljøvariabler:"
#~ msgid "Input Methods:"
#~ msgstr "Inputmetoder:"
#~ msgid "Input Speed: "
#~ msgstr "Inputhastighed:"
#~ msgid "InputMethod"
#~ msgstr "InputMetode"
#~ msgid "Katakana"
#~ msgstr "Katakana"
#~ msgid "Key"
#~ msgstr "Tast"
#~ msgid "Keyboard"
#~ msgstr "Tastatur"
#~ msgid "Keyboard Layout"
#~ msgstr "Tastaturlayout"
#~ msgid "Keyboard Layout to be used"
#~ msgstr "Tastaturlayout som skal bruges"
#~ msgid "Keyboard Layout:"
#~ msgstr "Tastaturlayout:"
#~ msgid "Kimpanel process:"
#~ msgstr "Kimpanel-proces:"
#~ msgid "L_ALT"
#~ msgstr "V_ALT"
#~ msgid "L_CTRL"
#~ msgstr "V_CTRL"
#~ msgid "L_SHIFT"
#~ msgstr "V_SKIFT"
#~ msgid "LangCode"
#~ msgstr "SprogKode"
#~ msgid "Language Code for this table"
#~ msgstr "Sprogkode for denne tabel"
#~ msgid "Latin"
#~ msgstr "Latinsk"
#~ msgid "Left"
#~ msgstr "Venstre"
#~ msgid "Left Super"
#~ msgstr "Venstre Super"
#~ msgid "Library"
#~ msgstr "Bibliotek"
#~ msgid "Locale:"
#~ msgstr "Sprog:"
#~ msgid "Log:"
#~ msgstr "Log:"
#~ msgid "Logo Icon"
#~ msgstr "Logoikon"
#~ msgid "MS"
#~ msgstr "MS"
#~ msgid "Math"
#~ msgstr "Matematik"
#~ msgid "Menu Font"
#~ msgstr "Menuens skrifttype"
#~ msgid "Module"
#~ msgstr "Modul"
#~ msgid "Myspell"
#~ msgstr "Myspell"
#~ msgid "Name"
#~ msgstr "Navn"
#~ msgid "Next Page"
#~ msgstr "Næste side"
#~ msgid "Next Page Icon"
#~ msgstr "Næste side-ikon"
#~ msgid "No"
#~ msgstr "Nej"
#~ msgid "No available frontend"
#~ msgstr "Ingen tilgængelig frontend"
#~ msgid "No input window"
#~ msgstr "Intet inputvindue"
#~ msgid "No remind"
#~ msgstr "Ingen påmindelse"
#~ msgid "None"
#~ msgstr "Ingen"
#~ msgid "Not Set"
#~ msgstr "Ikke sat"
#~ msgid "Note for GNOME Later than 3.6"
#~ msgstr "Bemærkning til GNOME senere end 3.6"
#~ msgid "Number"
#~ msgstr "Tal"
#~ msgid "Online Help"
#~ msgstr "Onlinehjælp"
#~ msgid "Other Color"
#~ msgstr "Anden farve"
#~ msgid "Output"
#~ msgstr "Output"
#~ msgid "Overlay image"
#~ msgstr "Overlægningsbillede"
#~ msgid "Owner of DBus name ${1} is ${2}."
#~ msgstr "Ejer af DBus-navnet ${1} er ${2}."
#~ msgid "PID of DBus name ${1} owner is ${2}."
#~ msgstr "PID af ejeren af DBus-navnet ${1} er ${2}."
#~ msgid "Parent"
#~ msgstr "Forælder"
#~ msgid "PerProgram"
#~ msgstr "PrProgram"
#~ msgid "Pinyin"
#~ msgstr "Pinyin"
#~ msgid "Pinyin: "
#~ msgstr "Pinyin: "
#~ msgid "PinyinJiaJia"
#~ msgstr "PinyinJiaJia"
#~ msgid "Please set XMODIFIERS."
#~ msgstr "Sæt venligst XMODIFIERS."
#~ msgid "Press Enter to input text"
#~ msgstr "Tryk på Enter for at indtaste tekst"
#~ msgid "Prev Page"
#~ msgstr "Forrige side"
#~ msgid "Prev Page Icon"
#~ msgstr "Forrige side-ikon"
#~ msgid "Priority"
#~ msgstr "Proritet"
#~ msgid "Priority of addon"
#~ msgstr "Prioritet af tilføjelse"
#~ msgid "Profile"
#~ msgstr "Profil"
#~ msgid "Program"
#~ msgstr "Program"
#~ msgid "Provides XIM support"
#~ msgstr "Leverer XIM-understøttelse"
#~ msgid "Quwei"
#~ msgstr "Quwei"
#~ msgid "R_ALT"
#~ msgstr "H_ALT"
#~ msgid "R_CTRL"
#~ msgstr "H_CTRL"
#~ msgid "R_SHIFT"
#~ msgstr "H_SKIFT"
#~ msgid "Reload configuration"
#~ msgstr "Genindlæs konfiguration"
#~ msgid "Remind:"
#~ msgstr "Påmindelse:"
#~ msgid "Remind: "
#~ msgstr "Påmindelse:"
#~ msgid "Remote"
#~ msgstr "Fjern"
#~ msgid "Rename OK"
#~ msgstr "Omdøbning OK"
#~ msgid "Resize"
#~ msgstr "Tilpas størrelse"
#~ msgid "Restart"
#~ msgstr "Genstart"
#~ msgid "Right"
#~ msgstr "Højre"
#~ msgid "Right Super"
#~ msgstr "Højre Super"
#~ msgid "Running as root:"
#~ msgstr "Kører som root:"
#~ msgid "Russian"
#~ msgstr "Russisk"
#~ msgid "SHIFT Both"
#~ msgstr "SKIFT begge"
#~ msgid "Scroll between Input Method"
#~ msgstr "Rul mellem inputmetode"
#~ msgid "Search unicode"
#~ msgstr "Søg efter unicode"
#~ msgid "Select to paste"
#~ msgstr "Vælg for at indsætte"
#~ msgid "Semicolon"
#~ msgstr "Semikolon"
#~ msgid "SharedLibrary"
#~ msgstr "DeltBibliotek"
#~ msgid "Shift"
#~ msgstr "Skift"
#~ msgid "Show"
#~ msgstr "Vis"
#~ msgid "Show Version"
#~ msgstr "Vis version"
#~ msgid "Shuangpin"
#~ msgstr "Shuangpin"
#~ msgid "Simplified Chinese"
#~ msgstr "Forenklet kinesisk"
#~ msgid "Skin"
#~ msgstr "Skin"
#~ msgid "Skin Author"
#~ msgstr "Skin-forfatter"
#~ msgid "Skin Name"
#~ msgstr "Skinnavn"
#~ msgid "Skin Version"
#~ msgstr "Skin-version"
#~ msgid "SkinInfo"
#~ msgstr "Skininfo"
#~ msgid "Special"
#~ msgstr "Special"
#~ msgid "Spell hint"
#~ msgstr "Stavetip"
#~ msgid "Spell hint is disabled."
#~ msgstr "Stavetip er deaktiveret."
#~ msgid "Spell hint is enabled."
#~ msgstr "Stavetip er aktiveret."
#~ msgid "Start Input Method"
#~ msgstr "Start inputmetode"
#~ msgid "Super Both"
#~ msgstr "Super begge"
#~ msgid "Super+Left Ctrl"
#~ msgstr "Super+Venstre Ctrl"
#~ msgid "Super+Right Ctrl"
#~ msgstr "Super+Højre Ctrl"
#~ msgid "Switching Remind Mode"
#~ msgstr "Skifter påmindelsestilstand"
#~ msgid "Switching Virtual Keyboard"
#~ msgstr "Skifter virtuelt tastatur"
#~ msgid "Symbol"
#~ msgstr "Symbol"
#~ msgid "System Info:"
#~ msgstr "Systeminfo:"
#~ msgid "Table"
#~ msgstr "Tabel"
#~ msgid "Table Symbol"
#~ msgstr "Tabelsymbol"
#~ msgid "The script is run as ${1} (${2})."
#~ msgstr "Scriptet køres som ${1} (${2})."
#~ msgid "Toggle Input Method"
#~ msgstr "Skift inputmetode"
#~ msgid "Toggle Remind"
#~ msgstr "Påmindelse til/fra"
#~ msgid "Toggle Virtual Keyboard"
#~ msgstr "Virtuelt tastatur til/fra"
#~ msgid "Traditional Chinese"
#~ msgstr "Traditionel kinesisk"
#~ msgid "TraditionalChinese"
#~ msgstr "Traditionel kinesisk"
#~ msgid "Trigger Input Method"
#~ msgstr "Udløs inputmetode"
#~ msgid "Type"
#~ msgstr "Type"
#~ msgid "UI"
#~ msgstr "Brugerflade"
#~ msgid "Unicode"
#~ msgstr "Unicode"
#~ msgid "UniqueName"
#~ msgstr "UniktNavn"
#~ msgid "Use Keyboard Layout as Input Method"
#~ msgstr "Brug tastaturlayout som inputmetode"
#~ msgid "Use System Tray Icon"
#~ msgstr "Brug systembakkeikon"
#~ msgid "Use remind"
#~ msgstr "Brug påmindelse"
#~ msgid "User Defined"
#~ msgstr "Brugerdefineret"
#~ msgid "User Interface:"
#~ msgstr "Brugerflade:"
#~ msgid "Using ${1} to check dbus."
#~ msgstr "Bruger ${1} til at tjekke dbus."
#~ msgid "Version Line:"
#~ msgstr "Versionslinje:"
#~ msgid "Vertical"
#~ msgstr "Lodret"
#~ msgid "Virtual Keyboard"
#~ msgstr "Virtuelt tastatur"
#~ msgid "Virtual Keyboard State"
#~ msgstr "Virtuelt tastatur tilstand"
#~ msgid "Wanfeng"
#~ msgstr "Wanfeng"
#~ msgid "Why is it bad to run as root"
#~ msgstr "Hvorfor det er en dårlig ide at køre som root"
#~ msgid "Wubi"
#~ msgstr "Wubi"
#~ msgid "WubiPinyin"
#~ msgstr "WubiPinyin"
#~ msgid "X Keyboard"
#~ msgstr "X-tastatur"
#~ msgid "X11 not initialized"
#~ msgstr "X11 er ikke initialiseret"
#~ msgid "XIM encoding:"
#~ msgstr "XIM-kodning:"
#~ msgid "XIM for Emacs:"
#~ msgstr "XIM til Emacs:"
#~ msgid "XMODIFIERS Error."
#~ msgstr "XMODIFIERS-fejl."
#~ msgid "XMODIFIERS is not set"
#~ msgstr "XMODIFIERS er ikke sat"
#~ msgid "XiaoHe"
#~ msgstr "XiaoHe"
#~ msgid "Xim"
#~ msgstr "Xim"
#~ msgid "You are using xim in ${1} programs."
#~ msgstr "Du bruger xim i ${1} programmer."
#~ msgid "You may have trouble using fcitx in ${1} programs."
#~ msgstr ""
#~ "Det kan være at du har problemer med at bruge fcitx i ${1} programmer."
#~ msgid "Zhongwenzhixing"
#~ msgstr "Zhongwenzhixing"
#~ msgid "Ziguang"
#~ msgstr "Ziguang"
#~ msgid "Ziranma"
#~ msgstr "Ziranma"
#~ msgid "executable:"
#~ msgstr "eksekverbar:"
#~ msgid "here"
#~ msgstr "her"
#~ msgid "no valid font."
#~ msgstr "ingen gyldig skrifttype."
#~ msgid "process:"
#~ msgstr "proces:"
#~ msgid "sudo environment variables"
#~ msgstr "sudo-miljøvariabler"
#~ msgid "version:"
#~ msgstr "version:"
#~ msgid "xmodmap command"
#~ msgstr "xmodmap-kommando"
#~ msgid "your current font is: %s"
#~ msgstr "din nuværende skrifttype er: %s"

2414
po/de.po Normal file

File diff suppressed because it is too large Load Diff

275
po/es.po Normal file
View File

@ -0,0 +1,275 @@
# 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: fcitx\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-11-16 16:56-0800\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/guiwrapper/mainwindow.cpp:43
msgid "&Close"
msgstr ""
#: qt5/guiwrapper/mainwindow.cpp:42
msgid "&Reset"
msgstr ""
#: qt5/guiwrapper/mainwindow.cpp:41
msgid "&Save"
msgstr ""
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:269
msgid "Empty"
msgstr ""
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:307
msgid "The key you just pressed is not supported by Qt."
msgstr ""
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:308
msgid "Unsupported Key"
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 "Configure"
#~ msgstr "Configurar"
#~ 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 Method Disabled"
#~ msgstr "Método de entrada desactivado"
#~ 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 "Quick Phrase List"
#~ msgstr "Lista de frases rápidas"
#~ 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"

42
po/fcitx5-qt.pot Normal file
View File

@ -0,0 +1,42 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-11-16 16:56-0800\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: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: qt5/guiwrapper/mainwindow.cpp:43
msgid "&Close"
msgstr ""
#: qt5/guiwrapper/mainwindow.cpp:42
msgid "&Reset"
msgstr ""
#: qt5/guiwrapper/mainwindow.cpp:41
msgid "&Save"
msgstr ""
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:269
msgid "Empty"
msgstr ""
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:307
msgid "The key you just pressed is not supported by Qt."
msgstr ""
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:308
msgid "Unsupported Key"
msgstr ""

53
po/fr.po Normal file
View File

@ -0,0 +1,53 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Riwan BEN EZZEDDINE <riwan.benezzeddine@gmail.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: fcitx\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-11-16 16:56-0800\n"
"PO-Revision-Date: 2017-08-03 16:57+0000\n"
"Last-Translator: Riwan BEN EZZEDDINE <riwan.benezzeddine@gmail.com>\n"
"Language-Team: French (http://www.transifex.com/fcitx/fcitx/language/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=2; plural=(n > 1);\n"
#: qt5/guiwrapper/mainwindow.cpp:43
msgid "&Close"
msgstr ""
#: qt5/guiwrapper/mainwindow.cpp:42
msgid "&Reset"
msgstr ""
#: qt5/guiwrapper/mainwindow.cpp:41
msgid "&Save"
msgstr ""
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:269
msgid "Empty"
msgstr ""
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:307
msgid "The key you just pressed is not supported by Qt."
msgstr ""
#: qt5/widgetsaddons/fcitxqtkeysequencewidget.cpp:308
msgid "Unsupported Key"
msgstr ""
#~ msgid ""
#~ "You're currently running KDE, but KCModule for fcitx couldn't be found, "
#~ "the package name of this KCModule is usually kcm-fcitx or kde-config-"
#~ "fcitx. Now it will open config file with default text editor."
#~ msgstr ""
#~ "Vous utilisez actuellement KDE, en revanche le KCModule pour fcitx ne "
#~ "peut être trouvé, le nom du groupe de ce KCModule est généralement kcm-"
#~ "fcitx ou kde-config-fcitx. Il va maintenant ouvrir le fichier de "
#~ "configuration avec le texte par défaut."

2249
po/ja.po Normal file

File diff suppressed because it is too large Load Diff

2423
po/ko.po Normal file

File diff suppressed because it is too large Load Diff

2484
po/ru.po Normal file

File diff suppressed because it is too large Load Diff

2409
po/zh_CN.po Normal file

File diff suppressed because it is too large Load Diff

2346
po/zh_TW.po Normal file

File diff suppressed because it is too large Load Diff

View File

@ -97,6 +97,7 @@ QDBusArgument &operator<<(QDBusArgument &argument,
argument << arg.icon();
argument << arg.label();
argument << arg.languageCode();
argument << arg.configurable();
argument.endStructure();
return argument;
}
@ -104,9 +105,10 @@ QDBusArgument &operator<<(QDBusArgument &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;
languageCode >> configurable;
argument.endStructure();
arg.setUniqueName(uniqueName);
arg.setName(name);
@ -114,6 +116,7 @@ const QDBusArgument &operator>>(const QDBusArgument &argument,
arg.setIcon(icon);
arg.setLabel(label);
arg.setLanguageCode(languageCode);
arg.setConfigurable(configurable);
return argument;
}
@ -198,7 +201,6 @@ QDBusArgument &operator<<(QDBusArgument &argument,
const FcitxQtConfigType &arg) {
argument.beginStructure();
argument << arg.name();
argument << arg.description();
argument << arg.options();
argument.endStructure();
return argument;
@ -206,13 +208,12 @@ QDBusArgument &operator<<(QDBusArgument &argument,
const QDBusArgument &operator>>(const QDBusArgument &argument,
FcitxQtConfigType &arg) {
QString name, description;
QString name;
FcitxQtConfigOptionList options;
argument.beginStructure();
argument >> name >> description >> options;
argument >> name >> options;
argument.endStructure();
arg.setName(name);
arg.setDescription(description);
arg.setOptions(options);
return argument;
}
@ -224,6 +225,7 @@ QDBusArgument &operator<<(QDBusArgument &argument,
argument << arg.name();
argument << arg.comment();
argument << arg.category();
argument << arg.configurable();
argument << arg.enabled();
argument.endStructure();
return argument;
@ -233,14 +235,16 @@ const QDBusArgument &operator>>(const QDBusArgument &argument,
FcitxQtAddonInfo &arg) {
QString uniqueName, name, comment;
int category;
bool enabled;
bool configurable, enabled;
argument.beginStructure();
argument >> uniqueName >> name >> comment >> category >> enabled;
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;
}

View File

@ -80,6 +80,7 @@ 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);
@ -105,7 +106,6 @@ 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(QString, description, setDescription);
FCITX5_QT_DECLARE_FIELD(FcitxQtConfigOptionList, options, setOptions);
FCITX5_QT_END_DECLARE_DBUS_TYPE(FcitxQtConfigType);
@ -114,6 +114,7 @@ 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);

View File

@ -97,6 +97,7 @@ QDBusArgument &operator<<(QDBusArgument &argument,
argument << arg.icon();
argument << arg.label();
argument << arg.languageCode();
argument << arg.configurable();
argument.endStructure();
return argument;
}
@ -104,9 +105,10 @@ QDBusArgument &operator<<(QDBusArgument &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;
languageCode >> configurable;
argument.endStructure();
arg.setUniqueName(uniqueName);
arg.setName(name);
@ -114,6 +116,7 @@ const QDBusArgument &operator>>(const QDBusArgument &argument,
arg.setIcon(icon);
arg.setLabel(label);
arg.setLanguageCode(languageCode);
arg.setConfigurable(configurable);
return argument;
}
@ -198,7 +201,6 @@ QDBusArgument &operator<<(QDBusArgument &argument,
const FcitxQtConfigType &arg) {
argument.beginStructure();
argument << arg.name();
argument << arg.description();
argument << arg.options();
argument.endStructure();
return argument;
@ -206,13 +208,12 @@ QDBusArgument &operator<<(QDBusArgument &argument,
const QDBusArgument &operator>>(const QDBusArgument &argument,
FcitxQtConfigType &arg) {
QString name, description;
QString name;
FcitxQtConfigOptionList options;
argument.beginStructure();
argument >> name >> description >> options;
argument >> name >> options;
argument.endStructure();
arg.setName(name);
arg.setDescription(description);
arg.setOptions(options);
return argument;
}
@ -224,6 +225,7 @@ QDBusArgument &operator<<(QDBusArgument &argument,
argument << arg.name();
argument << arg.comment();
argument << arg.category();
argument << arg.configurable();
argument << arg.enabled();
argument.endStructure();
return argument;
@ -233,14 +235,16 @@ const QDBusArgument &operator>>(const QDBusArgument &argument,
FcitxQtAddonInfo &arg) {
QString uniqueName, name, comment;
int category;
bool enabled;
bool configurable, enabled;
argument.beginStructure();
argument >> uniqueName >> name >> comment >> category >> enabled;
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;
}

View File

@ -80,6 +80,7 @@ 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);
@ -105,7 +106,6 @@ 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(QString, description, setDescription);
FCITX5_QT_DECLARE_FIELD(FcitxQtConfigOptionList, options, setOptions);
FCITX5_QT_END_DECLARE_DBUS_TYPE(FcitxQtConfigType);
@ -114,6 +114,7 @@ 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);

View File

@ -51,7 +51,7 @@
<arg type="as" direction="out"/>
</method>
<method name="AvailableInputMethods">
<arg type="a(ssssss)" direction="out"/>
<arg type="a(ssssssb)" direction="out"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="FcitxQtInputMethodEntryList" />
</method>
<signal name="InputMethodGroupsChanged">
@ -83,7 +83,7 @@
<arg type="v" direction="in"/>
</method>
<method name="GetAddons">
<arg type="a(sssib)" direction="out"/>
<arg type="a(sssibb)" direction="out"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="FcitxQtAddonInfoList" />
</method>
<method name="SetAddonsState">

View File

@ -1,29 +0,0 @@
/*
* Copyright (C) 2012~2012 by CSSlayer
* wengxt@gmail.com
* Copyright (C) 2017~2017 by xzhao
* i@xuzhao.net
*
* 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 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; see the file COPYING. If not,
* see <http://www.gnu.org/licenses/>.
*/
#ifndef FCITX_QT5_GUIWRAPPER_COMMON_H
#define FCITX_QT5_GUIWRAPPER_COMMON_H
#include <libintl.h>
#define _(x) QString::fromUtf8(dgettext("fcitx", x))
#endif // FCITX_QT5_GUIWRAPPER_COMMON_H

View File

@ -20,7 +20,6 @@
*/
#include "wrapperapp.h"
#include <libintl.h>
int main(int argc, char *argv[]) {
setlocale(LC_ALL, "");

View File

@ -22,13 +22,12 @@
#include <QDebug>
#include <QLocale>
#include <QPushButton>
#include <libintl.h>
#include "common.h"
#include "fcitxqtconfiguifactory.h"
#include "fcitxqtcontrollerproxy.h"
#include "fcitxqtwatcher.h"
#include "mainwindow.h"
#include <fcitx-utils/i18n.h>
namespace fcitx {

View File

@ -19,9 +19,6 @@
* see <http://www.gnu.org/licenses/>.
*/
#include <libintl.h>
#include <locale.h>
#include <QDebug>
#include "fcitxqtconfiguifactory.h"
@ -34,7 +31,6 @@ namespace fcitx {
WrapperApp::WrapperApp(int &argc, char **argv)
: QApplication(argc, argv), m_factory(new FcitxQtConfigUIFactory(this)),
m_mainWindow(0) {
setlocale(LC_ALL, "");
FcitxQtConfigUIWidget *widget = 0;
if (argc == 3 && strcmp(argv[1], "--test") == 0) {

View File

@ -26,8 +26,8 @@
#include <QLibrary>
#include <QPluginLoader>
#include <QStandardPaths>
#include <fcitx-utils/i18n.h>
#include <fcitx-utils/standardpath.h>
#include <libintl.h>
namespace fcitx {

View File

@ -44,48 +44,50 @@
#include "fcitxqtkeysequencewidget.h"
#include "fcitxqtkeysequencewidget_p.h"
#include "qtkeytrans.h"
#include <QApplication>
#include <QDebug>
#include <QHBoxLayout>
#include <QHash>
#include <QKeyEvent>
#include <QLoggingCategory>
#include <QMessageBox>
#include <QTimer>
#include <QToolButton>
#include <fcitx-utils/i18n.h>
#include <fcitx-utils/key.h>
#include <libintl.h>
#include "qtkeytrans.h"
#define _(x) QString::fromUtf8(dgettext("fcitx", x))
Q_LOGGING_CATEGORY(fcitx5qtKeysequenceWidget, "fcitx5.qt.keysequencewidget")
namespace fcitx {
bool isX11LikePlatform() {
return qApp->platformName() == "xcb" || qApp->platformName() == "wayland";
}
class FcitxQtKeySequenceWidgetPrivate {
public:
FcitxQtKeySequenceWidgetPrivate(FcitxQtKeySequenceWidget *q);
void init();
static QKeySequence appendToSequence(const QKeySequence &seq, int keyQt);
static bool isOkWhenModifierless(int keyQt);
void updateShortcutDisplay();
void startRecording();
void controlModifierlessTimout() {
if (nKey != 0 && !modifierKeys) {
if (keySequence_.size() != 0 && !modifierKeys_) {
// No modifier key pressed currently. Start the timout
modifierlessTimeout.start(600);
modifierlessTimeout_.start(600);
} else {
// A modifier is pressed. Stop the timeout
modifierlessTimeout.stop();
modifierlessTimeout_.stop();
}
}
void cancelRecording() {
keySequence = oldKeySequence;
side = oldSide;
keySequence_ = oldKeySequence_;
doneRecording();
}
@ -94,39 +96,36 @@ public:
// members
FcitxQtKeySequenceWidget *const q;
QHBoxLayout *layout;
FcitxQtKeySequenceButton *keyButton;
QToolButton *clearButton;
QHBoxLayout *layout_;
FcitxQtKeySequenceButton *keyButton_;
QToolButton *clearButton_;
QAction *keyCodeModeAction_;
QKeySequence keySequence;
QKeySequence oldKeySequence;
QTimer modifierlessTimeout;
bool allowModifierless;
uint nKey;
uint modifierKeys;
bool isRecording;
bool multiKeyShortcutsAllowed;
bool allowModifierOnly;
FcitxQtModifierSide side;
FcitxQtModifierSide oldSide;
QList<Key> keySequence_;
QList<Key> oldKeySequence_;
QTimer modifierlessTimeout_;
bool allowModifierless_;
uint modifierKeys_;
bool isRecording_;
bool multiKeyShortcutsAllowed_;
bool allowModifierOnly_;
};
FcitxQtKeySequenceWidgetPrivate::FcitxQtKeySequenceWidgetPrivate(
FcitxQtKeySequenceWidget *q)
: q(q), layout(nullptr), keyButton(nullptr), clearButton(nullptr),
allowModifierless(false), nKey(0), modifierKeys(0), isRecording(false),
multiKeyShortcutsAllowed(true), allowModifierOnly(false),
side(MS_Unknown), oldSide(MS_Unknown) {}
: q(q), layout_(nullptr), keyButton_(nullptr), clearButton_(nullptr),
allowModifierless_(false), modifierKeys_(0), isRecording_(false),
multiKeyShortcutsAllowed_(false), allowModifierOnly_(false) {}
FcitxQtKeySequenceWidget::FcitxQtKeySequenceWidget(QWidget *parent)
: QWidget(parent), d(new FcitxQtKeySequenceWidgetPrivate(this)) {
d->init();
setFocusProxy(d->keyButton);
connect(d->keyButton, &QPushButton::clicked, this,
setFocusProxy(d->keyButton_);
connect(d->keyButton_, &QPushButton::clicked, this,
&FcitxQtKeySequenceWidget::captureKeySequence);
connect(d->clearButton, &QPushButton::clicked, this,
connect(d->clearButton_, &QPushButton::clicked, this,
&FcitxQtKeySequenceWidget::clearKeySequence);
connect(&d->modifierlessTimeout, &QTimer::timeout, this,
connect(&d->modifierlessTimeout_, &QTimer::timeout, this,
[this]() { d->doneRecording(); });
// TODO: how to adopt style changes at runtime?
/*QFont modFont = d->clearButton->font();
@ -136,69 +135,68 @@ FcitxQtKeySequenceWidget::FcitxQtKeySequenceWidget(QWidget *parent)
}
void FcitxQtKeySequenceWidgetPrivate::init() {
layout = new QHBoxLayout(q);
layout->setMargin(0);
layout_ = new QHBoxLayout(q);
layout_->setMargin(0);
keyButton = new FcitxQtKeySequenceButton(this, q);
keyButton->setFocusPolicy(Qt::StrongFocus);
layout->addWidget(keyButton);
keyButton_ = new FcitxQtKeySequenceButton(this, q);
keyButton_->setFocusPolicy(Qt::StrongFocus);
layout_->addWidget(keyButton_);
clearButton = new QToolButton(q);
layout->addWidget(clearButton);
clearButton_ = new QToolButton(q);
layout_->addWidget(clearButton_);
#if QT_VERSION < QT_VERSION_CHECK(4, 8, 0)
clearButton->setText(_("Clear"));
#else
keyButton->setIcon(QIcon::fromTheme("configure"));
keyCodeModeAction_ = new QAction(_("Key code mode"));
keyCodeModeAction_->setCheckable(true);
keyCodeModeAction_->setEnabled(isX11LikePlatform());
q->setContextMenuPolicy(Qt::ActionsContextMenu);
q->addAction(keyCodeModeAction_);
keyButton_->setIcon(QIcon::fromTheme("configure"));
if (qApp->isLeftToRight())
clearButton->setIcon(QIcon::fromTheme("edit-clear-locationbar-rtl"));
clearButton_->setIcon(QIcon::fromTheme("edit-clear-locationbar-rtl"));
else
clearButton->setIcon(QIcon::fromTheme("edit-clear-locationbar-ltr"));
#endif
clearButton_->setIcon(QIcon::fromTheme("edit-clear-locationbar-ltr"));
}
FcitxQtKeySequenceWidget::~FcitxQtKeySequenceWidget() { delete d; }
bool FcitxQtKeySequenceWidget::multiKeyShortcutsAllowed() const {
return d->multiKeyShortcutsAllowed;
return d->multiKeyShortcutsAllowed_;
}
void FcitxQtKeySequenceWidget::setMultiKeyShortcutsAllowed(bool allowed) {
d->multiKeyShortcutsAllowed = allowed;
d->multiKeyShortcutsAllowed_ = allowed;
}
void FcitxQtKeySequenceWidget::setModifierlessAllowed(bool allow) {
d->allowModifierless = allow;
d->allowModifierless_ = allow;
}
bool FcitxQtKeySequenceWidget::isModifierlessAllowed() {
return d->allowModifierless;
return d->allowModifierless_;
}
bool FcitxQtKeySequenceWidget::isModifierOnlyAllowed() {
return d->allowModifierOnly;
return d->allowModifierOnly_;
}
void FcitxQtKeySequenceWidget::setModifierOnlyAllowed(bool allow) {
d->allowModifierOnly = allow;
d->allowModifierOnly_ = allow;
}
FcitxQtModifierSide FcitxQtKeySequenceWidget::modifierSide() { return d->side; }
void FcitxQtKeySequenceWidget::setClearButtonShown(bool show) {
d->clearButton->setVisible(show);
d->clearButton_->setVisible(show);
}
// slot
void FcitxQtKeySequenceWidget::captureKeySequence() { d->startRecording(); }
QKeySequence FcitxQtKeySequenceWidget::keySequence() const {
return d->keySequence;
const QList<Key> &FcitxQtKeySequenceWidget::keySequence() const {
return d->keySequence_;
}
// slot
void FcitxQtKeySequenceWidget::setKeySequence(const QKeySequence &seq,
FcitxQtModifierSide side) {
void FcitxQtKeySequenceWidget::setKeySequence(const QList<Key> &seq) {
// oldKeySequence holds the key sequence before recording started, if
// setKeySequence()
// is called while not recording then set oldKeySequence to the existing
@ -206,121 +204,70 @@ void FcitxQtKeySequenceWidget::setKeySequence(const QKeySequence &seq,
// that the keySequenceChanged() signal is emitted if the new and previous
// key
// sequences are different
if (!d->isRecording) {
d->oldKeySequence = d->keySequence;
d->oldSide = d->side;
if (!d->isRecording_) {
d->oldKeySequence_ = d->keySequence_;
}
d->side = side;
d->keySequence = seq;
d->keySequence_ = seq;
d->doneRecording();
}
// slot
void FcitxQtKeySequenceWidget::clearKeySequence() {
setKeySequence(QKeySequence());
d->side = MS_Unknown;
setKeySequence(QList<Key>());
}
void FcitxQtKeySequenceWidgetPrivate::startRecording() {
nKey = 0;
modifierKeys = 0;
oldKeySequence = keySequence;
oldSide = side;
keySequence = QKeySequence();
side = MS_Unknown;
isRecording = true;
keyButton->grabKeyboard();
modifierKeys_ = 0;
oldKeySequence_ = keySequence_;
keySequence_ = QList<Key>();
isRecording_ = true;
keyButton_->grabKeyboard();
if (!QWidget::keyboardGrabber()) {
qWarning() << "Failed to grab the keyboard! Most likely qt's nograb "
"option is active";
}
keyButton->setDown(true);
keyButton_->setDown(true);
updateShortcutDisplay();
}
void FcitxQtKeySequenceWidgetPrivate::doneRecording() {
modifierlessTimeout.stop();
isRecording = false;
keyButton->releaseKeyboard();
keyButton->setDown(false);
modifierlessTimeout_.stop();
isRecording_ = false;
keyButton_->releaseKeyboard();
keyButton_->setDown(false);
if (keySequence == oldKeySequence &&
(oldSide == side || !allowModifierOnly)) {
if (keySequence_ == oldKeySequence_ && !allowModifierOnly_) {
// The sequence hasn't changed
updateShortcutDisplay();
return;
}
Q_EMIT q->keySequenceChanged(keySequence, side);
emit q->keySequenceChanged(keySequence_);
updateShortcutDisplay();
}
void FcitxQtKeySequenceWidgetPrivate::updateShortcutDisplay() {
do {
if (keySequence.count() != 1) {
break;
}
int key = keySequence[0] & (~Qt::KeyboardModifierMask);
if (key == Qt::Key_Shift || key == Qt::Key_Control ||
key == Qt::Key_Meta || key == Qt::Key_Alt) {
QString s;
int mod = keySequence[0] & (Qt::KeyboardModifierMask);
if (mod & Qt::META && key != Qt::Key_Meta)
s += "Meta+";
if (mod & Qt::CTRL && key != Qt::Key_Control)
s += "Ctrl+";
if (mod & Qt::ALT && key != Qt::Key_Alt)
s += "Alt+";
if (mod & Qt::SHIFT && key != Qt::Key_Shift)
s += "Shift+";
if (side == MS_Left) {
s += _("Left") + " ";
} else if (side == MS_Right) {
s += _("Right") + " ";
}
switch (key) {
case Qt::Key_Shift:
s += "Shift";
break;
case Qt::Key_Control:
s += "Ctrl";
break;
case Qt::Key_Meta:
s += "Meta";
break;
case Qt::Key_Alt:
s += "Alt";
break;
}
keyButton->setText(s);
return;
}
} while (0);
// empty string if no non-modifier was pressed
QString s = keySequence.toString(QKeySequence::NativeText);
QString s = QString::fromUtf8(Key::keyListToString(keySequence_).c_str());
s.replace('&', QLatin1String("&&"));
if (isRecording) {
if (modifierKeys) {
if (isRecording_) {
if (modifierKeys_) {
if (!s.isEmpty())
s.append(",");
if (modifierKeys & Qt::META)
if (modifierKeys_ & Qt::META)
s += "Meta+";
if (modifierKeys & Qt::CTRL)
s += "Ctrl+";
if (modifierKeys & Qt::ALT)
if (modifierKeys_ & Qt::CTRL)
s += "Contorl+";
if (modifierKeys_ & Qt::ALT)
s += "Alt+";
if (modifierKeys & Qt::SHIFT)
if (modifierKeys_ & Qt::SHIFT)
s += "Shift+";
} else if (nKey == 0) {
} else if (keySequence_.size() == 0) {
s = "...";
}
// make it clear that input is still going on
@ -333,14 +280,14 @@ void FcitxQtKeySequenceWidgetPrivate::updateShortcutDisplay() {
s.prepend(' ');
s.append(' ');
keyButton->setText(s);
keyButton_->setText(s);
}
FcitxQtKeySequenceButton::~FcitxQtKeySequenceButton() {}
// prevent Qt from special casing Tab and Backtab
bool FcitxQtKeySequenceButton::event(QEvent *e) {
if (d->isRecording && e->type() == QEvent::KeyPress) {
if (d->isRecording_ && e->type() == QEvent::KeyPress) {
keyPressEvent(static_cast<QKeyEvent *>(e));
return true;
}
@ -349,7 +296,7 @@ bool FcitxQtKeySequenceButton::event(QEvent *e) {
// ended the recording and triggered the action associated with the
// action. In case of 'alt+c' ending the dialog. It seems that those
// ShortcutOverride events get sent even if grabKeyboard() is active.
if (d->isRecording && e->type() == QEvent::ShortcutOverride) {
if (d->isRecording_ && e->type() == QEvent::ShortcutOverride) {
e->accept();
return true;
}
@ -361,10 +308,9 @@ void FcitxQtKeySequenceButton::keyPressEvent(QKeyEvent *e) {
int keyQt = e->key();
if (keyQt == -1) {
// Qt sometimes returns garbage keycodes, I observed -1, if it doesn't
// know a key.
// We cannot do anything useful with those (several keys have -1,
// indistinguishable)
// and QKeySequence.toString() will also yield a garbage string.
// know a key. We cannot do anything useful with those (several keys
// have -1, indistinguishable) and QKeySequence.toString() will also
// yield a garbage string.
QMessageBox::warning(
this, _("The key you just pressed is not supported by Qt."),
_("Unsupported Key"));
@ -377,20 +323,20 @@ void FcitxQtKeySequenceButton::keyPressEvent(QKeyEvent *e) {
// don't have the return or space key appear as first key of the sequence
// when they
// were pressed to start editing - catch and them and imitate their effect
if (!d->isRecording &&
if (!d->isRecording_ &&
((keyQt == Qt::Key_Return || keyQt == Qt::Key_Space))) {
d->startRecording();
d->modifierKeys = newModifiers;
d->modifierKeys_ = newModifiers;
d->updateShortcutDisplay();
return;
}
// We get events even if recording isn't active.
if (!d->isRecording)
if (!d->isRecording_)
return QPushButton::keyPressEvent(e);
e->accept();
d->modifierKeys = newModifiers;
d->modifierKeys_ = newModifiers;
switch (keyQt) {
case Qt::Key_AltGr: // or else we get unicode salad
@ -405,12 +351,12 @@ void FcitxQtKeySequenceButton::keyPressEvent(QKeyEvent *e) {
break;
default:
if (d->nKey == 0 && !(d->modifierKeys & ~Qt::SHIFT)) {
if (d->keySequence_.size() == 0 && !(d->modifierKeys_ & ~Qt::SHIFT)) {
// It's the first key and no modifier pressed. Check if this is
// allowed
if (!(FcitxQtKeySequenceWidgetPrivate::isOkWhenModifierless(
keyQt) ||
d->allowModifierless)) {
d->allowModifierless_)) {
// No it's not
return;
}
@ -418,22 +364,28 @@ void FcitxQtKeySequenceButton::keyPressEvent(QKeyEvent *e) {
// We now have a valid key press.
if (keyQt) {
if ((keyQt == Qt::Key_Backtab) && (d->modifierKeys & Qt::SHIFT)) {
keyQt = Qt::Key_Tab | d->modifierKeys;
if ((keyQt == Qt::Key_Backtab) && (d->modifierKeys_ & Qt::SHIFT)) {
keyQt = Qt::Key_Tab | d->modifierKeys_;
} else {
keyQt |= d->modifierKeys;
keyQt |= d->modifierKeys_;
}
if (d->nKey == 0) {
d->keySequence = QKeySequence(keyQt);
Key key;
if (FcitxQtKeySequenceWidget::keyQtToFcitx(keyQt, MS_Unknown,
key)) {
if (d->keyCodeModeAction_->isChecked()) {
key = Key::fromKeyCode(e->nativeScanCode(), key.states());
}
d->keySequence_ << key;
} else {
d->keySequence =
FcitxQtKeySequenceWidgetPrivate::appendToSequence(
d->keySequence, keyQt);
qCDebug(fcitx5qtKeysequenceWidget)
<< "FcitxQtKeySequenceButton::keyPressEvent() Failed to "
"convert Qt key to fcitx: "
<< e;
}
d->nKey++;
if ((!d->multiKeyShortcutsAllowed) || (d->nKey >= 4)) {
if ((!d->multiKeyShortcutsAllowed_) ||
(d->keySequence_.size() >= 4)) {
d->doneRecording();
return;
}
@ -449,33 +401,39 @@ void FcitxQtKeySequenceButton::keyReleaseEvent(QKeyEvent *e) {
return;
}
if (!d->isRecording)
if (!d->isRecording_)
return QPushButton::keyReleaseEvent(e);
e->accept();
if (!d->multiKeyShortcutsAllowed && d->allowModifierOnly &&
if (!d->multiKeyShortcutsAllowed_ && d->allowModifierOnly_ &&
(e->key() == Qt::Key_Shift || e->key() == Qt::Key_Control ||
e->key() == Qt::Key_Meta || e->key() == Qt::Key_Alt)) {
d->side = MS_Unknown;
auto side = MS_Unknown;
if (qApp->platformName() == "xcb") {
if (isX11LikePlatform()) {
if (e->nativeVirtualKey() == FcitxKey_Control_L ||
e->nativeVirtualKey() == FcitxKey_Alt_L ||
e->nativeVirtualKey() == FcitxKey_Shift_L ||
e->nativeVirtualKey() == FcitxKey_Super_L) {
d->side = MS_Left;
side = MS_Left;
}
if (e->nativeVirtualKey() == FcitxKey_Control_R ||
e->nativeVirtualKey() == FcitxKey_Alt_R ||
e->nativeVirtualKey() == FcitxKey_Shift_R ||
e->nativeVirtualKey() == FcitxKey_Super_R) {
d->side = MS_Right;
side = MS_Right;
}
}
int keyQt = e->key() | d->modifierKeys;
d->keySequence = QKeySequence(keyQt);
int keyQt = e->key() | d->modifierKeys_;
Key key;
if (FcitxQtKeySequenceWidget::keyQtToFcitx(keyQt, side, key)) {
if (d->keyCodeModeAction_->isChecked()) {
key = Key::fromKeyCode(e->nativeScanCode(), key.states());
}
d->keySequence_ = QList<Key>({key});
}
d->doneRecording();
return;
}
@ -484,31 +442,13 @@ void FcitxQtKeySequenceButton::keyReleaseEvent(QKeyEvent *e) {
e->modifiers() & (Qt::SHIFT | Qt::CTRL | Qt::ALT | Qt::META);
// if a modifier that belongs to the shortcut was released...
if ((newModifiers & d->modifierKeys) < d->modifierKeys) {
d->modifierKeys = newModifiers;
if ((newModifiers & d->modifierKeys_) < d->modifierKeys_) {
d->modifierKeys_ = newModifiers;
d->controlModifierlessTimout();
d->updateShortcutDisplay();
}
}
// static
QKeySequence
FcitxQtKeySequenceWidgetPrivate::appendToSequence(const QKeySequence &seq,
int keyQt) {
switch (seq.count()) {
case 0:
return QKeySequence(keyQt);
case 1:
return QKeySequence(seq[0], keyQt);
case 2:
return QKeySequence(seq[0], seq[1], keyQt);
case 3:
return QKeySequence(seq[0], seq[1], seq[2], keyQt);
default:
return seq;
}
}
// static
bool FcitxQtKeySequenceWidgetPrivate::isOkWhenModifierless(int keyQt) {
// this whole function is a hack, but especially the first line of code
@ -528,12 +468,15 @@ bool FcitxQtKeySequenceWidgetPrivate::isOkWhenModifierless(int keyQt) {
}
}
void FcitxQtKeySequenceWidget::keyQtToFcitx(int keyQt, FcitxQtModifierSide side,
int &outsym, uint &outstate) {
bool FcitxQtKeySequenceWidget::keyQtToFcitx(int keyQt, FcitxQtModifierSide side,
Key &outkey) {
int key = keyQt & (~Qt::KeyboardModifierMask);
int state = keyQt & Qt::KeyboardModifierMask;
int sym = 0;
keyQtToSym(key, Qt::KeyboardModifiers(state), sym, outstate);
int sym;
unsigned int states;
if (!keyQtToSym(key, Qt::KeyboardModifiers(state), sym, states)) {
return false;
}
if (side == MS_Right) {
switch (sym) {
case FcitxKey_Control_L:
@ -551,16 +494,18 @@ void FcitxQtKeySequenceWidget::keyQtToFcitx(int keyQt, FcitxQtModifierSide side,
}
}
outsym = sym;
outkey = Key(static_cast<KeySym>(sym), KeyStates(states));
return true;
}
int FcitxQtKeySequenceWidget::keyFcitxToQt(int sym, uint state) {
int FcitxQtKeySequenceWidget::keyFcitxToQt(Key key) {
Qt::KeyboardModifiers qstate = Qt::NoModifier;
int key;
symToKeyQt((int)sym, state, key, qstate);
int qtkey = 0;
symToKeyQt(static_cast<int>(key.sym()),
static_cast<unsigned int>(key.states()), qtkey, qstate);
return key | qstate;
return qtkey | qstate;
}
}

View File

@ -44,7 +44,8 @@
*/
#include <QList>
#include <QtWidgets/QPushButton>
#include <QPushButton>
#include <fcitx-utils/key.h>
#include "fcitx5qt5widgetsaddons_export.h"
@ -86,27 +87,19 @@ public:
void setModifierOnlyAllowed(bool allow);
bool isModifierOnlyAllowed();
/*
* only useful when modifierOnlyAllowed is true
* and the key is modifierOnly.
*/
FcitxQtModifierSide modifierSide();
void setClearButtonShown(bool show);
QKeySequence keySequence() const;
const QList<Key> &keySequence() const;
static void keyQtToFcitx(int keyQt, FcitxQtModifierSide side, int &outsym,
uint &outstate);
static int keyFcitxToQt(int sym, uint state);
static bool keyQtToFcitx(int keyQt, FcitxQtModifierSide side, Key &outkey);
static int keyFcitxToQt(Key key);
Q_SIGNALS:
void keySequenceChanged(const QKeySequence &seq, FcitxQtModifierSide side);
void keySequenceChanged(const QList<Key> &seq);
public Q_SLOTS:
void captureKeySequence();
void setKeySequence(const QKeySequence &seq,
FcitxQtModifierSide side = MS_Unknown);
void setKeySequence(const QList<Key> &seq);
void clearKeySequence();
private:

View File

@ -42,6 +42,7 @@
Boston, MA 02110-1301, USA.
*/
#include <QAction>
#include <QHBoxLayout>
#include <QPushButton>
#include <QToolButton>