├── .clang-format
├── .github
├── ISSUE_TEMPLATE
│ └── bug_report.md
└── workflows
│ ├── build_pass.yml
│ ├── check.yml
│ ├── clang-format-check.yml
│ └── release.yml
├── .gitignore
├── .gitmodules
├── CMakeLists.txt
├── LICENSE
├── Messages.sh
├── README.md
├── bin
├── cskk_version.sh
├── metainfo_version.sh
└── version.sh
├── cmake
└── DebPack.cmake
├── data
├── CMakeLists.txt
├── LICENSE.txt
├── README.txt
└── icon
│ ├── 24x24
│ └── apps
│ │ ├── cskk-ascii.png
│ │ ├── cskk-hankakukana.png
│ │ ├── cskk-hiragana.png
│ │ ├── cskk-katakana.png
│ │ ├── cskk-zenei.png
│ │ └── cskk.png
│ ├── 256x256
│ └── apps
│ │ ├── cskk-ascii.png
│ │ ├── cskk-hankakukana.png
│ │ ├── cskk-hiragana.png
│ │ ├── cskk-katakana.png
│ │ ├── cskk-zenei.png
│ │ └── cskk.png
│ ├── 32x32
│ └── apps
│ │ ├── cskk-ascii.png
│ │ ├── cskk-hankakukana.png
│ │ ├── cskk-hiragana.png
│ │ ├── cskk-katakana.png
│ │ ├── cskk-zenei.png
│ │ └── cskk.png
│ └── 48x48
│ └── apps
│ ├── cskk-ascii.png
│ ├── cskk-hankakukana.png
│ ├── cskk-hiragana.png
│ ├── cskk-katakana.png
│ ├── cskk-zenei.png
│ └── cskk.png
├── development.org
├── gui
├── CMakeLists.txt
├── adddictdialog.cpp
├── adddictdialog.h
├── adddictdialog.ui
├── cskk-config.json
├── dictmodel.cpp
├── dictmodel.h
├── dictwidget.cpp
├── dictwidget.h
├── dictwidget.ui
├── main.cpp
└── main.h
├── org.fcitx.Fcitx5.Addon.Cskk.metainfo.xml.in
├── po
├── CMakeLists.txt
├── LINGUAS
├── de.po
├── fcitx5-cskk.pot
├── ja.po
├── ko.po
├── ru.po
├── vi.po
├── zh_CN.po
└── zh_TW.po
├── skk_dict_config.h.in
├── src
├── CMakeLists.txt
├── cskk-addon.conf.in.in
├── cskk.conf.in
├── cskk.cpp
├── cskk.h
├── cskkcandidatelist.cpp
├── cskkcandidatelist.h
├── cskkconfig.h
├── dictionary_list.in
└── log.h
└── test
├── CMakeLists.txt
├── basic_test.cpp
└── main.cpp
/.clang-format:
--------------------------------------------------------------------------------
1 | ---
2 | Language: Cpp
3 | BasedOnStyle: LLVM
4 | Standard: c++20
5 | ...
6 |
7 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: バグレポート Bug report
3 | about: バグ報告の方法 Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 | 日本語で書いてもらえると助かります。日本語へ機械翻訳するよりは英語で報告してもらえるとありがたいです。
10 |
11 | Japanese is recommended, but rather than using machine translation please write in English or your language translated to English.
12 |
13 |
14 | **バグの簡潔な説明 Describe the bug**
15 |
16 | まず、簡潔な短文でバグ内容を説明してください。
17 |
18 | A clear and concise description of what the bug is.
19 |
20 | **再現手順 To Reproduce**
21 |
22 | バグを再現する方法を説明してください。
23 | 1. 句読点を英英モードに設定する
24 | 2. 'a i u ,'と入力する
25 | 3. バグが発生する
26 |
27 | Steps to reproduce the behavior:
28 | 1. Go to '...'
29 | 2. Click on '....'
30 | 3. See error
31 |
32 | **期待した動作 Expected behavior**
33 |
34 | 再現手順を行うと本来ならば起こると思われる内容を説明してください。
35 |
36 | A clear and concise description of what you expected to happen.
37 |
38 | **動作環境 (次の内容を挙げてください) Environment (please complete the following information):**
39 |
40 | - cskkのバージョン Version [e.g. commit 1acf43, v0.2.0]
41 |
42 |
43 | **その他の情報 Additional context**
44 |
45 | バグ内容について、他の情報をこちらに説明してください。
46 |
47 | Add any other context about the problem here.
48 |
--------------------------------------------------------------------------------
/.github/workflows/build_pass.yml:
--------------------------------------------------------------------------------
1 | name: Build passes check
2 | on: [ push ]
3 |
4 | concurrency:
5 | group: "continuous_test"
6 | cancel-in-progress: true
7 |
8 | jobs:
9 | build-check:
10 | name: Build check
11 | runs-on: ubuntu-22.04
12 | steps:
13 | - name: checkout
14 | uses: actions/checkout@v3
15 | with:
16 | submodules: recursive
17 | - name: check fcitx5-cskk version
18 | id: version
19 | run: |
20 | echo version=`bin/version.sh` >> ${GITHUB_OUTPUT}
21 | - name: check cskk version
22 | id: cskk_version
23 | run: |
24 | echo cskk_version=`bin/cskk_version.sh` >> ${GITHUB_OUTPUT}
25 | - name: Download & install libcskk
26 | run: |
27 | wget https://github.com/naokiri/cskk/releases/download/v${{ steps.cskk_version.outputs.cskk_version }}/libcskk_${{ steps.cskk_version.outputs.cskk_version }}_amd64.deb
28 | sudo apt-get install ./libcskk_${{ steps.cskk_version.outputs.cskk_version }}_amd64.deb
29 | - name: Install required libs and dependencies
30 | run: |
31 | sudo apt-get update
32 | sudo apt-get install gettext cmake extra-cmake-modules fcitx5-modules-dev libfcitx5core-dev qtbase5-dev libfcitx5-qt-dev
33 | - name: Build
34 | uses: ashutoshvarma/action-cmake-build@master
35 | with:
36 | build-dir: ${{ runner.workspace }}/build
37 | cc: gcc
38 | cxx: g++
39 | build-type: Release
40 | run-test: false
41 | configure-options: -DFCITX_INSTALL_USE_FCITX_SYS_PATHS=ON -DUSE_QT6=Off
42 | build-options: --verbose
43 |
--------------------------------------------------------------------------------
/.github/workflows/check.yml:
--------------------------------------------------------------------------------
1 | name: CI
2 | on:
3 | push:
4 | branches:
5 | - master
6 | pull_request:
7 | branches:
8 | - master
9 | jobs:
10 | clang-format:
11 | name: Check clang-format
12 | runs-on: ubuntu-latest
13 | container: archlinux:latest
14 | steps:
15 | - name: Install dependencies
16 | run: |
17 | pacman -Syu --noconfirm git clang diffutils
18 | git config --global --add safe.directory $GITHUB_WORKSPACE
19 | - uses: actions/checkout@v4
20 | - uses: fcitx/github-actions@clang-format
21 | check:
22 | name: Build and test
23 | needs: clang-format
24 | runs-on: ubuntu-latest
25 | container: archlinux:latest
26 | strategy:
27 | fail-fast: false
28 | matrix:
29 | compiler: [gcc, clang]
30 | include:
31 | - compiler: gcc
32 | cxx_compiler: g++
33 | - compiler: clang
34 | cxx_compiler: clang++
35 | env:
36 | CC: ${{ matrix.compiler }}
37 | CXX: ${{ matrix.cxx_compiler }}
38 | steps:
39 | - name: Install dependencies
40 | run: |
41 | pacman -Syu --noconfirm base-devel clang cmake ninja extra-cmake-modules fmt libuv boost git qt6-base qt6-wayland libxkbcommon skk-jisyo cargo-c cbindgen
42 | - uses: actions/checkout@v4
43 | with:
44 | repository: fcitx/fcitx5
45 | path: fcitx5
46 | - name: Cache fcitx5 data files
47 | uses: actions/cache@v4
48 | with:
49 | path: 'fcitx5/**/*.tar.*'
50 | key: ${{ runner.os }}-${{ hashFiles('fcitx5/src/modules/spell/CMakeLists.txt')
51 | }}
52 | - name: Build and Install fcitx5
53 | uses: fcitx/github-actions@cmake
54 | with:
55 | path: fcitx5
56 | cmake-option: >-
57 | -DENABLE_KEYBOARD=Off -DENABLE_X11=Off -DENABLE_WAYLAND=Off -DENABLE_ENCHANT=Off
58 | -DENABLE_DBUS=Off -DENABLE_SERVER=Off -DENABLE_EMOJI=Off -DUSE_SYSTEMD=Off
59 | - uses: actions/checkout@v4
60 | with:
61 | repository: fcitx/fcitx5-qt
62 | path: fcitx5-qt
63 | - name: Build and Install fcitx5-qt
64 | uses: fcitx/github-actions@cmake
65 | with:
66 | repository: fcitx/fcitx5-qt
67 | path: fcitx5-qt
68 | cmake-option: >-
69 | -DENABLE_QT4=Off -DENABLE_QT5=Off -DENABLE_QT6=On
70 | - uses: actions/checkout@v4
71 | with:
72 | repository: naokiri/cskk
73 | path: cskk
74 | - uses: actions/cache@v3
75 | with:
76 | path: |
77 | ~/.cargo/bin/
78 | ~/.cargo/registry/index/
79 | ~/.cargo/registry/cache/
80 | ~/.cargo/git/db/
81 | key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
82 | - name: Build and install cskk
83 | shell: bash
84 | run: "cd cskk\ncargo cinstall --release --prefix=/usr \n"
85 | - uses: actions/checkout@v4
86 | with:
87 | path: fcitx5-cskk
88 | - name: Init CodeQL
89 | uses: github/codeql-action/init@v3
90 | with:
91 | languages: cpp
92 | source-root: fcitx5-cskk
93 | - name: Build and Install fcitx5-cskk
94 | uses: fcitx/github-actions@cmake
95 | with:
96 | path: fcitx5-cskk
97 | cmake-option: >-
98 | -DENABLE_QT=On -DUSE_QT6=On
99 | - name: Test
100 | run: |
101 | ctest --test-dir fcitx5-cskk/build
102 | - name: CodeQL Analysis
103 | uses: github/codeql-action/analyze@v2
104 |
--------------------------------------------------------------------------------
/.github/workflows/clang-format-check.yml:
--------------------------------------------------------------------------------
1 | name: clang-format Check
2 | on: [ pull_request ]
3 | jobs:
4 | formatting-check:
5 | name: Formatting Check
6 | runs-on: ubuntu-latest
7 | strategy:
8 | matrix:
9 | path:
10 | - 'src'
11 | steps:
12 | - uses: actions/checkout@v3
13 | - name: Run clang-format style check for C/C++ programs.
14 | uses: jidicula/clang-format-action@v4.6.2
15 | with:
16 | check-path: ${{ matrix.path }}
--------------------------------------------------------------------------------
/.github/workflows/release.yml:
--------------------------------------------------------------------------------
1 | name: Release x86_64 deb artifact on release published
2 | on:
3 | release:
4 | types:
5 | - published
6 | jobs:
7 | Build:
8 | runs-on: ubuntu-22.04
9 | # strategy:
10 | # matrix:
11 | # cskk_ver: [0.8.1]
12 | steps:
13 | - name: checkout
14 | uses: actions/checkout@v3
15 | with:
16 | submodules: recursive
17 | - name: check fcitx5-cskk version
18 | id: version
19 | run: |
20 | echo version=`bin/version.sh` >> ${GITHUB_OUTPUT}
21 | - name: check cskk version
22 | id: cskk_version
23 | run: |
24 | echo cskk_version=`bin/cskk_version.sh` >> ${GITHUB_OUTPUT}
25 | - name: check fcitx5-cskk version exists in metainfo
26 | run: |
27 | bin/metainfo_version.sh
28 | - name: Check release tag matches version
29 | run: test "refs/tags/v${{ steps.version.outputs.version }}" = ${{ github.ref }}
30 | - name: Download & install libcskk
31 | run: |
32 | wget https://github.com/naokiri/cskk/releases/download/v${{ steps.cskk_version.outputs.cskk_version }}/libcskk_${{ steps.cskk_version.outputs.cskk_version }}_amd64.deb
33 | sudo apt-get install ./libcskk_${{ steps.cskk_version.outputs.cskk_version }}_amd64.deb
34 | - name: Install required libs and dependencies
35 | run: |
36 | sudo apt-get update
37 | sudo apt-get install extra-cmake-modules libfcitx5core-dev qtbase5-dev libfcitx5-qt-dev gettext
38 | - name: Build
39 | uses: ashutoshvarma/action-cmake-build@master
40 | with:
41 | build-dir: ${{ runner.workspace }}/build
42 | cc: gcc
43 | cxx: c++
44 | build-type: Release
45 | run-test: false
46 | configure-options: -DFCITX_INSTALL_USE_FCITX_SYS_PATHS=ON
47 | build-options: --verbose
48 | - name: Pack deb
49 | run: |
50 | cd ${{ runner.workspace }}/build
51 | cpack -G DEB -DFCITX_INSTALL_USE_FCITX_SYS_PATHS=On
52 | - name: Attatch artifact to Release
53 | uses: softprops/action-gh-release@v1
54 | with:
55 | files: |
56 | ${{ runner.workspace }}/fcitx5-cskk/_packages/fcitx5-cskk_${{ steps.version.outputs.version }}_amd64.deb
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Prerequisites
2 | *.d
3 |
4 | # Compiled Object files
5 | *.slo
6 | *.lo
7 | *.o
8 | *.obj
9 |
10 | # Precompiled Headers
11 | *.gch
12 | *.pch
13 |
14 | # Compiled Dynamic libraries
15 | *.so
16 | *.dylib
17 | *.dll
18 |
19 | # Fortran module files
20 | *.mod
21 | *.smod
22 |
23 | # Compiled Static libraries
24 | *.lai
25 | *.la
26 | *.a
27 | *.lib
28 |
29 | # Executables
30 | *.exe
31 | *.out
32 | *.app
33 |
34 | # cmake build dirs
35 | cmake-build-*/
36 | build/
37 | _packages/
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "third_party/googletest"]
2 | path = third_party/googletest
3 | url = https://github.com/google/googletest.git
4 |
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.13)
2 | cmake_policy(SET CMP0063 NEW)
3 | project(fcitx5-cskk VERSION 1.2.0)
4 | set(REQUIIRED_FCITX_VERSION 5.1.13)
5 | set(CMAKE_CXX_FLAGS "-Wall")
6 | set(CMAKE_CXX_STANDARD 17)
7 | IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
8 | SET(CMAKE_INSTALL_PREFIX /usr CACHE PATH "Install directory for non-fcitx path stuffs" FORCE)
9 | ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
10 | message ("CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}")
11 |
12 | find_package(ECM 1.0.0 REQUIRED)
13 | set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
14 | option(ENABLE_QT "Enable Qt for GUI configuration" On)
15 | option(USE_QT6 "Build against Qt6" On)
16 | include(FeatureSummary)
17 | include(GNUInstallDirs)
18 | include(ECMUninstallTarget)
19 | set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
20 |
21 | # See Fcitx5UtilsConfig.cmake
22 | add_definitions(-DFCITX_INSTALL_USE_FCITX_SYS_PATHS=ON)
23 | find_package(PkgConfig REQUIRED)
24 | find_package(Fcitx5Core ${REQUIIRED_FCITX_VERSION} REQUIRED)
25 | find_package(Fcitx5Utils ${REQUIIRED_FCITX_VERSION} REQUIRED)
26 |
27 | # GITHUB_ACTION_BUILD_CSKK_VERSION=3.0.0
28 | pkg_check_modules(LIBCSKK REQUIRED IMPORTED_TARGET "cskk>=3.0")
29 |
30 | include("${FCITX_INSTALL_CMAKECONFIG_DIR}/Fcitx5Utils/Fcitx5CompilerSettings.cmake")
31 |
32 | # GUI related libs
33 | if (ENABLE_QT)
34 | if (USE_QT6)
35 | set(QT_MAJOR_VERSION 6)
36 | find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
37 | else()
38 | set(QT_MAJOR_VERSION 5)
39 | find_package(Qt5 5.7 REQUIRED COMPONENTS Core Gui Widgets)
40 | endif()
41 | find_package(Fcitx5Qt${QT_MAJOR_VERSION}WidgetsAddons REQUIRED)
42 | endif()
43 |
44 | # make default value header searchable
45 | set(SKK_DICT_DEFAULT_PATH "/usr/share/skk/SKK-JISYO.L" CACHE STRING "Default path of SKK Dictionary file")
46 | set(SKK_DICT_DEFAULT_ENCODING "euc-jp" CACHE STRING "Default encoding of SKK Dictionary file")
47 | configure_file("${CMAKE_CURRENT_SOURCE_DIR}/skk_dict_config.h.in"
48 | "${CMAKE_CURRENT_BINARY_DIR}/skk_dict_config.h"
49 | IMMEDIATE @ONLY)
50 | include_directories(${CMAKE_CURRENT_BINARY_DIR})
51 |
52 | # Googletest submodule setup
53 | find_package(Git QUIET)
54 | if (GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
55 | enable_testing()
56 | option(GOOGLETEST "Check Google Test during build" OFF)
57 | # -DGOOGLETEST=on を付けて実行したらsubmoduleを最新版にする
58 | if (GOOGLETEST)
59 | message(STATUS "Submodule update")
60 | execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
61 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
62 | RESULT_VARIABLE GIT_SUBMOD_RESULT)
63 | if (NOT GIT_SUBMOD_RESULT EQUAL "0")
64 | message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
65 | endif ()
66 | endif ()
67 | endif ()
68 |
69 | # Currently test doesn't exist, so turning off.
70 | #if (NOT EXISTS "${PROJECT_SOURCE_DIR}/third_party/googletest/CMakeLists.txt")
71 | # message(FATAL_ERROR "The submodules were not downloaded! GOOGLETEST was turned off or failed. Please update submodules (git submodules update --init --recurseive) and try again.")
72 | #endif ()
73 |
74 |
75 | # Not sure what this does. Need translation?
76 | find_package(Gettext REQUIRED)
77 | add_definitions(-DFCITX_GETTEXT_DOMAIN=\"fcitx5-cskk\" -D_GNU_SOURCE)
78 | fcitx5_add_i18n_definition()
79 |
80 | # Don't remove RPATH on installing/packing so that fcitx can find cskk library
81 | set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
82 |
83 | add_subdirectory(src)
84 | add_subdirectory(data)
85 | add_subdirectory(po)
86 | add_subdirectory(test)
87 | add_subdirectory(gui)
88 |
89 | # This is a system file so it's OK to install in CMAKE_INSTALL_DATADIR
90 | fcitx5_translate_desktop_file(
91 | org.fcitx.Fcitx5.Addon.Cskk.metainfo.xml.in
92 | org.fcitx.Fcitx5.Addon.Cskk.metainfo.xml XML)
93 | install(FILES "${CMAKE_CURRENT_BINARY_DIR}/org.fcitx.Fcitx5.Addon.Cskk.metainfo.xml" DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/metainfo)
94 |
95 | feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
96 |
97 | include(DebPack)
98 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/Messages.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | gen_pot cxx:appdata:ui:desktop fcitx5-cskk po .
3 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ##  fcitx5-cskk
2 | [Fcitx5](https://github.com/fcitx/fcitx5) でskk入力方式で入力するためのインプットメソッドプラグイン。
3 |
4 | [libcskk](https://github.com/naokiri/cskk) を用いる。
5 |
6 | 説明書は[CSKK Docs](https://naokiri.github.io/cskk-docs/)に公開。
7 |
8 | ## インストール方法
9 |
10 | ### Required libraries
11 |
12 | Same as other fcitx5 plugin project.
13 |
14 | For example in Debian,
15 |
16 | $ sudo apt install gettext cmake extra-cmake-modules fcitx5-modules-dev qtbase5-dev qtdeclarative5-dev libfcitx5-qt-dev
17 |
18 | For full features.
19 |
20 | ### Install
21 |
22 | $ rm -rf ./build
23 | $ mkdir build
24 | $ cd build
25 | $ cmake ..
26 | $ make && make install
27 |
28 | システムによっては、アイコン類の読み込みのために再起動が必要です。
29 |
30 | ## アンインストール方法
31 |
32 | $ cd build
33 | $ make uninstall
34 |
35 | ## テスト実行方法
36 |
37 | $ rm -rf ./build
38 | $ mkdir build
39 | $ cd build
40 | $ cmake -DGOOGLETEST=on ..
41 | $ make runTest
42 | $ ./test/runTest
43 |
44 | GOOGLETESTフラグはキャッシュされるのでライブラリ生成時には注意が必要
45 |
46 | ## 開発状況
47 | ### 実装予定(いつかは)
48 | - [x] ひらがな・カタカナ・漢字入力
49 | - [x] 変換候補リスト表示
50 | - [x] 変換候補リスト ラベル選択
51 |
52 | - 設定項目
53 | - [x] 入力モード初期値設定
54 | - [x] 漢字変換候補ラベル((a,b,c...), (1,2,3...) etc.)
55 | - [x] 句読点スタイル ((,.),(、。),(、.)... )
56 | - [x] 変換候補リスト表示までの変換候補数
57 | - [x] 変換候補リストのサイズ
58 |
59 | ### 実装内容・予定不明
60 | - [x] 優先度、読み書き可不可の辞書リスト設定
61 |
62 |
63 | ### 辞書
64 | 辞書の形式は [skk-dev](https://skk-dev.github.io/dict/) で配布されているものを想定している。
65 |
66 | デフォルトでは/usr/share/skk/SKK-JISYO.L が euc-jp の読み取り専用辞書として使われる。
67 |
68 | 辞書はfcitx5のconfigtoolから設定可能。
69 |
70 |
71 | 直接編集する場合は `~/.local/share/fcitx5/cskk/dictionary_list` に保存されている。
72 | ','区切りのkey=valueリストで、type,file,mode,encoding,completeを指定する。
73 | 例として、
74 |
75 | type=file,file=/usr/share/skk/SKK-JISYO.L,mode=readonly,encoding=euc-jp,complete=false
76 | type=file,file=$FCITX_CONFIG_DIR/cskk/user.dict,mode=readwrite,complete=true
77 |
78 | typeはfileのみ。必須。
79 |
80 | fileはファイルへのパスを指定する。必須。唯一文頭でのみ$FCITX_CONFIG_DIRのみ変数として使え、fcitx5の設定ディレクトリ(通常は~/.local/share/fcitx5)を指す。
81 |
82 | modeはreadonlyまたはreadwrite。必須。
83 |
84 | encodingに指定できる内容はlibcskkに準じる。必須。少なくとも"euc-jp"や"utf-8"が使える。
85 |
86 | completeは補完機能に用いるかどうか。trueかfalse。デフォルトはfalse。
87 |
88 |
89 |
90 | ## 著作権表示
91 |
92 | Copyright (C) 2021 Naoaki Iwakiri
93 |
94 | ## ライセンス
95 | GNU GPL v3 or later.
96 |
97 | This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
98 | License as published by the Free Software Foundation, either version 3 of the License, or
99 | (at your option) any later version.
100 |
101 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
102 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
103 |
104 | You should have received a copy of the GNU General Public License along with this program. If not,
105 | see .
106 |
107 |
--------------------------------------------------------------------------------
/bin/cskk_version.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Run from repository root and output cskk version from CMakeLists.txt
3 | # Helper for release automation
4 | set -e
5 | cat CMakeLists.txt | sed -n -e "s/# GITHUB_ACTION_BUILD_CSKK_VERSION=\(.*\)/\1/p"
--------------------------------------------------------------------------------
/bin/metainfo_version.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Run from repository root and check the CMakeList.txt version exists in metainfo.
3 | # Helper for release automation
4 | set -e
5 | version=`bin/version.sh`
6 | grep "release version=\"$version\"" org.fcitx.Fcitx5.Addon.Cskk.metainfo.xml.in
--------------------------------------------------------------------------------
/bin/version.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Run from repository root and output version from CMakeLists.txt
3 | # Helper for release automation
4 | set -e
5 | cat CMakeLists.txt | sed -n -e "s/project(fcitx5-cskk VERSION \(.*\))/\1/p"
--------------------------------------------------------------------------------
/cmake/DebPack.cmake:
--------------------------------------------------------------------------------
1 | # Generate deb package by 'cpack -G DEB'
2 |
3 | set(CPACK_PACKAGE_NAME ${PROJECT_NAME}
4 | CACHE STRING "The resulting package name"
5 | )
6 |
7 |
8 | set(CPACK_VERBATIM_VARIABLES YES)
9 |
10 | set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME})
11 | SET(CPACK_OUTPUT_FILE_PREFIX "${CMAKE_SOURCE_DIR}/_packages")
12 |
13 | set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/local/")#/${CMAKE_PROJECT_VERSION}")
14 |
15 | set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
16 | set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
17 | set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
18 |
19 | set(CPACK_PACKAGE_CONTACT "naokiri@gmail.com")
20 | set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Naoaki Iwakiri")
21 |
22 | set(CPACK_DEBIAN_PACKAGE_DEPENDS "libcskk (>= 0.8.0), fcitx5 (>=5.0.6)")
23 | set(CPACK_DEBIAN_PACKAGE_SUGGESTS "skkdic, skkdic-extra")
24 |
25 | set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
26 | set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
27 |
28 | # package name for deb. If set, then instead of some-application-0.9.2-Linux.deb
29 | # you'll get some-application_0.9.2_amd64.deb (note the underscores too)
30 | set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
31 | # that is if you want every group to have its own package,
32 | # although the same will happen if this is not set (so it defaults to ONE_PER_GROUP)
33 | # and CPACK_DEB_COMPONENT_INSTALL is set to YES
34 | set(CPACK_COMPONENTS_GROUPING ALL_COMPONENTS_IN_ONE)#ONE_PER_GROUP)
35 | # without this you won't be able to pack only specified component
36 | set(CPACK_DEB_COMPONENT_INSTALL YES)
37 |
38 | include(CPack)
--------------------------------------------------------------------------------
/data/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Icon is not a fcitx component, so install in CMAKE_INSTALL_DATADIR
2 | foreach(size 24 32 48 256)
3 | install(DIRECTORY icon/${size}x${size} DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor"
4 | PATTERN .* EXCLUDE
5 | PATTERN *~ EXCLUDE)
6 | endforeach(size 24 32 48 256)
7 |
--------------------------------------------------------------------------------
/data/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Creative Commons Legal Code
2 |
3 | CC0 1.0 Universal
4 |
5 | CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
6 | LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
7 | ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
8 | INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
9 | REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
10 | PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
11 | THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
12 | HEREUNDER.
13 |
14 | Statement of Purpose
15 |
16 | The laws of most jurisdictions throughout the world automatically confer
17 | exclusive Copyright and Related Rights (defined below) upon the creator
18 | and subsequent owner(s) (each and all, an "owner") of an original work of
19 | authorship and/or a database (each, a "Work").
20 |
21 | Certain owners wish to permanently relinquish those rights to a Work for
22 | the purpose of contributing to a commons of creative, cultural and
23 | scientific works ("Commons") that the public can reliably and without fear
24 | of later claims of infringement build upon, modify, incorporate in other
25 | works, reuse and redistribute as freely as possible in any form whatsoever
26 | and for any purposes, including without limitation commercial purposes.
27 | These owners may contribute to the Commons to promote the ideal of a free
28 | culture and the further production of creative, cultural and scientific
29 | works, or to gain reputation or greater distribution for their Work in
30 | part through the use and efforts of others.
31 |
32 | For these and/or other purposes and motivations, and without any
33 | expectation of additional consideration or compensation, the person
34 | associating CC0 with a Work (the "Affirmer"), to the extent that he or she
35 | is an owner of Copyright and Related Rights in the Work, voluntarily
36 | elects to apply CC0 to the Work and publicly distribute the Work under its
37 | terms, with knowledge of his or her Copyright and Related Rights in the
38 | Work and the meaning and intended legal effect of CC0 on those rights.
39 |
40 | 1. Copyright and Related Rights. A Work made available under CC0 may be
41 | protected by copyright and related or neighboring rights ("Copyright and
42 | Related Rights"). Copyright and Related Rights include, but are not
43 | limited to, the following:
44 |
45 | i. the right to reproduce, adapt, distribute, perform, display,
46 | communicate, and translate a Work;
47 | ii. moral rights retained by the original author(s) and/or performer(s);
48 | iii. publicity and privacy rights pertaining to a person's image or
49 | likeness depicted in a Work;
50 | iv. rights protecting against unfair competition in regards to a Work,
51 | subject to the limitations in paragraph 4(a), below;
52 | v. rights protecting the extraction, dissemination, use and reuse of data
53 | in a Work;
54 | vi. database rights (such as those arising under Directive 96/9/EC of the
55 | European Parliament and of the Council of 11 March 1996 on the legal
56 | protection of databases, and under any national implementation
57 | thereof, including any amended or successor version of such
58 | directive); and
59 | vii. other similar, equivalent or corresponding rights throughout the
60 | world based on applicable law or treaty, and any national
61 | implementations thereof.
62 |
63 | 2. Waiver. To the greatest extent permitted by, but not in contravention
64 | of, applicable law, Affirmer hereby overtly, fully, permanently,
65 | irrevocably and unconditionally waives, abandons, and surrenders all of
66 | Affirmer's Copyright and Related Rights and associated claims and causes
67 | of action, whether now known or unknown (including existing as well as
68 | future claims and causes of action), in the Work (i) in all territories
69 | worldwide, (ii) for the maximum duration provided by applicable law or
70 | treaty (including future time extensions), (iii) in any current or future
71 | medium and for any number of copies, and (iv) for any purpose whatsoever,
72 | including without limitation commercial, advertising or promotional
73 | purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
74 | member of the public at large and to the detriment of Affirmer's heirs and
75 | successors, fully intending that such Waiver shall not be subject to
76 | revocation, rescission, cancellation, termination, or any other legal or
77 | equitable action to disrupt the quiet enjoyment of the Work by the public
78 | as contemplated by Affirmer's express Statement of Purpose.
79 |
80 | 3. Public License Fallback. Should any part of the Waiver for any reason
81 | be judged legally invalid or ineffective under applicable law, then the
82 | Waiver shall be preserved to the maximum extent permitted taking into
83 | account Affirmer's express Statement of Purpose. In addition, to the
84 | extent the Waiver is so judged Affirmer hereby grants to each affected
85 | person a royalty-free, non transferable, non sublicensable, non exclusive,
86 | irrevocable and unconditional license to exercise Affirmer's Copyright and
87 | Related Rights in the Work (i) in all territories worldwide, (ii) for the
88 | maximum duration provided by applicable law or treaty (including future
89 | time extensions), (iii) in any current or future medium and for any number
90 | of copies, and (iv) for any purpose whatsoever, including without
91 | limitation commercial, advertising or promotional purposes (the
92 | "License"). The License shall be deemed effective as of the date CC0 was
93 | applied by Affirmer to the Work. Should any part of the License for any
94 | reason be judged legally invalid or ineffective under applicable law, such
95 | partial invalidity or ineffectiveness shall not invalidate the remainder
96 | of the License, and in such case Affirmer hereby affirms that he or she
97 | will not (i) exercise any of his or her remaining Copyright and Related
98 | Rights in the Work or (ii) assert any associated claims and causes of
99 | action with respect to the Work, in either case contrary to Affirmer's
100 | express Statement of Purpose.
101 |
102 | 4. Limitations and Disclaimers.
103 |
104 | a. No trademark or patent rights held by Affirmer are waived, abandoned,
105 | surrendered, licensed or otherwise affected by this document.
106 | b. Affirmer offers the Work as-is and makes no representations or
107 | warranties of any kind concerning the Work, express, implied,
108 | statutory or otherwise, including without limitation warranties of
109 | title, merchantability, fitness for a particular purpose, non
110 | infringement, or the absence of latent or other defects, accuracy, or
111 | the present or absence of errors, whether or not discoverable, all to
112 | the greatest extent permissible under applicable law.
113 | c. Affirmer disclaims responsibility for clearing rights of other persons
114 | that may apply to the Work or any use thereof, including without
115 | limitation any person's Copyright and Related Rights in the Work.
116 | Further, Affirmer disclaims responsibility for obtaining any necessary
117 | consents, permissions or other rights required for any use of the
118 | Work.
119 | d. Affirmer understands and acknowledges that Creative Commons is not a
120 | party to this document and has no duty or obligation with respect to
121 | this CC0 or use of the Work.
122 |
--------------------------------------------------------------------------------
/data/README.txt:
--------------------------------------------------------------------------------
1 | The files under data directory are licensed under cc0-1.0 in addition to the license of the main repository.
2 | You may choose to use them under CC0 to use as a data file, or to use under the main repository's license as a part of the code and the program.
3 |
4 | To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to these icon images to the public domain worldwide. These icon images are distributed without any warranty.
5 | You should have received a copy of the CC0 Public Domain Dedication along with these icons. If not, see .
--------------------------------------------------------------------------------
/data/icon/24x24/apps/cskk-ascii.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fcitx/fcitx5-cskk/6d4407c64df46423c378afeefa71bda3282a7cec/data/icon/24x24/apps/cskk-ascii.png
--------------------------------------------------------------------------------
/data/icon/24x24/apps/cskk-hankakukana.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fcitx/fcitx5-cskk/6d4407c64df46423c378afeefa71bda3282a7cec/data/icon/24x24/apps/cskk-hankakukana.png
--------------------------------------------------------------------------------
/data/icon/24x24/apps/cskk-hiragana.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fcitx/fcitx5-cskk/6d4407c64df46423c378afeefa71bda3282a7cec/data/icon/24x24/apps/cskk-hiragana.png
--------------------------------------------------------------------------------
/data/icon/24x24/apps/cskk-katakana.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fcitx/fcitx5-cskk/6d4407c64df46423c378afeefa71bda3282a7cec/data/icon/24x24/apps/cskk-katakana.png
--------------------------------------------------------------------------------
/data/icon/24x24/apps/cskk-zenei.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fcitx/fcitx5-cskk/6d4407c64df46423c378afeefa71bda3282a7cec/data/icon/24x24/apps/cskk-zenei.png
--------------------------------------------------------------------------------
/data/icon/24x24/apps/cskk.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fcitx/fcitx5-cskk/6d4407c64df46423c378afeefa71bda3282a7cec/data/icon/24x24/apps/cskk.png
--------------------------------------------------------------------------------
/data/icon/256x256/apps/cskk-ascii.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fcitx/fcitx5-cskk/6d4407c64df46423c378afeefa71bda3282a7cec/data/icon/256x256/apps/cskk-ascii.png
--------------------------------------------------------------------------------
/data/icon/256x256/apps/cskk-hankakukana.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fcitx/fcitx5-cskk/6d4407c64df46423c378afeefa71bda3282a7cec/data/icon/256x256/apps/cskk-hankakukana.png
--------------------------------------------------------------------------------
/data/icon/256x256/apps/cskk-hiragana.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fcitx/fcitx5-cskk/6d4407c64df46423c378afeefa71bda3282a7cec/data/icon/256x256/apps/cskk-hiragana.png
--------------------------------------------------------------------------------
/data/icon/256x256/apps/cskk-katakana.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fcitx/fcitx5-cskk/6d4407c64df46423c378afeefa71bda3282a7cec/data/icon/256x256/apps/cskk-katakana.png
--------------------------------------------------------------------------------
/data/icon/256x256/apps/cskk-zenei.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fcitx/fcitx5-cskk/6d4407c64df46423c378afeefa71bda3282a7cec/data/icon/256x256/apps/cskk-zenei.png
--------------------------------------------------------------------------------
/data/icon/256x256/apps/cskk.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fcitx/fcitx5-cskk/6d4407c64df46423c378afeefa71bda3282a7cec/data/icon/256x256/apps/cskk.png
--------------------------------------------------------------------------------
/data/icon/32x32/apps/cskk-ascii.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fcitx/fcitx5-cskk/6d4407c64df46423c378afeefa71bda3282a7cec/data/icon/32x32/apps/cskk-ascii.png
--------------------------------------------------------------------------------
/data/icon/32x32/apps/cskk-hankakukana.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fcitx/fcitx5-cskk/6d4407c64df46423c378afeefa71bda3282a7cec/data/icon/32x32/apps/cskk-hankakukana.png
--------------------------------------------------------------------------------
/data/icon/32x32/apps/cskk-hiragana.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fcitx/fcitx5-cskk/6d4407c64df46423c378afeefa71bda3282a7cec/data/icon/32x32/apps/cskk-hiragana.png
--------------------------------------------------------------------------------
/data/icon/32x32/apps/cskk-katakana.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fcitx/fcitx5-cskk/6d4407c64df46423c378afeefa71bda3282a7cec/data/icon/32x32/apps/cskk-katakana.png
--------------------------------------------------------------------------------
/data/icon/32x32/apps/cskk-zenei.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fcitx/fcitx5-cskk/6d4407c64df46423c378afeefa71bda3282a7cec/data/icon/32x32/apps/cskk-zenei.png
--------------------------------------------------------------------------------
/data/icon/32x32/apps/cskk.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fcitx/fcitx5-cskk/6d4407c64df46423c378afeefa71bda3282a7cec/data/icon/32x32/apps/cskk.png
--------------------------------------------------------------------------------
/data/icon/48x48/apps/cskk-ascii.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fcitx/fcitx5-cskk/6d4407c64df46423c378afeefa71bda3282a7cec/data/icon/48x48/apps/cskk-ascii.png
--------------------------------------------------------------------------------
/data/icon/48x48/apps/cskk-hankakukana.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fcitx/fcitx5-cskk/6d4407c64df46423c378afeefa71bda3282a7cec/data/icon/48x48/apps/cskk-hankakukana.png
--------------------------------------------------------------------------------
/data/icon/48x48/apps/cskk-hiragana.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fcitx/fcitx5-cskk/6d4407c64df46423c378afeefa71bda3282a7cec/data/icon/48x48/apps/cskk-hiragana.png
--------------------------------------------------------------------------------
/data/icon/48x48/apps/cskk-katakana.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fcitx/fcitx5-cskk/6d4407c64df46423c378afeefa71bda3282a7cec/data/icon/48x48/apps/cskk-katakana.png
--------------------------------------------------------------------------------
/data/icon/48x48/apps/cskk-zenei.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fcitx/fcitx5-cskk/6d4407c64df46423c378afeefa71bda3282a7cec/data/icon/48x48/apps/cskk-zenei.png
--------------------------------------------------------------------------------
/data/icon/48x48/apps/cskk.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fcitx/fcitx5-cskk/6d4407c64df46423c378afeefa71bda3282a7cec/data/icon/48x48/apps/cskk.png
--------------------------------------------------------------------------------
/development.org:
--------------------------------------------------------------------------------
1 | Notes
2 | * Dogfooding
3 | ** Ubuntu Gnome
4 | Exit the default fcitx5 and then run
5 | fcitx5 -d --verbose=*=5 or --verbose={categoryname}=5,{categoryname}=5
6 |
7 | Use with care that category:keytrace will output my passwords inputting to browser etc to error logs.
8 | On last resort, hook into imconfig's run im script /usr/share/im-config/data/??_fcitx5.rc or /usr/bin/fcitx5.
9 |
10 | ** Dictionary place
11 | As a desktop app following the standard, data should better be loaded from subdir for this component only under XDG_DATA_HOME for personal dictionary and XDG_DATA_DIRS for static common dictionary.
12 | Although, emacs + SKK users tend to share dictionary file among ddskk and IME so this might have to be fixed to be configurable in the future.
13 |
14 | ** Some class name
15 | Putting Fcitx in class name may seem redundant, but it helps distinguish this fcitx5-cskk addon from cskk the library.
16 | Put 'FcitxCskk' as prefix for class names.
17 |
18 | ** Icon
19 | See src/lib/fcitx/icontheme.h and related.
20 | Fcitx5 supports svg, png, xpm.
21 | Supports XDG icon specification. https://www.freedesktop.org/wiki/Specifications/icon-theme-spec/ but theme fallback in original way.
22 | Fcitx5 converts icon filename fcitx-foo to org.fcitx.Fcitx5.fcitx-foo automatically when built for flatpak and search the converted filename only as of fcitx v5.0.17
23 | Although, flatpak since v0.8.8 can use system icons, so this addon will workaround by ignoring that naming prefix.
24 |
25 | TODO for this project is to prepare a svg icon to accept scalable icons.
26 |
27 | ** Versioning
28 | Should update these files and then create a deploy on github
29 | - org.fcitx.Fcitx5.Addon.Cskk.metainfo.xml.in
30 | - CMakeLists.txt
31 | Following semver rule but with tweak same as rust lang's cargo.
32 | Initial development releases starting with "0.y.z" can treat changes in "y" as a major release, and "z" as a minor release.
33 |
34 | ** Shared lib places
35 | Fcitx5 finds addon from FCITX_ADDON_DIRS env var, a colon (':') separated dir list. fallbacks to FCITX_INSTALL_ADDONDIR configured on build.
36 | e.g. FCITX_ADDON_DIRS=build/src:/usr/lib/x86_64-linux-gnu/fcitx5 fcitx5 --verbose=*=5
37 |
38 | * Q
39 | ** How config works?
40 | Create Option class.
41 | Create a Configuration class.
42 | Override setConfig, getConfig.
43 | Set configurable on conf file.
44 |
45 |
46 | ** What is d_func and q_func in fcitx?
47 | Keeping lib binary interface same, access all data via d_ptr.
48 | Same reason, access all methods via q_ptr.
49 | Probably same as Qt library.
50 |
51 | ** conf and addon.conf
52 | What is Addon entry? name of lib? filename? fedora metainfo like name? What option is configurable here?
53 | fcitx5/src/lib/fcitx/addoninfo.cpp's list is addon.conf
54 |
55 |
56 | ** metainfo
57 | metainfo project group == Fcitx??
58 | https://docs.fedoraproject.org/en-US/packaging-guidelines/AppData/ doesn't define what each field means.
--------------------------------------------------------------------------------
/gui/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(CSKK_CONFIG_SRCS
2 | main.cpp
3 | dictwidget.cpp
4 | adddictdialog.cpp
5 | dictmodel.cpp
6 | )
7 |
8 | if (NOT ENABLE_QT)
9 | return()
10 | endif ()
11 |
12 | add_library(fcitx5-cskk-config
13 | MODULE ${CSKK_CONFIG_SRCS})
14 |
15 | set_target_properties(fcitx5-cskk-config PROPERTIES
16 | AUTOMOC TRUE
17 | AUTOUIC TRUE
18 | AUTOUIC_OPTIONS "-tr=fcitx::tr2fcitx;--include=fcitxqti18nhelper.h"
19 | )
20 | target_link_libraries(fcitx5-cskk-config
21 | Qt${QT_MAJOR_VERSION}::Core
22 | Qt${QT_MAJOR_VERSION}::Widgets
23 | Fcitx5Qt${QT_MAJOR_VERSION}::WidgetsAddons
24 | Fcitx5::Utils
25 | PkgConfig::LIBCSKK
26 | )
27 |
28 | # Must install to same lib dir that Fcitx5Utils specify using FCITX_*DIR so that fcitx5 can find.
29 | install(TARGETS fcitx5-cskk-config DESTINATION ${FCITX_INSTALL_LIBDIR}/fcitx5/qt${QT_MAJOR_VERSION})
30 |
--------------------------------------------------------------------------------
/gui/adddictdialog.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2013~2022 CSSlayer , Naoaki
3 | * Iwakiri
4 | *
5 | * SPDX-License-Identifier: GPL-3.0-or-later
6 | *
7 | */
8 |
9 | #include "adddictdialog.h"
10 | #include "dictmodel.h"
11 | #include "skk_dict_config.h"
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 |
21 | #define FCITX_CONFIG_DIR "$FCITX_CONFIG_DIR"
22 |
23 | namespace fcitx {
24 |
25 | const char *mode_type[] = {"readonly", "readwrite"};
26 |
27 | enum DictType { DictType_Static, DictType_User };
28 |
29 | AddDictDialog::AddDictDialog(QWidget *parent)
30 | : QDialog(parent), m_ui(std::make_unique()) {
31 | m_ui->setupUi(this);
32 | m_ui->typeComboBox->addItem(_("System"));
33 | m_ui->typeComboBox->addItem(_("User"));
34 | m_ui->typeComboBox->setCurrentIndex(1);
35 | // m_ui->completeNoRadio
36 |
37 | indexChanged();
38 |
39 | connect(m_ui->browseButton, &QPushButton::clicked, this,
40 | &AddDictDialog::browseClicked);
41 | connect(m_ui->typeComboBox,
42 | QOverload::of(&QComboBox::currentIndexChanged), this,
43 | &AddDictDialog::indexChanged);
44 | connect(m_ui->urlLineEdit, &QLineEdit::textChanged, this,
45 | &AddDictDialog::validate);
46 | connect(m_ui->encodingEdit, &QLineEdit::textChanged, this,
47 | &AddDictDialog::validate);
48 | }
49 |
50 | QMap AddDictDialog::dictionary() {
51 | int idx = m_ui->typeComboBox->currentIndex();
52 | idx = idx < 0 ? 0 : idx;
53 | idx = idx > 1 ? 0 : idx;
54 |
55 | QMap dict;
56 |
57 | dict["type"] = "file";
58 | dict["file"] = m_ui->urlLineEdit->text();
59 | dict["mode"] = mode_type[idx];
60 | dict["encoding"] = m_ui->encodingEdit->text();
61 | if (m_ui->completeYesRadio->isChecked()) {
62 | dict["complete"] = "true";
63 | } else {
64 | dict["complete"] = "false";
65 | }
66 |
67 | return dict;
68 | }
69 |
70 | void AddDictDialog::indexChanged() { validate(); }
71 |
72 | void AddDictDialog::validate() {
73 | const auto index = m_ui->typeComboBox->currentIndex();
74 | bool valid = true;
75 | switch (index) {
76 | case DictType_Static:
77 | case DictType_User:
78 | if (m_ui->urlLineEdit->text().isEmpty() ||
79 | m_ui->encodingEdit->text().isEmpty()) {
80 | valid = false;
81 | }
82 | break;
83 | }
84 | m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(valid);
85 | }
86 |
87 | void AddDictDialog::browseClicked() {
88 | QString path = m_ui->urlLineEdit->text();
89 | if (m_ui->typeComboBox->currentIndex() == DictType_Static) {
90 | QString dir;
91 | if (path.isEmpty()) {
92 | path = SKK_DICT_DEFAULT_PATH;
93 | }
94 | QFileInfo info(path);
95 | path = QFileDialog::getOpenFileName(this, _("Select Dictionary File"),
96 | info.path());
97 | } else {
98 | auto fcitxBasePath = stringutils::joinPath(
99 | StandardPath::global().userDirectory(StandardPath::Type::PkgData),
100 | "cskk");
101 | fs::makePath(fcitxBasePath);
102 | QString fcitxConfigBasePath =
103 | QDir::cleanPath(QString::fromStdString(fcitxBasePath));
104 |
105 | if (path.isEmpty()) {
106 | auto baseDataPath = stringutils::joinPath(
107 | StandardPath::global().userDirectory(StandardPath::Type::Data),
108 | "fcitx5-cskk");
109 | fs::makePath(baseDataPath);
110 | QString basePath = QDir::cleanPath(QString::fromStdString(baseDataPath));
111 | path = basePath;
112 | } else if (path.startsWith(FCITX_CONFIG_DIR "/")) {
113 |
114 | QDir dir(fcitxConfigBasePath);
115 | path = dir.filePath(path.mid(strlen(FCITX_CONFIG_DIR) + 1));
116 | }
117 | path =
118 | QFileDialog::getOpenFileName(this, _("Select Dictionary File"), path);
119 | if (path.startsWith(fcitxConfigBasePath + "/")) {
120 | path = FCITX_CONFIG_DIR + path.mid(fcitxConfigBasePath.length(), -1);
121 | }
122 | }
123 |
124 | if (!path.isEmpty()) {
125 | m_ui->urlLineEdit->setText(path);
126 | }
127 | validate();
128 | }
129 |
130 | void AddDictDialog::setDictionary(QMap &dict) {
131 | m_ui->urlLineEdit->setText(dict["file"]);
132 |
133 | for (size_t i = 0; i < FCITX_ARRAY_SIZE(mode_type); i++) {
134 | // It's OK to use stdstirng here. We only use latin-1.
135 | if (dict["mode"].toStdString() == mode_type[i]) {
136 | m_ui->typeComboBox->setCurrentIndex(i);
137 | }
138 | }
139 | m_ui->encodingEdit->setText(dict["encoding"]);
140 | if (dict["complete"] == "complete") {
141 | m_ui->completeYesRadio->setChecked(true);
142 | }
143 | }
144 |
145 | } // namespace fcitx
146 |
--------------------------------------------------------------------------------
/gui/adddictdialog.h:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2013~2022 CSSlayer , Naoaki
3 | * Iwakiri
4 | *
5 | * SPDX-License-Identifier: GPL-3.0-or-later
6 | *
7 | */
8 |
9 | #ifndef ADDDICTDIALOG_H
10 | #define ADDDICTDIALOG_H
11 |
12 | #include "ui_adddictdialog.h"
13 | #include
14 | #include
15 | #include
16 |
17 | namespace fcitx {
18 |
19 | class AddDictDialog : public QDialog {
20 | Q_OBJECT
21 | public:
22 | explicit AddDictDialog(QWidget *parent = 0);
23 | QMap dictionary();
24 | void setDictionary(QMap &dict);
25 |
26 | public Q_SLOTS:
27 | void browseClicked();
28 | void indexChanged();
29 | void validate();
30 |
31 | private:
32 | std::unique_ptr m_ui;
33 | };
34 |
35 | } // namespace fcitx
36 |
37 | #endif // ADDDICTDIALOG_H
38 |
--------------------------------------------------------------------------------
/gui/adddictdialog.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | AddDictDialog
4 |
5 |
6 |
7 | 0
8 | 0
9 | 507
10 | 202
11 |
12 |
13 |
14 | Dialog
15 |
16 |
17 | -
18 |
19 |
20 | 6
21 |
22 |
-
23 |
24 |
25 | &Type:
26 |
27 |
28 | typeComboBox
29 |
30 |
31 |
32 | -
33 |
34 |
35 |
36 | 0
37 | 0
38 |
39 |
40 |
41 |
42 | -
43 |
44 |
45 | &Path:
46 |
47 |
48 | urlLineEdit
49 |
50 |
51 |
52 | -
53 |
54 |
-
55 |
56 |
57 | -
58 |
59 |
60 |
61 |
62 |
63 |
64 | ..
65 |
66 |
67 |
68 |
69 |
70 | -
71 |
72 |
73 | Encoding:
74 |
75 |
76 |
77 | -
78 |
79 |
80 |
81 |
82 |
83 | euc-jp
84 |
85 |
86 |
87 | -
88 |
89 |
90 | Completion:
91 |
92 |
93 |
94 | -
95 |
96 |
-
97 |
98 |
99 | Do not complete
100 |
101 |
102 | true
103 |
104 |
105 |
106 | -
107 |
108 |
109 | Use for complete
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 | -
118 |
119 |
120 | Qt::Horizontal
121 |
122 |
123 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok
124 |
125 |
126 |
127 |
128 |
129 |
130 | typeComboBox
131 | urlLineEdit
132 | browseButton
133 |
134 |
135 |
136 |
137 | buttonBox
138 | accepted()
139 | AddDictDialog
140 | accept()
141 |
142 |
143 | 252
144 | 179
145 |
146 |
147 | 157
148 | 274
149 |
150 |
151 |
152 |
153 | buttonBox
154 | rejected()
155 | AddDictDialog
156 | reject()
157 |
158 |
159 | 320
160 | 179
161 |
162 |
163 | 286
164 | 274
165 |
166 |
167 |
168 |
169 |
170 |
--------------------------------------------------------------------------------
/gui/cskk-config.json:
--------------------------------------------------------------------------------
1 | {
2 | "addon": "cskk",
3 | "files": ["dictionary_list"]
4 | }
5 |
6 |
--------------------------------------------------------------------------------
/gui/dictmodel.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2013~2022 CSSlayer , Naoaki
3 | * Iwakiri
4 | *
5 | * SPDX-License-Identifier: GPL-3.0-or-later
6 | *
7 | */
8 |
9 | #include "dictmodel.h"
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 |
19 | namespace fcitx {
20 |
21 | const std::string config_path = "cskk/dictionary_list";
22 |
23 | SkkDictModel::SkkDictModel(QObject *parent) : QAbstractListModel(parent) {}
24 |
25 | void SkkDictModel::defaults() {
26 | auto path = StandardPath::fcitxPath("pkgdatadir", config_path.c_str());
27 | QFile f(path.data());
28 | if (f.open(QIODevice::ReadOnly)) {
29 | load(f);
30 | }
31 | }
32 |
33 | void SkkDictModel::load() {
34 | auto file = StandardPath::global().open(StandardPath::Type::PkgData,
35 | config_path, O_RDONLY);
36 | if (file.fd() < 0) {
37 | return;
38 | }
39 | QFile f;
40 | if (!f.open(file.fd(), QIODevice::ReadOnly)) {
41 | return;
42 | }
43 |
44 | load(f);
45 | f.close();
46 | }
47 |
48 | void SkkDictModel::load(QFile &file) {
49 | beginResetModel();
50 | m_dicts.clear();
51 |
52 | QByteArray bytes;
53 | while (!(bytes = file.readLine()).isEmpty()) {
54 | QString line = QString::fromUtf8(bytes).trimmed();
55 | QMap dict = parseLine(line);
56 | if (3 <= dict.size()) {
57 | m_dicts << dict;
58 | }
59 | }
60 | endResetModel();
61 | }
62 |
63 | bool SkkDictModel::save() {
64 | return StandardPath::global().safeSave(
65 | StandardPath::Type::PkgData, config_path, [this](int fd) {
66 | QFile tempFile;
67 | if (!tempFile.open(fd, QIODevice::WriteOnly)) {
68 | return false;
69 | }
70 |
71 | typedef QMap DictType;
72 |
73 | Q_FOREACH (const DictType &dict, m_dicts) {
74 | QString line = serialize(dict);
75 | tempFile.write(line.toUtf8());
76 | tempFile.write("\n");
77 | }
78 | return true;
79 | });
80 | }
81 |
82 | int SkkDictModel::rowCount(const QModelIndex &parent) const {
83 | if (parent.isValid()) {
84 | return 0;
85 | }
86 | return m_dicts.size();
87 | }
88 |
89 | bool SkkDictModel::removeRows(int row, int count, const QModelIndex &parent) {
90 | if (parent.isValid()) {
91 | return false;
92 | }
93 |
94 | if (count == 0 || row >= m_dicts.size() || row + count > m_dicts.size()) {
95 | return false;
96 | }
97 |
98 | beginRemoveRows(parent, row, row + count - 1);
99 | m_dicts.erase(m_dicts.begin() + row, m_dicts.begin() + row + count);
100 | endRemoveRows();
101 |
102 | return true;
103 | }
104 |
105 | QVariant SkkDictModel::data(const QModelIndex &index, int role) const {
106 | if (!index.isValid()) {
107 | return QVariant();
108 | }
109 |
110 | if (index.row() >= m_dicts.size() || index.column() != 0) {
111 | return QVariant();
112 | }
113 |
114 | switch (role) {
115 | case Qt::DisplayRole:
116 | return m_dicts[index.row()]["file"];
117 | case Qt::EditRole:
118 | return serialize(m_dicts[index.row()]);
119 | }
120 | return QVariant();
121 | }
122 |
123 | bool SkkDictModel::setData(const QModelIndex &index, const QVariant &value,
124 | int role) {
125 | if (role == Qt::EditRole) {
126 | QString dictString = value.toString();
127 | QMap dict = parseLine(dictString);
128 | m_dicts[index.row()] = dict;
129 | dataChanged(index, index, {role});
130 | return true;
131 | }
132 | return false;
133 | }
134 |
135 | bool SkkDictModel::moveUp(const QModelIndex ¤tIndex) {
136 | if (currentIndex.row() > 0 && currentIndex.row() < m_dicts.size()) {
137 | beginResetModel();
138 | #if (QT_VERSION < QT_VERSION_CHECK(5, 13, 0))
139 | m_dicts.swap(currentIndex.row() - 1, currentIndex.row());
140 | #else
141 | m_dicts.swapItemsAt(currentIndex.row() - 1, currentIndex.row());
142 | #endif
143 | endResetModel();
144 | return true;
145 | }
146 | return false;
147 | }
148 |
149 | bool SkkDictModel::moveDown(const QModelIndex ¤tIndex) {
150 | if (currentIndex.row() >= 0 && currentIndex.row() + 1 < m_dicts.size()) {
151 | beginResetModel();
152 | #if (QT_VERSION < QT_VERSION_CHECK(5, 13, 0))
153 | m_dicts.swap(currentIndex.row() + 1, currentIndex.row());
154 | #else
155 | m_dicts.swapItemsAt(currentIndex.row() + 1, currentIndex.row());
156 | #endif
157 | endResetModel();
158 | return true;
159 | }
160 |
161 | return false;
162 | }
163 |
164 | void SkkDictModel::add(const QMap &dict) {
165 | beginInsertRows(QModelIndex(), m_dicts.size(), m_dicts.size());
166 | m_dicts << dict;
167 | endInsertRows();
168 | }
169 |
170 | QMap SkkDictModel::parseLine(const QString &line) {
171 | QStringList items = line.split(",");
172 | // No matter which type, it should has at least 3 keys.
173 | if (items.size() < 3) {
174 | return {};
175 | }
176 |
177 | QMap dict;
178 | Q_FOREACH (const QString &item, items) {
179 | if (!item.contains('=')) {
180 | return {};
181 | }
182 | QString key = item.section('=', 0, 0);
183 | QString value = item.section('=', 1, -1);
184 |
185 | if (!SkkDictModel::m_knownKeys.contains(key)) {
186 | continue;
187 | }
188 |
189 | dict[key] = value;
190 | }
191 |
192 | // Inheritance from fcitx5-skk, encoding was optional.
193 | if (!dict.keys().contains("encoding")) {
194 | dict["encoding"] = "euc-jp";
195 | }
196 |
197 | if (dict.keys().contains("file") && dict.keys().contains("type") &&
198 | dict.keys().contains("mode") && dict.keys().contains("encoding")) {
199 | return dict;
200 | }
201 | return {};
202 | }
203 |
204 | // Serialize to QString of ',' separated k=v pair.
205 | // This k=v pair string is to match the configuration reading function of old
206 | // fcitx, and to be used as QVariant.
207 | QString SkkDictModel::serialize(const QMap &dict) {
208 | bool first = true;
209 | QString result = "";
210 | Q_FOREACH (const QString &key, dict.keys()) {
211 | if (first) {
212 | first = false;
213 | } else {
214 | result.append(",");
215 | }
216 | result.append(key.toUtf8());
217 | result.append("=");
218 | result.append(dict[key].toUtf8());
219 | }
220 |
221 | return result;
222 | }
223 |
224 | } // namespace fcitx
225 |
--------------------------------------------------------------------------------
/gui/dictmodel.h:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2013~2022 CSSlayer , Naoaki
3 | * Iwakiri
4 | *
5 | * SPDX-License-Identifier: GPL-3.0-or-later
6 | *
7 | */
8 |
9 | #ifndef DICTMODEL_H
10 | #define DICTMODEL_H
11 | #include
12 | #include
13 | #include
14 |
15 | namespace fcitx {
16 |
17 | class SkkDictModel : public QAbstractListModel {
18 | Q_OBJECT
19 | public:
20 | explicit SkkDictModel(QObject *parent = 0);
21 | int rowCount(const QModelIndex &parent = QModelIndex()) const override;
22 | QVariant data(const QModelIndex &index,
23 | int role = Qt::DisplayRole) const override;
24 | bool setData(const QModelIndex &index, const QVariant &value,
25 | int role = Qt::EditRole) override;
26 |
27 | bool removeRows(int row, int count,
28 | const QModelIndex &parent = QModelIndex()) override;
29 |
30 | void load();
31 | void load(QFile &file);
32 | void defaults();
33 | bool save();
34 | void add(const QMap &dict);
35 | bool moveDown(const QModelIndex ¤tIndex);
36 | bool moveUp(const QModelIndex ¤tIndex);
37 |
38 | static QMap parseLine(const QString &line);
39 | static QString serialize(const QMap &dict);
40 | inline static QSet m_knownKeys =
41 | QSet({"file", "type", "mode", "encoding", "complete"});
42 |
43 | private:
44 | QList> m_dicts;
45 | };
46 |
47 | } // namespace fcitx
48 |
49 | #endif // DICTMODEL_H
50 |
--------------------------------------------------------------------------------
/gui/dictwidget.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2013~2022 CSSlayer , Naoaki
3 | * Iwakiri
4 | *
5 | * SPDX-License-Identifier: GPL-3.0-or-later
6 | *
7 | */
8 | #include "dictwidget.h"
9 | #include "adddictdialog.h"
10 | #include "dictmodel.h"
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 |
17 | namespace fcitx {
18 |
19 | SkkDictWidget::SkkDictWidget(QWidget *parent)
20 | : FcitxQtConfigUIWidget(parent),
21 | m_ui(std::make_unique()) {
22 | m_ui->setupUi(this);
23 | m_dictModel = new SkkDictModel(this);
24 | auto fcitxBasePath = stringutils::joinPath(
25 | StandardPath::global().userDirectory(StandardPath::Type::PkgData),
26 | "cskk");
27 | fs::makePath(fcitxBasePath);
28 |
29 | m_dictModel->load();
30 | m_ui->dictionaryView->setModel(m_dictModel);
31 |
32 | connect(m_ui->addDictButton, &QPushButton::clicked, this,
33 | &SkkDictWidget::addDictClicked);
34 | connect(m_ui->defaultDictButton, &QPushButton::clicked, this,
35 | &SkkDictWidget::defaultDictClicked);
36 | connect(m_ui->removeDictButton, &QPushButton::clicked, this,
37 | &SkkDictWidget::removeDictClicked);
38 | connect(m_ui->moveUpDictButton, &QPushButton::clicked, this,
39 | &SkkDictWidget::moveUpDictClicked);
40 | connect(m_ui->moveDownDictButton, &QPushButton::clicked, this,
41 | &SkkDictWidget::moveDownClicked);
42 | connect(m_ui->editDictButton, &QPushButton::clicked, this,
43 | &SkkDictWidget::editDictClicked);
44 | }
45 |
46 | QString SkkDictWidget::title() { return _("Dictionary Manager"); }
47 |
48 | QString SkkDictWidget::icon() { return "cskk"; }
49 |
50 | void SkkDictWidget::load() {
51 | m_dictModel->load();
52 | emit changed(false);
53 | }
54 |
55 | void SkkDictWidget::save() {
56 | m_dictModel->save();
57 | emit changed(false);
58 | }
59 |
60 | void SkkDictWidget::addDictClicked() {
61 | AddDictDialog dialog;
62 | int result = dialog.exec();
63 | if (result == QDialog::Accepted) {
64 | m_dictModel->add(dialog.dictionary());
65 | emit changed(true);
66 | }
67 | }
68 |
69 | void SkkDictWidget::defaultDictClicked() {
70 | m_dictModel->defaults();
71 | emit changed(true);
72 | }
73 |
74 | void SkkDictWidget::removeDictClicked() {
75 | if (m_ui->dictionaryView->currentIndex().isValid()) {
76 | m_dictModel->removeRow(m_ui->dictionaryView->currentIndex().row());
77 | emit changed(true);
78 | }
79 | }
80 |
81 | void SkkDictWidget::moveUpDictClicked() {
82 | int row = m_ui->dictionaryView->currentIndex().row();
83 | if (m_dictModel->moveUp(m_ui->dictionaryView->currentIndex())) {
84 | m_ui->dictionaryView->selectionModel()->setCurrentIndex(
85 | m_dictModel->index(row - 1), QItemSelectionModel::ClearAndSelect);
86 | emit changed(true);
87 | }
88 | }
89 |
90 | void SkkDictWidget::moveDownClicked() {
91 | int row = m_ui->dictionaryView->currentIndex().row();
92 | if (m_dictModel->moveDown(m_ui->dictionaryView->currentIndex())) {
93 | m_ui->dictionaryView->selectionModel()->setCurrentIndex(
94 | m_dictModel->index(row + 1), QItemSelectionModel::ClearAndSelect);
95 | emit changed(true);
96 | }
97 | }
98 |
99 | void SkkDictWidget::editDictClicked() {
100 | QModelIndex index = m_ui->dictionaryView->currentIndex();
101 | QVariant dictValue = m_dictModel->data(index, Qt::EditRole);
102 | QMap dictionary =
103 | SkkDictModel::parseLine(dictValue.toString());
104 | AddDictDialog dialog;
105 | dialog.setDictionary(dictionary);
106 | int result = dialog.exec();
107 | if (result == QDialog::Accepted) {
108 | QString val = SkkDictModel::serialize(dialog.dictionary());
109 | m_dictModel->setData(index, val);
110 | emit changed(true);
111 | }
112 | }
113 |
114 | } // namespace fcitx
115 |
--------------------------------------------------------------------------------
/gui/dictwidget.h:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2013~2022 CSSlayer , Naoaki
3 | * Iwakiri
4 | *
5 | * SPDX-License-Identifier: GPL-3.0-or-later
6 | *
7 | */
8 |
9 | #ifndef FCITX_SKK_GUI_DICTWIDGET_H
10 | #define FCITX_SKK_GUI_DICTWIDGET_H
11 |
12 | #include "ui_dictwidget.h"
13 | #include
14 | #include
15 |
16 | namespace fcitx {
17 |
18 | class SkkDictModel;
19 |
20 | class SkkDictWidget : public FcitxQtConfigUIWidget {
21 | Q_OBJECT
22 | public:
23 | explicit SkkDictWidget(QWidget *parent = 0);
24 |
25 | void load() override;
26 | void save() override;
27 | QString title() override;
28 | QString icon() override;
29 |
30 | private Q_SLOTS:
31 | void addDictClicked();
32 | void defaultDictClicked();
33 | void removeDictClicked();
34 | void moveUpDictClicked();
35 | void moveDownClicked();
36 | void editDictClicked();
37 |
38 | private:
39 | std::unique_ptr m_ui;
40 | SkkDictModel *m_dictModel;
41 | };
42 |
43 | } // namespace fcitx
44 |
45 | #endif // FCITX_SKK_GUI_DICTWIDGET_H
46 |
--------------------------------------------------------------------------------
/gui/dictwidget.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | SkkDictWidget
4 |
5 |
6 |
7 | 0
8 | 0
9 | 355
10 | 258
11 |
12 |
13 |
14 | Form
15 |
16 |
17 | -
18 |
19 |
20 | -
21 |
22 |
-
23 |
24 |
25 |
26 | 32
27 | 32
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | ..
36 |
37 |
38 |
39 | -
40 |
41 |
42 |
43 | 32
44 | 32
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | ..
53 |
54 |
55 |
56 | -
57 |
58 |
59 |
60 | 32
61 | 32
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 | -
73 |
74 |
75 |
76 | 32
77 | 32
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 | ..
86 |
87 |
88 |
89 | -
90 |
91 |
92 |
93 | 32
94 | 32
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 | ..
103 |
104 |
105 |
106 | -
107 |
108 |
109 |
110 | 32
111 | 32
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 | ..
120 |
121 |
122 |
123 | -
124 |
125 |
126 | Qt::Vertical
127 |
128 |
129 |
130 | 20
131 | 40
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
--------------------------------------------------------------------------------
/gui/main.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2013~2020 CSSlayer
3 | *
4 | * SPDX-License-Identifier: GPL-3.0-or-later
5 | *
6 | */
7 |
8 | #include "main.h"
9 | extern "C" {
10 | #include
11 | }
12 | #include "dictwidget.h"
13 | #include
14 | #include
15 |
16 | namespace fcitx {
17 |
18 | CskkConfigPlugin::CskkConfigPlugin(QObject *parent)
19 | : FcitxQtConfigUIPlugin(parent) {
20 |
21 | registerDomain("fcitx5-cskk", FCITX_INSTALL_LOCALEDIR);
22 | }
23 |
24 | FcitxQtConfigUIWidget *CskkConfigPlugin::create(const QString &key) {
25 | if (key == "dictionary_list") {
26 | return new SkkDictWidget;
27 | }
28 | return nullptr;
29 | }
30 |
31 | } // namespace fcitx
32 |
--------------------------------------------------------------------------------
/gui/main.h:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2013~2020 CSSlayer
3 | *
4 | * SPDX-License-Identifier: GPL-3.0-or-later
5 | *
6 | */
7 |
8 | #ifndef FCITX_SKK_GUI_MAIN_H_
9 | #define FCITX_SKK_GUI_MAIN_H_
10 |
11 | #include
12 |
13 | namespace fcitx {
14 |
15 | class CskkConfigPlugin : public FcitxQtConfigUIPlugin {
16 | Q_OBJECT
17 | public:
18 | Q_PLUGIN_METADATA(IID FcitxQtConfigUIFactoryInterface_iid FILE
19 | "cskk-config.json")
20 | explicit CskkConfigPlugin(QObject *parent = 0);
21 | FcitxQtConfigUIWidget *create(const QString &key) override;
22 | };
23 |
24 | } // namespace fcitx
25 |
26 | #endif // FCITX_TOOLS_GUI_MAIN_H_
27 |
--------------------------------------------------------------------------------
/org.fcitx.Fcitx5.Addon.Cskk.metainfo.xml.in:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.fcitx.Fcitx5.Addon.Cskk
4 | org.fcitx.Fcitx5
5 | CC0-1.0
6 | GPL-3.0+
7 | fcitx5-cskk
8 | libCSKK Japanese input method
9 |
10 | The Fcitx Team
11 | Naoaki Iwakiri
12 |
13 | https://github.com/fcitx/fcitx5-cskk
14 | https://github.com/fcitx/fcitx5-cskk/issues
15 | https://github.com/fcitx/fcitx5-cskk
16 | Fcitx
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/po/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | fcitx5_install_translation(fcitx5-cskk)
--------------------------------------------------------------------------------
/po/LINGUAS:
--------------------------------------------------------------------------------
1 |
2 | de
3 | ja
4 | ko
5 | ru
6 | vi
7 | zh_CN
8 | zh_TW
9 |
--------------------------------------------------------------------------------
/po/de.po:
--------------------------------------------------------------------------------
1 | # SOME DESCRIPTIVE TITLE.
2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3 | # This file is distributed under the same license as the fcitx5-cskk package.
4 | #
5 | # Translators:
6 | # mar well , 2022
7 | #
8 | msgid ""
9 | msgstr ""
10 | "Project-Id-Version: fcitx5-cskk\n"
11 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n"
12 | "POT-Creation-Date: 2023-02-21 20:25+0000\n"
13 | "PO-Revision-Date: 2022-10-21 07:47+0000\n"
14 | "Last-Translator: mar well , 2022\n"
15 | "Language-Team: German (https://www.transifex.com/fcitx/teams/12005/de/)\n"
16 | "Language: de\n"
17 | "MIME-Version: 1.0\n"
18 | "Content-Type: text/plain; charset=UTF-8\n"
19 | "Content-Transfer-Encoding: 8bit\n"
20 | "Plural-Forms: nplurals=2; plural=(n != 1);\n"
21 |
22 | #. i18n: file: gui/adddictdialog.ui:45
23 | #. i18n: ectx: property (text), widget (QLabel, pathLabel)
24 | #: rc.cpp:12
25 | #, kde-format
26 | msgid "&Path:"
27 | msgstr ""
28 |
29 | #. i18n: file: gui/adddictdialog.ui:25
30 | #. i18n: ectx: property (text), widget (QLabel, typeLabel)
31 | #: rc.cpp:9
32 | #, kde-format
33 | msgid "&Type:"
34 | msgstr ""
35 |
36 | #: src/cskkconfig.h:41
37 | msgid "Always"
38 | msgstr "Immer"
39 |
40 | #: src/cskkconfig.h:107
41 | msgid "Candidate Layout"
42 | msgstr ""
43 |
44 | #: src/cskkconfig.h:104
45 | msgid "Candidate list page size"
46 | msgstr ""
47 |
48 | #: src/cskkconfig.h:137
49 | msgid "Candidate selection keys"
50 | msgstr ""
51 |
52 | #: src/cskkconfig.h:130
53 | msgid "Candidates Page Next Page"
54 | msgstr ""
55 |
56 | #: src/cskkconfig.h:124
57 | msgid "Candidates Page Previous Page"
58 | msgstr ""
59 |
60 | #: src/cskkconfig.h:102
61 | msgid "Candidates to show before showing in list"
62 | msgstr ""
63 |
64 | #: src/cskkconfig.h:97
65 | msgid "Comma style"
66 | msgstr ""
67 |
68 | #. i18n: file: gui/adddictdialog.ui:90
69 | #. i18n: ectx: property (text), widget (QLabel, completeLabel)
70 | #: rc.cpp:18
71 | #, kde-format
72 | msgid "Completion:"
73 | msgstr ""
74 |
75 | #: src/cskk.conf.in:3
76 | msgid "Cskk"
77 | msgstr ""
78 |
79 | #: src/cskk-addon.conf.in.in:3
80 | msgid "Cskk input method for Fcitx5"
81 | msgstr ""
82 |
83 | #: src/cskkconfig.h:118
84 | msgid "Cursor Down"
85 | msgstr ""
86 |
87 | #: src/cskkconfig.h:112
88 | msgid "Cursor Up"
89 | msgstr ""
90 |
91 | #. i18n: file: gui/adddictdialog.ui:14
92 | #. i18n: ectx: property (windowTitle), widget (QDialog, AddDictDialog)
93 | #: rc.cpp:6
94 | #, kde-format
95 | msgid "Dialog"
96 | msgstr ""
97 |
98 | #: src/cskkconfig.h:145
99 | msgid "Dictionary"
100 | msgstr ""
101 |
102 | #: gui/dictwidget.cpp:46
103 | msgid "Dictionary Manager"
104 | msgstr ""
105 |
106 | #. i18n: file: gui/adddictdialog.ui:99
107 | #. i18n: ectx: property (text), widget (QRadioButton, completeNoRadio)
108 | #: rc.cpp:21
109 | #, kde-format
110 | msgid "Do not complete"
111 | msgstr ""
112 |
113 | #. i18n: file: gui/adddictdialog.ui:73
114 | #. i18n: ectx: property (text), widget (QLabel, encodingLabel)
115 | #: rc.cpp:15
116 | #, kde-format
117 | msgid "Encoding:"
118 | msgstr ""
119 |
120 | #. i18n: file: gui/dictwidget.ui:14
121 | #. i18n: ectx: property (windowTitle), widget (QWidget, SkkDictWidget)
122 | #: rc.cpp:3
123 | #, kde-format
124 | msgid "Form"
125 | msgstr ""
126 |
127 | #: src/cskkconfig.h:36
128 | msgid "Horizontal"
129 | msgstr ""
130 |
131 | #: src/cskk-addon.conf.in.in:4
132 | msgid "IM using libcskk"
133 | msgstr ""
134 |
135 | #: src/cskkconfig.h:93
136 | msgid "InitialInputMode"
137 | msgstr ""
138 |
139 | #: src/cskkconfig.h:42
140 | msgid "Never"
141 | msgstr ""
142 |
143 | #: src/cskkconfig.h:35
144 | msgid "Not set"
145 | msgstr ""
146 |
147 | #: src/cskkconfig.h:95
148 | msgid "Period style"
149 | msgstr ""
150 |
151 | #: src/cskkconfig.h:91
152 | msgid "Rule"
153 | msgstr ""
154 |
155 | #: gui/adddictdialog.cpp:95 gui/adddictdialog.cpp:118
156 | msgid "Select Dictionary File"
157 | msgstr ""
158 |
159 | #: src/cskkconfig.h:142
160 | msgid "Show Annotation when"
161 | msgstr ""
162 |
163 | #: src/cskkconfig.h:42
164 | msgid "SingleCandidate"
165 | msgstr ""
166 |
167 | #: gui/adddictdialog.cpp:32
168 | msgid "System"
169 | msgstr ""
170 |
171 | #. i18n: file: gui/adddictdialog.ui:109
172 | #. i18n: ectx: property (text), widget (QRadioButton, completeYesRadio)
173 | #: rc.cpp:24
174 | #, kde-format
175 | msgid "Use for complete"
176 | msgstr ""
177 |
178 | #: gui/adddictdialog.cpp:33
179 | msgid "User"
180 | msgstr ""
181 |
182 | #: src/cskkconfig.h:36
183 | msgid "Vertical"
184 | msgstr ""
185 |
186 | #: org.fcitx.Fcitx5.Addon.Cskk.metainfo.xml.in:7
187 | msgid "fcitx5-cskk"
188 | msgstr ""
189 |
190 | #: org.fcitx.Fcitx5.Addon.Cskk.metainfo.xml.in:9
191 | msgid "libCSKK Japanese input method"
192 | msgstr ""
193 |
--------------------------------------------------------------------------------
/po/fcitx5-cskk.pot:
--------------------------------------------------------------------------------
1 | # SOME DESCRIPTIVE TITLE.
2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3 | # This file is distributed under the same license as the fcitx5-cskk package.
4 | #
5 | msgid ""
6 | msgstr ""
7 | "Project-Id-Version: fcitx5-cskk\n"
8 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n"
9 | "POT-Creation-Date: 2023-02-21 20:25+0000\n"
10 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
11 | "Last-Translator: FULL NAME \n"
12 | "Language-Team: LANGUAGE \n"
13 | "Language: LANG\n"
14 | "MIME-Version: 1.0\n"
15 | "Content-Type: text/plain; charset=utf-8\n"
16 | "Content-Transfer-Encoding: 8bit\n"
17 |
18 | #. i18n: file: gui/adddictdialog.ui:45
19 | #. i18n: ectx: property (text), widget (QLabel, pathLabel)
20 | #: rc.cpp:12
21 | #, kde-format
22 | msgid "&Path:"
23 | msgstr ""
24 |
25 | #. i18n: file: gui/adddictdialog.ui:25
26 | #. i18n: ectx: property (text), widget (QLabel, typeLabel)
27 | #: rc.cpp:9
28 | #, kde-format
29 | msgid "&Type:"
30 | msgstr ""
31 |
32 | #: src/cskkconfig.h:41
33 | msgid "Always"
34 | msgstr ""
35 |
36 | #: src/cskkconfig.h:107
37 | msgid "Candidate Layout"
38 | msgstr ""
39 |
40 | #: src/cskkconfig.h:104
41 | msgid "Candidate list page size"
42 | msgstr ""
43 |
44 | #: src/cskkconfig.h:137
45 | msgid "Candidate selection keys"
46 | msgstr ""
47 |
48 | #: src/cskkconfig.h:130
49 | msgid "Candidates Page Next Page"
50 | msgstr ""
51 |
52 | #: src/cskkconfig.h:124
53 | msgid "Candidates Page Previous Page"
54 | msgstr ""
55 |
56 | #: src/cskkconfig.h:102
57 | msgid "Candidates to show before showing in list"
58 | msgstr ""
59 |
60 | #: src/cskkconfig.h:97
61 | msgid "Comma style"
62 | msgstr ""
63 |
64 | #. i18n: file: gui/adddictdialog.ui:90
65 | #. i18n: ectx: property (text), widget (QLabel, completeLabel)
66 | #: rc.cpp:18
67 | #, kde-format
68 | msgid "Completion:"
69 | msgstr ""
70 |
71 | #: src/cskk.conf.in:3
72 | msgid "Cskk"
73 | msgstr ""
74 |
75 | #: src/cskk-addon.conf.in.in:3
76 | msgid "Cskk input method for Fcitx5"
77 | msgstr ""
78 |
79 | #: src/cskkconfig.h:118
80 | msgid "Cursor Down"
81 | msgstr ""
82 |
83 | #: src/cskkconfig.h:112
84 | msgid "Cursor Up"
85 | msgstr ""
86 |
87 | #. i18n: file: gui/adddictdialog.ui:14
88 | #. i18n: ectx: property (windowTitle), widget (QDialog, AddDictDialog)
89 | #: rc.cpp:6
90 | #, kde-format
91 | msgid "Dialog"
92 | msgstr ""
93 |
94 | #: src/cskkconfig.h:145
95 | msgid "Dictionary"
96 | msgstr ""
97 |
98 | #: gui/dictwidget.cpp:46
99 | msgid "Dictionary Manager"
100 | msgstr ""
101 |
102 | #. i18n: file: gui/adddictdialog.ui:99
103 | #. i18n: ectx: property (text), widget (QRadioButton, completeNoRadio)
104 | #: rc.cpp:21
105 | #, kde-format
106 | msgid "Do not complete"
107 | msgstr ""
108 |
109 | #. i18n: file: gui/adddictdialog.ui:73
110 | #. i18n: ectx: property (text), widget (QLabel, encodingLabel)
111 | #: rc.cpp:15
112 | #, kde-format
113 | msgid "Encoding:"
114 | msgstr ""
115 |
116 | #. i18n: file: gui/dictwidget.ui:14
117 | #. i18n: ectx: property (windowTitle), widget (QWidget, SkkDictWidget)
118 | #: rc.cpp:3
119 | #, kde-format
120 | msgid "Form"
121 | msgstr ""
122 |
123 | #: src/cskkconfig.h:36
124 | msgid "Horizontal"
125 | msgstr ""
126 |
127 | #: src/cskk-addon.conf.in.in:4
128 | msgid "IM using libcskk"
129 | msgstr ""
130 |
131 | #: src/cskkconfig.h:93
132 | msgid "InitialInputMode"
133 | msgstr ""
134 |
135 | #: src/cskkconfig.h:42
136 | msgid "Never"
137 | msgstr ""
138 |
139 | #: src/cskkconfig.h:35
140 | msgid "Not set"
141 | msgstr ""
142 |
143 | #: src/cskkconfig.h:95
144 | msgid "Period style"
145 | msgstr ""
146 |
147 | #: src/cskkconfig.h:91
148 | msgid "Rule"
149 | msgstr ""
150 |
151 | #: gui/adddictdialog.cpp:95 gui/adddictdialog.cpp:118
152 | msgid "Select Dictionary File"
153 | msgstr ""
154 |
155 | #: src/cskkconfig.h:142
156 | msgid "Show Annotation when"
157 | msgstr ""
158 |
159 | #: src/cskkconfig.h:42
160 | msgid "SingleCandidate"
161 | msgstr ""
162 |
163 | #: gui/adddictdialog.cpp:32
164 | msgid "System"
165 | msgstr ""
166 |
167 | #. i18n: file: gui/adddictdialog.ui:109
168 | #. i18n: ectx: property (text), widget (QRadioButton, completeYesRadio)
169 | #: rc.cpp:24
170 | #, kde-format
171 | msgid "Use for complete"
172 | msgstr ""
173 |
174 | #: gui/adddictdialog.cpp:33
175 | msgid "User"
176 | msgstr ""
177 |
178 | #: src/cskkconfig.h:36
179 | msgid "Vertical"
180 | msgstr ""
181 |
182 | #: org.fcitx.Fcitx5.Addon.Cskk.metainfo.xml.in:7
183 | msgid "fcitx5-cskk"
184 | msgstr ""
185 |
186 | #: org.fcitx.Fcitx5.Addon.Cskk.metainfo.xml.in:9
187 | msgid "libCSKK Japanese input method"
188 | msgstr ""
189 |
--------------------------------------------------------------------------------
/po/ja.po:
--------------------------------------------------------------------------------
1 | # SOME DESCRIPTIVE TITLE.
2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3 | # This file is distributed under the same license as the fcitx5-cskk package.
4 | #
5 | # Translators:
6 | # Akira KANASHIRO, 2023
7 | # UTUMI Hirosi , 2025
8 | #
9 | msgid ""
10 | msgstr ""
11 | "Project-Id-Version: fcitx5-cskk\n"
12 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n"
13 | "POT-Creation-Date: 2025-02-28 20:24+0000\n"
14 | "PO-Revision-Date: 2022-10-21 07:47+0000\n"
15 | "Last-Translator: UTUMI Hirosi , 2025\n"
16 | "Language-Team: Japanese (https://app.transifex.com/fcitx/teams/12005/ja/)\n"
17 | "Language: ja\n"
18 | "MIME-Version: 1.0\n"
19 | "Content-Type: text/plain; charset=UTF-8\n"
20 | "Content-Transfer-Encoding: 8bit\n"
21 | "Plural-Forms: nplurals=1; plural=0;\n"
22 |
23 | #. i18n: file: gui/adddictdialog.ui:45
24 | #. i18n: ectx: property (text), widget (QLabel, pathLabel)
25 | #: rc.cpp:12
26 | #, kde-format
27 | msgid "&Path:"
28 | msgstr "パス(&P):"
29 |
30 | #. i18n: file: gui/adddictdialog.ui:25
31 | #. i18n: ectx: property (text), widget (QLabel, typeLabel)
32 | #: rc.cpp:9
33 | #, kde-format
34 | msgid "&Type:"
35 | msgstr "形式(&T):"
36 |
37 | #: src/cskkconfig.h:41
38 | msgid "Always"
39 | msgstr ""
40 |
41 | #: src/cskkconfig.h:107
42 | msgid "Candidate Layout"
43 | msgstr "候補のレイアウト"
44 |
45 | #: src/cskkconfig.h:104
46 | msgid "Candidate list page size"
47 | msgstr "候補リストページサイズ"
48 |
49 | #: src/cskkconfig.h:137
50 | msgid "Candidate selection keys"
51 | msgstr "候補の選択に使用するキー"
52 |
53 | #: src/cskkconfig.h:130
54 | msgid "Candidates Page Next Page"
55 | msgstr "次の候補リストへの移動"
56 |
57 | #: src/cskkconfig.h:124
58 | msgid "Candidates Page Previous Page"
59 | msgstr "前の候補リストへの移動"
60 |
61 | #: src/cskkconfig.h:102
62 | msgid "Candidates to show before showing in list"
63 | msgstr "リストに表示される前に表示する候補"
64 |
65 | #: src/cskkconfig.h:97
66 | msgid "Comma style"
67 | msgstr "読点スタイル"
68 |
69 | #. i18n: file: gui/adddictdialog.ui:90
70 | #. i18n: ectx: property (text), widget (QLabel, completeLabel)
71 | #: rc.cpp:18
72 | #, kde-format
73 | msgid "Completion:"
74 | msgstr "補完"
75 |
76 | #: src/cskk.conf.in:2
77 | msgid "Cskk"
78 | msgstr "CSKK"
79 |
80 | #: src/cskk-addon.conf.in.in:2
81 | msgid "Cskk input method for Fcitx5"
82 | msgstr "Fcitx5 用の CSKK 入力メソッド"
83 |
84 | #: src/cskkconfig.h:118
85 | msgid "Cursor Down"
86 | msgstr "カーソルダウン"
87 |
88 | #: src/cskkconfig.h:112
89 | msgid "Cursor Up"
90 | msgstr "カーソルアップ"
91 |
92 | #. i18n: file: gui/adddictdialog.ui:14
93 | #. i18n: ectx: property (windowTitle), widget (QDialog, AddDictDialog)
94 | #: rc.cpp:6
95 | #, kde-format
96 | msgid "Dialog"
97 | msgstr "ダイアログ"
98 |
99 | #: src/cskkconfig.h:145
100 | msgid "Dictionary"
101 | msgstr "辞書"
102 |
103 | #: gui/dictwidget.cpp:46
104 | msgid "Dictionary Manager"
105 | msgstr "辞書マネージャー"
106 |
107 | #. i18n: file: gui/adddictdialog.ui:99
108 | #. i18n: ectx: property (text), widget (QRadioButton, completeNoRadio)
109 | #: rc.cpp:21
110 | #, kde-format
111 | msgid "Do not complete"
112 | msgstr ""
113 |
114 | #. i18n: file: gui/adddictdialog.ui:73
115 | #. i18n: ectx: property (text), widget (QLabel, encodingLabel)
116 | #: rc.cpp:15
117 | #, kde-format
118 | msgid "Encoding:"
119 | msgstr "エンコーディング:"
120 |
121 | #. i18n: file: gui/dictwidget.ui:14
122 | #. i18n: ectx: property (windowTitle), widget (QWidget, SkkDictWidget)
123 | #: rc.cpp:3
124 | #, kde-format
125 | msgid "Form"
126 | msgstr "フォーム"
127 |
128 | #: src/cskkconfig.h:36
129 | msgid "Horizontal"
130 | msgstr "横"
131 |
132 | #: src/cskk-addon.conf.in.in:3
133 | msgid "IM using libcskk"
134 | msgstr "libcskk を使用した IM"
135 |
136 | #: src/cskkconfig.h:93
137 | msgid "InitialInputMode"
138 | msgstr "初期入力モード"
139 |
140 | #: src/cskkconfig.h:42
141 | msgid "Never"
142 | msgstr ""
143 |
144 | #: src/cskkconfig.h:35
145 | msgid "Not set"
146 | msgstr "未設定"
147 |
148 | #: src/cskkconfig.h:95
149 | msgid "Period style"
150 | msgstr "句点スタイル"
151 |
152 | #: src/cskkconfig.h:91
153 | msgid "Rule"
154 | msgstr "入力方式"
155 |
156 | #: gui/adddictdialog.cpp:95 gui/adddictdialog.cpp:118
157 | msgid "Select Dictionary File"
158 | msgstr "辞書ファイルを選択"
159 |
160 | #: src/cskkconfig.h:142
161 | msgid "Show Annotation when"
162 | msgstr "注釈を表示"
163 |
164 | #: src/cskkconfig.h:42
165 | msgid "SingleCandidate"
166 | msgstr ""
167 |
168 | #: gui/adddictdialog.cpp:32
169 | msgid "System"
170 | msgstr "システム"
171 |
172 | #. i18n: file: gui/adddictdialog.ui:109
173 | #. i18n: ectx: property (text), widget (QRadioButton, completeYesRadio)
174 | #: rc.cpp:24
175 | #, kde-format
176 | msgid "Use for complete"
177 | msgstr ""
178 |
179 | #: gui/adddictdialog.cpp:33
180 | msgid "User"
181 | msgstr "ユーザー"
182 |
183 | #: src/cskkconfig.h:36
184 | msgid "Vertical"
185 | msgstr "縦"
186 |
187 | #: org.fcitx.Fcitx5.Addon.Cskk.metainfo.xml.in:7
188 | msgid "fcitx5-cskk"
189 | msgstr "fcitx5-cskk"
190 |
191 | #: org.fcitx.Fcitx5.Addon.Cskk.metainfo.xml.in:8
192 | msgid "libCSKK Japanese input method"
193 | msgstr "libCSKK 日本語入力メソッド"
194 |
--------------------------------------------------------------------------------
/po/ko.po:
--------------------------------------------------------------------------------
1 | # SOME DESCRIPTIVE TITLE.
2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3 | # This file is distributed under the same license as the fcitx5-cskk package.
4 | #
5 | # Translators:
6 | # Junghee Lee , 2022
7 | #
8 | msgid ""
9 | msgstr ""
10 | "Project-Id-Version: fcitx5-cskk\n"
11 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n"
12 | "POT-Creation-Date: 2023-02-21 20:25+0000\n"
13 | "PO-Revision-Date: 2022-10-21 07:47+0000\n"
14 | "Last-Translator: Junghee Lee , 2022\n"
15 | "Language-Team: Korean (https://www.transifex.com/fcitx/teams/12005/ko/)\n"
16 | "Language: ko\n"
17 | "MIME-Version: 1.0\n"
18 | "Content-Type: text/plain; charset=UTF-8\n"
19 | "Content-Transfer-Encoding: 8bit\n"
20 | "Plural-Forms: nplurals=1; plural=0;\n"
21 |
22 | #. i18n: file: gui/adddictdialog.ui:45
23 | #. i18n: ectx: property (text), widget (QLabel, pathLabel)
24 | #: rc.cpp:12
25 | #, kde-format
26 | msgid "&Path:"
27 | msgstr "경로(&P):"
28 |
29 | #. i18n: file: gui/adddictdialog.ui:25
30 | #. i18n: ectx: property (text), widget (QLabel, typeLabel)
31 | #: rc.cpp:9
32 | #, kde-format
33 | msgid "&Type:"
34 | msgstr "유형(&T):"
35 |
36 | #: src/cskkconfig.h:41
37 | msgid "Always"
38 | msgstr ""
39 |
40 | #: src/cskkconfig.h:107
41 | msgid "Candidate Layout"
42 | msgstr "후보 자판"
43 |
44 | #: src/cskkconfig.h:104
45 | msgid "Candidate list page size"
46 | msgstr "후보 목록 페이지 크기"
47 |
48 | #: src/cskkconfig.h:137
49 | msgid "Candidate selection keys"
50 | msgstr "후보 선택 키"
51 |
52 | #: src/cskkconfig.h:130
53 | msgid "Candidates Page Next Page"
54 | msgstr "후보 페이지 다음 페이지"
55 |
56 | #: src/cskkconfig.h:124
57 | msgid "Candidates Page Previous Page"
58 | msgstr "후보 페이지 이전 페이지"
59 |
60 | #: src/cskkconfig.h:102
61 | msgid "Candidates to show before showing in list"
62 | msgstr ""
63 |
64 | #: src/cskkconfig.h:97
65 | msgid "Comma style"
66 | msgstr "쉼표 방식"
67 |
68 | #. i18n: file: gui/adddictdialog.ui:90
69 | #. i18n: ectx: property (text), widget (QLabel, completeLabel)
70 | #: rc.cpp:18
71 | #, kde-format
72 | msgid "Completion:"
73 | msgstr ""
74 |
75 | #: src/cskk.conf.in:3
76 | msgid "Cskk"
77 | msgstr "Cskk"
78 |
79 | #: src/cskk-addon.conf.in.in:3
80 | msgid "Cskk input method for Fcitx5"
81 | msgstr "Fcitx용 Cskk 입력기"
82 |
83 | #: src/cskkconfig.h:118
84 | msgid "Cursor Down"
85 | msgstr "커서 아래로"
86 |
87 | #: src/cskkconfig.h:112
88 | msgid "Cursor Up"
89 | msgstr "커서 위로"
90 |
91 | #. i18n: file: gui/adddictdialog.ui:14
92 | #. i18n: ectx: property (windowTitle), widget (QDialog, AddDictDialog)
93 | #: rc.cpp:6
94 | #, kde-format
95 | msgid "Dialog"
96 | msgstr "대화창"
97 |
98 | #: src/cskkconfig.h:145
99 | msgid "Dictionary"
100 | msgstr "사전"
101 |
102 | #: gui/dictwidget.cpp:46
103 | msgid "Dictionary Manager"
104 | msgstr "사전 관리자"
105 |
106 | #. i18n: file: gui/adddictdialog.ui:99
107 | #. i18n: ectx: property (text), widget (QRadioButton, completeNoRadio)
108 | #: rc.cpp:21
109 | #, kde-format
110 | msgid "Do not complete"
111 | msgstr ""
112 |
113 | #. i18n: file: gui/adddictdialog.ui:73
114 | #. i18n: ectx: property (text), widget (QLabel, encodingLabel)
115 | #: rc.cpp:15
116 | #, kde-format
117 | msgid "Encoding:"
118 | msgstr "인코딩:"
119 |
120 | #. i18n: file: gui/dictwidget.ui:14
121 | #. i18n: ectx: property (windowTitle), widget (QWidget, SkkDictWidget)
122 | #: rc.cpp:3
123 | #, kde-format
124 | msgid "Form"
125 | msgstr "형태"
126 |
127 | #: src/cskkconfig.h:36
128 | msgid "Horizontal"
129 | msgstr "가로 방향"
130 |
131 | #: src/cskk-addon.conf.in.in:4
132 | msgid "IM using libcskk"
133 | msgstr "libcskk를 사용하는 입력기"
134 |
135 | #: src/cskkconfig.h:93
136 | msgid "InitialInputMode"
137 | msgstr ""
138 |
139 | #: src/cskkconfig.h:42
140 | msgid "Never"
141 | msgstr ""
142 |
143 | #: src/cskkconfig.h:35
144 | msgid "Not set"
145 | msgstr "설정되지 않음"
146 |
147 | #: src/cskkconfig.h:95
148 | msgid "Period style"
149 | msgstr ""
150 |
151 | #: src/cskkconfig.h:91
152 | msgid "Rule"
153 | msgstr ""
154 |
155 | #: gui/adddictdialog.cpp:95 gui/adddictdialog.cpp:118
156 | msgid "Select Dictionary File"
157 | msgstr ""
158 |
159 | #: src/cskkconfig.h:142
160 | msgid "Show Annotation when"
161 | msgstr ""
162 |
163 | #: src/cskkconfig.h:42
164 | msgid "SingleCandidate"
165 | msgstr ""
166 |
167 | #: gui/adddictdialog.cpp:32
168 | msgid "System"
169 | msgstr ""
170 |
171 | #. i18n: file: gui/adddictdialog.ui:109
172 | #. i18n: ectx: property (text), widget (QRadioButton, completeYesRadio)
173 | #: rc.cpp:24
174 | #, kde-format
175 | msgid "Use for complete"
176 | msgstr ""
177 |
178 | #: gui/adddictdialog.cpp:33
179 | msgid "User"
180 | msgstr ""
181 |
182 | #: src/cskkconfig.h:36
183 | msgid "Vertical"
184 | msgstr ""
185 |
186 | #: org.fcitx.Fcitx5.Addon.Cskk.metainfo.xml.in:7
187 | msgid "fcitx5-cskk"
188 | msgstr ""
189 |
190 | #: org.fcitx.Fcitx5.Addon.Cskk.metainfo.xml.in:9
191 | msgid "libCSKK Japanese input method"
192 | msgstr ""
193 |
--------------------------------------------------------------------------------
/po/ru.po:
--------------------------------------------------------------------------------
1 | # SOME DESCRIPTIVE TITLE.
2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3 | # This file is distributed under the same license as the fcitx5-cskk package.
4 | #
5 | # Translators:
6 | # Dmitry , 2024
7 | #
8 | msgid ""
9 | msgstr ""
10 | "Project-Id-Version: fcitx5-cskk\n"
11 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n"
12 | "POT-Creation-Date: 2024-05-31 20:25+0000\n"
13 | "PO-Revision-Date: 2022-10-21 07:47+0000\n"
14 | "Last-Translator: Dmitry , 2024\n"
15 | "Language-Team: Russian (https://app.transifex.com/fcitx/teams/12005/ru/)\n"
16 | "Language: ru\n"
17 | "MIME-Version: 1.0\n"
18 | "Content-Type: text/plain; charset=UTF-8\n"
19 | "Content-Transfer-Encoding: 8bit\n"
20 | "Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
21 | "n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || "
22 | "(n%100>=11 && n%100<=14)? 2 : 3);\n"
23 |
24 | #. i18n: file: gui/adddictdialog.ui:45
25 | #. i18n: ectx: property (text), widget (QLabel, pathLabel)
26 | #: rc.cpp:12
27 | #, kde-format
28 | msgid "&Path:"
29 | msgstr "&Путь:"
30 |
31 | #. i18n: file: gui/adddictdialog.ui:25
32 | #. i18n: ectx: property (text), widget (QLabel, typeLabel)
33 | #: rc.cpp:9
34 | #, kde-format
35 | msgid "&Type:"
36 | msgstr "&Тип:"
37 |
38 | #: src/cskkconfig.h:41
39 | msgid "Always"
40 | msgstr "Всегда"
41 |
42 | #: src/cskkconfig.h:107
43 | msgid "Candidate Layout"
44 | msgstr "Расположение слов-кандидатов"
45 |
46 | #: src/cskkconfig.h:104
47 | msgid "Candidate list page size"
48 | msgstr "Размер страницы списка слов-кандидатов"
49 |
50 | #: src/cskkconfig.h:137
51 | msgid "Candidate selection keys"
52 | msgstr "Клавиши выбора слов-кандидатов"
53 |
54 | #: src/cskkconfig.h:130
55 | msgid "Candidates Page Next Page"
56 | msgstr "Следующая страница слов-кандидатов"
57 |
58 | #: src/cskkconfig.h:124
59 | msgid "Candidates Page Previous Page"
60 | msgstr "Предыдущая страница слов-кандидатов"
61 |
62 | #: src/cskkconfig.h:102
63 | msgid "Candidates to show before showing in list"
64 | msgstr "Отображать количество слов-кандидатов перед списком слов-кандидатов"
65 |
66 | #: src/cskkconfig.h:97
67 | msgid "Comma style"
68 | msgstr "Стиль запятой"
69 |
70 | #. i18n: file: gui/adddictdialog.ui:90
71 | #. i18n: ectx: property (text), widget (QLabel, completeLabel)
72 | #: rc.cpp:18
73 | #, kde-format
74 | msgid "Completion:"
75 | msgstr "Завершение:"
76 |
77 | #: src/cskk.conf.in:3
78 | msgid "Cskk"
79 | msgstr "Cskk"
80 |
81 | #: src/cskk-addon.conf.in.in:3
82 | msgid "Cskk input method for Fcitx5"
83 | msgstr "Метод ввода Cskk для Fcitx5"
84 |
85 | #: src/cskkconfig.h:118
86 | msgid "Cursor Down"
87 | msgstr "Курсор вниз"
88 |
89 | #: src/cskkconfig.h:112
90 | msgid "Cursor Up"
91 | msgstr "Курсор вверх"
92 |
93 | #. i18n: file: gui/adddictdialog.ui:14
94 | #. i18n: ectx: property (windowTitle), widget (QDialog, AddDictDialog)
95 | #: rc.cpp:6
96 | #, kde-format
97 | msgid "Dialog"
98 | msgstr "Диалог"
99 |
100 | #: src/cskkconfig.h:145
101 | msgid "Dictionary"
102 | msgstr "Словарь"
103 |
104 | #: gui/dictwidget.cpp:46
105 | msgid "Dictionary Manager"
106 | msgstr "Менеджер словарей"
107 |
108 | #. i18n: file: gui/adddictdialog.ui:99
109 | #. i18n: ectx: property (text), widget (QRadioButton, completeNoRadio)
110 | #: rc.cpp:21
111 | #, kde-format
112 | msgid "Do not complete"
113 | msgstr "Не завершать"
114 |
115 | #. i18n: file: gui/adddictdialog.ui:73
116 | #. i18n: ectx: property (text), widget (QLabel, encodingLabel)
117 | #: rc.cpp:15
118 | #, kde-format
119 | msgid "Encoding:"
120 | msgstr "Кодировка:"
121 |
122 | #. i18n: file: gui/dictwidget.ui:14
123 | #. i18n: ectx: property (windowTitle), widget (QWidget, SkkDictWidget)
124 | #: rc.cpp:3
125 | #, kde-format
126 | msgid "Form"
127 | msgstr "Форма"
128 |
129 | #: src/cskkconfig.h:36
130 | msgid "Horizontal"
131 | msgstr "Горизонтально"
132 |
133 | #: src/cskk-addon.conf.in.in:4
134 | msgid "IM using libcskk"
135 | msgstr "Метод ввода с использованием libcskk"
136 |
137 | #: src/cskkconfig.h:93
138 | msgid "InitialInputMode"
139 | msgstr "Начальный метод ввода"
140 |
141 | #: src/cskkconfig.h:42
142 | msgid "Never"
143 | msgstr "Никогда"
144 |
145 | #: src/cskkconfig.h:35
146 | msgid "Not set"
147 | msgstr "Не задано"
148 |
149 | #: src/cskkconfig.h:95
150 | msgid "Period style"
151 | msgstr "Стиль периода"
152 |
153 | #: src/cskkconfig.h:91
154 | msgid "Rule"
155 | msgstr "Правило"
156 |
157 | #: gui/adddictdialog.cpp:95 gui/adddictdialog.cpp:118
158 | msgid "Select Dictionary File"
159 | msgstr "Выбрать файл словаря"
160 |
161 | #: src/cskkconfig.h:142
162 | msgid "Show Annotation when"
163 | msgstr "Показывать аннотацию, когда"
164 |
165 | #: src/cskkconfig.h:42
166 | msgid "SingleCandidate"
167 | msgstr "Единственное слово-кандидат"
168 |
169 | #: gui/adddictdialog.cpp:32
170 | msgid "System"
171 | msgstr "Система"
172 |
173 | #. i18n: file: gui/adddictdialog.ui:109
174 | #. i18n: ectx: property (text), widget (QRadioButton, completeYesRadio)
175 | #: rc.cpp:24
176 | #, kde-format
177 | msgid "Use for complete"
178 | msgstr "Использовать для завершения"
179 |
180 | #: gui/adddictdialog.cpp:33
181 | msgid "User"
182 | msgstr "Пользователь"
183 |
184 | #: src/cskkconfig.h:36
185 | msgid "Vertical"
186 | msgstr "Вертикально"
187 |
188 | #: org.fcitx.Fcitx5.Addon.Cskk.metainfo.xml.in:7
189 | msgid "fcitx5-cskk"
190 | msgstr "fcitx5-cskk"
191 |
192 | #: org.fcitx.Fcitx5.Addon.Cskk.metainfo.xml.in:9
193 | msgid "libCSKK Japanese input method"
194 | msgstr "Японский метод ввода libCSKK"
195 |
--------------------------------------------------------------------------------
/po/vi.po:
--------------------------------------------------------------------------------
1 | # SOME DESCRIPTIVE TITLE.
2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3 | # This file is distributed under the same license as the fcitx5-cskk package.
4 | #
5 | # Translators:
6 | # hoanghuy309 , 2025
7 | #
8 | msgid ""
9 | msgstr ""
10 | "Project-Id-Version: fcitx5-cskk\n"
11 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n"
12 | "POT-Creation-Date: 2025-04-22 20:25+0000\n"
13 | "PO-Revision-Date: 2022-10-21 07:47+0000\n"
14 | "Last-Translator: hoanghuy309 , 2025\n"
15 | "Language-Team: Vietnamese (https://app.transifex.com/fcitx/teams/12005/vi/)\n"
16 | "Language: vi\n"
17 | "MIME-Version: 1.0\n"
18 | "Content-Type: text/plain; charset=UTF-8\n"
19 | "Content-Transfer-Encoding: 8bit\n"
20 | "Plural-Forms: nplurals=1; plural=0;\n"
21 |
22 | #. i18n: file: gui/adddictdialog.ui:45
23 | #. i18n: ectx: property (text), widget (QLabel, pathLabel)
24 | #: rc.cpp:12
25 | #, kde-format
26 | msgid "&Path:"
27 | msgstr ""
28 |
29 | #. i18n: file: gui/adddictdialog.ui:25
30 | #. i18n: ectx: property (text), widget (QLabel, typeLabel)
31 | #: rc.cpp:9
32 | #, kde-format
33 | msgid "&Type:"
34 | msgstr ""
35 |
36 | #: src/cskkconfig.h:41
37 | msgid "Always"
38 | msgstr "Luôn luôn"
39 |
40 | #: src/cskkconfig.h:107
41 | msgid "Candidate Layout"
42 | msgstr ""
43 |
44 | #: src/cskkconfig.h:104
45 | msgid "Candidate list page size"
46 | msgstr ""
47 |
48 | #: src/cskkconfig.h:137
49 | msgid "Candidate selection keys"
50 | msgstr ""
51 |
52 | #: src/cskkconfig.h:130
53 | msgid "Candidates Page Next Page"
54 | msgstr ""
55 |
56 | #: src/cskkconfig.h:124
57 | msgid "Candidates Page Previous Page"
58 | msgstr ""
59 |
60 | #: src/cskkconfig.h:102
61 | msgid "Candidates to show before showing in list"
62 | msgstr ""
63 |
64 | #: src/cskkconfig.h:97
65 | msgid "Comma style"
66 | msgstr ""
67 |
68 | #. i18n: file: gui/adddictdialog.ui:90
69 | #. i18n: ectx: property (text), widget (QLabel, completeLabel)
70 | #: rc.cpp:18
71 | #, kde-format
72 | msgid "Completion:"
73 | msgstr ""
74 |
75 | #: src/cskk.conf.in:2
76 | msgid "Cskk"
77 | msgstr ""
78 |
79 | #: src/cskk-addon.conf.in.in:2
80 | msgid "Cskk input method for Fcitx5"
81 | msgstr ""
82 |
83 | #: src/cskkconfig.h:118
84 | msgid "Cursor Down"
85 | msgstr ""
86 |
87 | #: src/cskkconfig.h:112
88 | msgid "Cursor Up"
89 | msgstr ""
90 |
91 | #. i18n: file: gui/adddictdialog.ui:14
92 | #. i18n: ectx: property (windowTitle), widget (QDialog, AddDictDialog)
93 | #: rc.cpp:6
94 | #, kde-format
95 | msgid "Dialog"
96 | msgstr ""
97 |
98 | #: src/cskkconfig.h:145
99 | msgid "Dictionary"
100 | msgstr ""
101 |
102 | #: gui/dictwidget.cpp:46
103 | msgid "Dictionary Manager"
104 | msgstr ""
105 |
106 | #. i18n: file: gui/adddictdialog.ui:99
107 | #. i18n: ectx: property (text), widget (QRadioButton, completeNoRadio)
108 | #: rc.cpp:21
109 | #, kde-format
110 | msgid "Do not complete"
111 | msgstr ""
112 |
113 | #. i18n: file: gui/adddictdialog.ui:73
114 | #. i18n: ectx: property (text), widget (QLabel, encodingLabel)
115 | #: rc.cpp:15
116 | #, kde-format
117 | msgid "Encoding:"
118 | msgstr ""
119 |
120 | #. i18n: file: gui/dictwidget.ui:14
121 | #. i18n: ectx: property (windowTitle), widget (QWidget, SkkDictWidget)
122 | #: rc.cpp:3
123 | #, kde-format
124 | msgid "Form"
125 | msgstr ""
126 |
127 | #: src/cskkconfig.h:36
128 | msgid "Horizontal"
129 | msgstr ""
130 |
131 | #: src/cskk-addon.conf.in.in:3
132 | msgid "IM using libcskk"
133 | msgstr ""
134 |
135 | #: src/cskkconfig.h:93
136 | msgid "InitialInputMode"
137 | msgstr ""
138 |
139 | #: src/cskkconfig.h:42
140 | msgid "Never"
141 | msgstr "Không bao giờ"
142 |
143 | #: src/cskkconfig.h:35
144 | msgid "Not set"
145 | msgstr ""
146 |
147 | #: src/cskkconfig.h:95
148 | msgid "Period style"
149 | msgstr ""
150 |
151 | #: src/cskkconfig.h:91
152 | msgid "Rule"
153 | msgstr ""
154 |
155 | #: gui/adddictdialog.cpp:95 gui/adddictdialog.cpp:118
156 | msgid "Select Dictionary File"
157 | msgstr ""
158 |
159 | #: src/cskkconfig.h:142
160 | msgid "Show Annotation when"
161 | msgstr ""
162 |
163 | #: src/cskkconfig.h:42
164 | msgid "SingleCandidate"
165 | msgstr ""
166 |
167 | #: gui/adddictdialog.cpp:32
168 | msgid "System"
169 | msgstr ""
170 |
171 | #. i18n: file: gui/adddictdialog.ui:109
172 | #. i18n: ectx: property (text), widget (QRadioButton, completeYesRadio)
173 | #: rc.cpp:24
174 | #, kde-format
175 | msgid "Use for complete"
176 | msgstr ""
177 |
178 | #: gui/adddictdialog.cpp:33
179 | msgid "User"
180 | msgstr ""
181 |
182 | #: src/cskkconfig.h:36
183 | msgid "Vertical"
184 | msgstr ""
185 |
186 | #: org.fcitx.Fcitx5.Addon.Cskk.metainfo.xml.in:7
187 | msgid "fcitx5-cskk"
188 | msgstr ""
189 |
190 | #: org.fcitx.Fcitx5.Addon.Cskk.metainfo.xml.in:8
191 | msgid "libCSKK Japanese input method"
192 | msgstr ""
193 |
--------------------------------------------------------------------------------
/po/zh_CN.po:
--------------------------------------------------------------------------------
1 | # SOME DESCRIPTIVE TITLE.
2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3 | # This file is distributed under the same license as the fcitx5-cskk package.
4 | #
5 | # Translators:
6 | # csslayer , 2023
7 | #
8 | msgid ""
9 | msgstr ""
10 | "Project-Id-Version: fcitx5-cskk\n"
11 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n"
12 | "POT-Creation-Date: 2023-02-23 20:25+0000\n"
13 | "PO-Revision-Date: 2022-10-21 07:47+0000\n"
14 | "Last-Translator: csslayer , 2023\n"
15 | "Language-Team: Chinese (China) (https://www.transifex.com/fcitx/teams/12005/"
16 | "zh_CN/)\n"
17 | "Language: zh_CN\n"
18 | "MIME-Version: 1.0\n"
19 | "Content-Type: text/plain; charset=UTF-8\n"
20 | "Content-Transfer-Encoding: 8bit\n"
21 | "Plural-Forms: nplurals=1; plural=0;\n"
22 |
23 | #. i18n: file: gui/adddictdialog.ui:45
24 | #. i18n: ectx: property (text), widget (QLabel, pathLabel)
25 | #: rc.cpp:12
26 | #, kde-format
27 | msgid "&Path:"
28 | msgstr "路径(&P):"
29 |
30 | #. i18n: file: gui/adddictdialog.ui:25
31 | #. i18n: ectx: property (text), widget (QLabel, typeLabel)
32 | #: rc.cpp:9
33 | #, kde-format
34 | msgid "&Type:"
35 | msgstr "类型(&T):"
36 |
37 | #: src/cskkconfig.h:41
38 | msgid "Always"
39 | msgstr "总是"
40 |
41 | #: src/cskkconfig.h:107
42 | msgid "Candidate Layout"
43 | msgstr "候选词布局"
44 |
45 | #: src/cskkconfig.h:104
46 | msgid "Candidate list page size"
47 | msgstr "候选词列表数量"
48 |
49 | #: src/cskkconfig.h:137
50 | msgid "Candidate selection keys"
51 | msgstr "候选词选择键"
52 |
53 | #: src/cskkconfig.h:130
54 | msgid "Candidates Page Next Page"
55 | msgstr "候选词下一页"
56 |
57 | #: src/cskkconfig.h:124
58 | msgid "Candidates Page Previous Page"
59 | msgstr "候选词上一页"
60 |
61 | #: src/cskkconfig.h:102
62 | msgid "Candidates to show before showing in list"
63 | msgstr "显示候选词列表前的候选词个数"
64 |
65 | #: src/cskkconfig.h:97
66 | msgid "Comma style"
67 | msgstr "逗号风格"
68 |
69 | #. i18n: file: gui/adddictdialog.ui:90
70 | #. i18n: ectx: property (text), widget (QLabel, completeLabel)
71 | #: rc.cpp:18
72 | #, kde-format
73 | msgid "Completion:"
74 | msgstr "补全:"
75 |
76 | #: src/cskk.conf.in:3
77 | msgid "Cskk"
78 | msgstr "Cskk"
79 |
80 | #: src/cskk-addon.conf.in.in:3
81 | msgid "Cskk input method for Fcitx5"
82 | msgstr "Fcitx5 的 Cskk 输入法"
83 |
84 | #: src/cskkconfig.h:118
85 | msgid "Cursor Down"
86 | msgstr "光标后移"
87 |
88 | #: src/cskkconfig.h:112
89 | msgid "Cursor Up"
90 | msgstr "光标前移"
91 |
92 | #. i18n: file: gui/adddictdialog.ui:14
93 | #. i18n: ectx: property (windowTitle), widget (QDialog, AddDictDialog)
94 | #: rc.cpp:6
95 | #, kde-format
96 | msgid "Dialog"
97 | msgstr "对话框"
98 |
99 | #: src/cskkconfig.h:145
100 | msgid "Dictionary"
101 | msgstr "词典"
102 |
103 | #: gui/dictwidget.cpp:46
104 | msgid "Dictionary Manager"
105 | msgstr "词典管理器"
106 |
107 | #. i18n: file: gui/adddictdialog.ui:99
108 | #. i18n: ectx: property (text), widget (QRadioButton, completeNoRadio)
109 | #: rc.cpp:21
110 | #, kde-format
111 | msgid "Do not complete"
112 | msgstr "不用于补全"
113 |
114 | #. i18n: file: gui/adddictdialog.ui:73
115 | #. i18n: ectx: property (text), widget (QLabel, encodingLabel)
116 | #: rc.cpp:15
117 | #, kde-format
118 | msgid "Encoding:"
119 | msgstr "编码:"
120 |
121 | #. i18n: file: gui/dictwidget.ui:14
122 | #. i18n: ectx: property (windowTitle), widget (QWidget, SkkDictWidget)
123 | #: rc.cpp:3
124 | #, kde-format
125 | msgid "Form"
126 | msgstr "表单"
127 |
128 | #: src/cskkconfig.h:36
129 | msgid "Horizontal"
130 | msgstr "横排"
131 |
132 | #: src/cskk-addon.conf.in.in:4
133 | msgid "IM using libcskk"
134 | msgstr "使用 libcskk 的输入法"
135 |
136 | #: src/cskkconfig.h:93
137 | msgid "InitialInputMode"
138 | msgstr "初始输入模式"
139 |
140 | #: src/cskkconfig.h:42
141 | msgid "Never"
142 | msgstr "从不"
143 |
144 | #: src/cskkconfig.h:35
145 | msgid "Not set"
146 | msgstr "未设置"
147 |
148 | #: src/cskkconfig.h:95
149 | msgid "Period style"
150 | msgstr "句号风格"
151 |
152 | #: src/cskkconfig.h:91
153 | msgid "Rule"
154 | msgstr "规则"
155 |
156 | #: gui/adddictdialog.cpp:95 gui/adddictdialog.cpp:118
157 | msgid "Select Dictionary File"
158 | msgstr "选择词典文件"
159 |
160 | #: src/cskkconfig.h:142
161 | msgid "Show Annotation when"
162 | msgstr "显示注释"
163 |
164 | #: src/cskkconfig.h:42
165 | msgid "SingleCandidate"
166 | msgstr "单个候选词"
167 |
168 | #: gui/adddictdialog.cpp:32
169 | msgid "System"
170 | msgstr "系统"
171 |
172 | #. i18n: file: gui/adddictdialog.ui:109
173 | #. i18n: ectx: property (text), widget (QRadioButton, completeYesRadio)
174 | #: rc.cpp:24
175 | #, kde-format
176 | msgid "Use for complete"
177 | msgstr "用于补全"
178 |
179 | #: gui/adddictdialog.cpp:33
180 | msgid "User"
181 | msgstr "用户"
182 |
183 | #: src/cskkconfig.h:36
184 | msgid "Vertical"
185 | msgstr "竖排"
186 |
187 | #: org.fcitx.Fcitx5.Addon.Cskk.metainfo.xml.in:7
188 | msgid "fcitx5-cskk"
189 | msgstr "fcitx5-cskk"
190 |
191 | #: org.fcitx.Fcitx5.Addon.Cskk.metainfo.xml.in:9
192 | msgid "libCSKK Japanese input method"
193 | msgstr "libCSKK 日语输入法"
194 |
--------------------------------------------------------------------------------
/po/zh_TW.po:
--------------------------------------------------------------------------------
1 | # SOME DESCRIPTIVE TITLE.
2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3 | # This file is distributed under the same license as the fcitx5-cskk package.
4 | #
5 | # Translators:
6 | # 黃柏諺 , 2022
7 | # Neko ◣ 0xFF, 2022
8 | # Lau YeeYu, 2023
9 | #
10 | msgid ""
11 | msgstr ""
12 | "Project-Id-Version: fcitx5-cskk\n"
13 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n"
14 | "POT-Creation-Date: 2023-04-25 20:24+0000\n"
15 | "PO-Revision-Date: 2022-10-21 07:47+0000\n"
16 | "Last-Translator: Lau YeeYu, 2023\n"
17 | "Language-Team: Chinese (Taiwan) (https://app.transifex.com/fcitx/teams/12005/"
18 | "zh_TW/)\n"
19 | "Language: zh_TW\n"
20 | "MIME-Version: 1.0\n"
21 | "Content-Type: text/plain; charset=UTF-8\n"
22 | "Content-Transfer-Encoding: 8bit\n"
23 | "Plural-Forms: nplurals=1; plural=0;\n"
24 |
25 | #. i18n: file: gui/adddictdialog.ui:45
26 | #. i18n: ectx: property (text), widget (QLabel, pathLabel)
27 | #: rc.cpp:12
28 | #, kde-format
29 | msgid "&Path:"
30 | msgstr "路徑(&P):"
31 |
32 | #. i18n: file: gui/adddictdialog.ui:25
33 | #. i18n: ectx: property (text), widget (QLabel, typeLabel)
34 | #: rc.cpp:9
35 | #, kde-format
36 | msgid "&Type:"
37 | msgstr "類型(&T):"
38 |
39 | #: src/cskkconfig.h:41
40 | msgid "Always"
41 | msgstr "總是"
42 |
43 | #: src/cskkconfig.h:107
44 | msgid "Candidate Layout"
45 | msgstr "候選字詞佈局"
46 |
47 | #: src/cskkconfig.h:104
48 | msgid "Candidate list page size"
49 | msgstr "候選字詞清單頁面大小"
50 |
51 | #: src/cskkconfig.h:137
52 | msgid "Candidate selection keys"
53 | msgstr "候選字詞選取按鍵"
54 |
55 | #: src/cskkconfig.h:130
56 | msgid "Candidates Page Next Page"
57 | msgstr "候選字詞下一頁"
58 |
59 | #: src/cskkconfig.h:124
60 | msgid "Candidates Page Previous Page"
61 | msgstr "候選字詞上一頁"
62 |
63 | #: src/cskkconfig.h:102
64 | msgid "Candidates to show before showing in list"
65 | msgstr "顯示候選字詞清單前的候選字詞個數"
66 |
67 | #: src/cskkconfig.h:97
68 | msgid "Comma style"
69 | msgstr "逗號樣式"
70 |
71 | #. i18n: file: gui/adddictdialog.ui:90
72 | #. i18n: ectx: property (text), widget (QLabel, completeLabel)
73 | #: rc.cpp:18
74 | #, kde-format
75 | msgid "Completion:"
76 | msgstr "補全:"
77 |
78 | #: src/cskk.conf.in:3
79 | msgid "Cskk"
80 | msgstr "Cskk"
81 |
82 | #: src/cskk-addon.conf.in.in:3
83 | msgid "Cskk input method for Fcitx5"
84 | msgstr "Fcitx5 的 Cskk 輸入法"
85 |
86 | #: src/cskkconfig.h:118
87 | msgid "Cursor Down"
88 | msgstr "游標向下"
89 |
90 | #: src/cskkconfig.h:112
91 | msgid "Cursor Up"
92 | msgstr "游標向上"
93 |
94 | #. i18n: file: gui/adddictdialog.ui:14
95 | #. i18n: ectx: property (windowTitle), widget (QDialog, AddDictDialog)
96 | #: rc.cpp:6
97 | #, kde-format
98 | msgid "Dialog"
99 | msgstr "對話方塊"
100 |
101 | #: src/cskkconfig.h:145
102 | msgid "Dictionary"
103 | msgstr "字典"
104 |
105 | #: gui/dictwidget.cpp:46
106 | msgid "Dictionary Manager"
107 | msgstr "字典管理程式"
108 |
109 | #. i18n: file: gui/adddictdialog.ui:99
110 | #. i18n: ectx: property (text), widget (QRadioButton, completeNoRadio)
111 | #: rc.cpp:21
112 | #, kde-format
113 | msgid "Do not complete"
114 | msgstr "不用於補全"
115 |
116 | #. i18n: file: gui/adddictdialog.ui:73
117 | #. i18n: ectx: property (text), widget (QLabel, encodingLabel)
118 | #: rc.cpp:15
119 | #, kde-format
120 | msgid "Encoding:"
121 | msgstr "編碼:"
122 |
123 | #. i18n: file: gui/dictwidget.ui:14
124 | #. i18n: ectx: property (windowTitle), widget (QWidget, SkkDictWidget)
125 | #: rc.cpp:3
126 | #, kde-format
127 | msgid "Form"
128 | msgstr "表單"
129 |
130 | #: src/cskkconfig.h:36
131 | msgid "Horizontal"
132 | msgstr "水平"
133 |
134 | #: src/cskk-addon.conf.in.in:4
135 | msgid "IM using libcskk"
136 | msgstr "使用 libcskk 的輸入法"
137 |
138 | #: src/cskkconfig.h:93
139 | msgid "InitialInputMode"
140 | msgstr "初始輸入模式"
141 |
142 | #: src/cskkconfig.h:42
143 | msgid "Never"
144 | msgstr "從不"
145 |
146 | #: src/cskkconfig.h:35
147 | msgid "Not set"
148 | msgstr "未設定"
149 |
150 | #: src/cskkconfig.h:95
151 | msgid "Period style"
152 | msgstr "句號樣式"
153 |
154 | #: src/cskkconfig.h:91
155 | msgid "Rule"
156 | msgstr "規則"
157 |
158 | #: gui/adddictdialog.cpp:95 gui/adddictdialog.cpp:118
159 | msgid "Select Dictionary File"
160 | msgstr "選取字典檔案"
161 |
162 | #: src/cskkconfig.h:142
163 | msgid "Show Annotation when"
164 | msgstr "顯示注釋"
165 |
166 | #: src/cskkconfig.h:42
167 | msgid "SingleCandidate"
168 | msgstr "單個候選詞"
169 |
170 | #: gui/adddictdialog.cpp:32
171 | msgid "System"
172 | msgstr "系統"
173 |
174 | #. i18n: file: gui/adddictdialog.ui:109
175 | #. i18n: ectx: property (text), widget (QRadioButton, completeYesRadio)
176 | #: rc.cpp:24
177 | #, kde-format
178 | msgid "Use for complete"
179 | msgstr "用於補全"
180 |
181 | #: gui/adddictdialog.cpp:33
182 | msgid "User"
183 | msgstr "使用者"
184 |
185 | #: src/cskkconfig.h:36
186 | msgid "Vertical"
187 | msgstr "垂直"
188 |
189 | #: org.fcitx.Fcitx5.Addon.Cskk.metainfo.xml.in:7
190 | msgid "fcitx5-cskk"
191 | msgstr "fcitx5-cskk"
192 |
193 | #: org.fcitx.Fcitx5.Addon.Cskk.metainfo.xml.in:9
194 | msgid "libCSKK Japanese input method"
195 | msgstr "libCSKK 日文輸入法"
196 |
--------------------------------------------------------------------------------
/skk_dict_config.h.in:
--------------------------------------------------------------------------------
1 | #ifndef ___SKK_DICT_CONFIG_H___
2 | #define ___SKK_DICT_CONFIG_H___
3 |
4 | #define SKK_DICT_DEFAULT_PATH "@SKK_DICT_DEFAULT_PATH@"
5 | #define SKK_DICT_DEFAULT_ENCODING "@SKK_DICT_DEFAULT_ENCODING@"
6 |
7 | #endif /* __SKK_DICT_CONFIG_H__ */
8 |
--------------------------------------------------------------------------------
/src/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(CSKK_SOURCES
2 | cskk.cpp
3 | cskkcandidatelist.cpp
4 | )
5 | add_library(fcitx5-cskk MODULE ${CSKK_SOURCES})
6 | target_link_libraries(fcitx5-cskk
7 | Fcitx5::Core
8 | Fcitx5::Config
9 | PkgConfig::LIBCSKK
10 | )
11 |
12 | set_target_properties(fcitx5-cskk PROPERTIES PREFIX "")
13 | # Must install to same lib dir that Fcitx5Utils specify using FCITX_*DIR so that fcitx5 can find.
14 | install(TARGETS fcitx5-cskk DESTINATION "${FCITX_INSTALL_LIBDIR}/fcitx5")
15 |
16 | fcitx5_translate_desktop_file(cskk.conf.in cskk.conf)
17 | install(FILES "${CMAKE_CURRENT_BINARY_DIR}/cskk.conf" DESTINATION "${FCITX_INSTALL_DATADIR}/fcitx5/inputmethod")
18 |
19 | configure_file(cskk-addon.conf.in.in cskk-addon.conf.in @ONLY)
20 | fcitx5_translate_desktop_file("${CMAKE_CURRENT_BINARY_DIR}/cskk-addon.conf.in" cskk-addon.conf)
21 | install(FILES "${CMAKE_CURRENT_BINARY_DIR}/cskk-addon.conf" RENAME cskk.conf DESTINATION "${FCITX_INSTALL_PKGDATADIR}/addon")
22 |
23 | # Install default config to fcitx5 package data dir
24 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dictionary_list.in ${CMAKE_CURRENT_BINARY_DIR}/dictionary_list @ONLY)
25 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dictionary_list DESTINATION "${FCITX_INSTALL_PKGDATADIR}/cskk")
--------------------------------------------------------------------------------
/src/cskk-addon.conf.in.in:
--------------------------------------------------------------------------------
1 | [Addon]
2 | Name=Cskk input method for Fcitx5
3 | Comment=IM using libcskk
4 | Category=InputMethod
5 | Library=fcitx5-cskk
6 | Type=SharedLibrary
7 | OnDemand=True
8 | Icon=cskk
9 | Configurable=True
10 | Version=@PROJECT_VERSION@
11 |
12 | [Addon/Dependencies]
13 | 0=core:@REQUIRED_FCITX_VERSION@
14 |
--------------------------------------------------------------------------------
/src/cskk.conf.in:
--------------------------------------------------------------------------------
1 | [InputMethod]
2 | Name=Cskk
3 | Icon=cskk
4 | LangCode=ja
5 | Addon=cskk
6 | Label=CSKK
7 | Configurable=True
8 |
--------------------------------------------------------------------------------
/src/cskk.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Naoaki Iwakiri
3 | * This program is released under GNU General Public License version 3 or later
4 | * You should have received a copy of the GNU General Public License along with
5 | * this program. If not, see .
6 | *
7 | * Creation Date: 2021-04-30
8 | *
9 | * SPDX-License-Identifier: GPL-3.0-or-later
10 | * SPDX-FileType: SOURCE
11 | * SPDX-FileName: cskk.cpp
12 | * SPDX-FileCopyrightText: Copyright (c) 2021 Naoaki Iwakiri
13 | */
14 | #include "cskk.h"
15 | #include "cskkcandidatelist.h"
16 | #include "cskkconfig.h"
17 | #include "log.h"
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include
29 | #include
30 | #include
31 | #include
32 | #include
33 | #include
34 | #include
35 | #include
36 | #include
37 | #include
38 | #include
39 | #include
40 | #include
41 | #include
42 | #include
43 | #include
44 | #include
45 | #include
46 |
47 | extern "C" {
48 | #include
49 | #include
50 | }
51 |
52 | FCITX_DEFINE_LOG_CATEGORY(cskk_log, "cskk");
53 |
54 | namespace fcitx {
55 |
56 | /*******************************************************************************
57 | * FcitxCskkEngine
58 | ******************************************************************************/
59 | constexpr std::string_view config_file_path = "conf/fcitx5-cskk";
60 |
61 | FcitxCskkEngine::FcitxCskkEngine(Instance *instance)
62 | : instance_{instance}, factory_([this](InputContext &ic) {
63 | auto *newCskkContext = new FcitxCskkContext(this, &ic);
64 | newCskkContext->applyConfig();
65 | return newCskkContext;
66 | }) {
67 | reloadConfig();
68 | instance_->inputContextManager().registerProperty("cskkcontext", &factory_);
69 | }
70 |
71 | FcitxCskkEngine::~FcitxCskkEngine() = default;
72 |
73 | void FcitxCskkEngine::keyEvent(const InputMethodEntry & /*entry*/,
74 | KeyEvent &keyEvent) {
75 | CSKK_DEBUG() << "Engine keyEvent start: " << keyEvent.rawKey();
76 | // delegate to context
77 | auto *ic = keyEvent.inputContext();
78 | auto *context = ic->propertyFor(&factory_);
79 | context->keyEvent(keyEvent);
80 | CSKK_DEBUG() << "Engine keyEvent end";
81 | }
82 |
83 | void FcitxCskkEngine::save() {
84 | if (factory_.registered()) {
85 | instance_->inputContextManager().foreach ([this](InputContext *ic) {
86 | auto *context = ic->propertyFor(&factory_);
87 | return context->saveDictionary();
88 | });
89 | }
90 | }
91 |
92 | void FcitxCskkEngine::activate(const InputMethodEntry & /*entry*/,
93 | InputContextEvent & /*event*/) {}
94 |
95 | void FcitxCskkEngine::deactivate(const InputMethodEntry &entry,
96 | InputContextEvent &event) {
97 | reset(entry, event);
98 | }
99 |
100 | void FcitxCskkEngine::reset(const InputMethodEntry & /*entry*/,
101 | InputContextEvent &event) {
102 | CSKK_DEBUG() << "Reset";
103 | auto *ic = event.inputContext();
104 | auto *context = ic->propertyFor(&factory_);
105 | context->reset();
106 | }
107 |
108 | void FcitxCskkEngine::setConfig(const RawConfig &config) {
109 | CSKK_DEBUG() << "Cskk setconfig";
110 | config_.load(config, true);
111 | safeSaveAsIni(config_, std::string(config_file_path));
112 | reloadConfig();
113 | }
114 |
115 | void FcitxCskkEngine::reloadConfig() {
116 | CSKK_DEBUG() << "Cskkengine reload config";
117 | readAsIni(config_, std::string(config_file_path));
118 |
119 | loadDictionary();
120 | if (factory_.registered()) {
121 | instance_->inputContextManager().foreach ([this](InputContext *ic) {
122 | auto *context = ic->propertyFor(&factory_);
123 | context->applyConfig();
124 | return true;
125 | });
126 | }
127 | }
128 |
129 | typedef enum _FcitxSkkDictType { FSDT_Invalid, FSDT_File } FcitxSkkDictType;
130 |
131 | void FcitxCskkEngine::loadDictionary() {
132 | freeDictionaries();
133 |
134 | auto dict_config_file = StandardPath::global().open(
135 | StandardPath::Type::PkgData, "cskk/dictionary_list", O_RDONLY);
136 |
137 | if (!dict_config_file.isValid()) {
138 | return;
139 | }
140 |
141 | IFDStreamBuf buf(dict_config_file.fd());
142 | std::istream in(&buf);
143 | std::string line;
144 |
145 | while (std::getline(in, line)) {
146 | const auto trimmed = stringutils::trimView(line);
147 | const auto tokens = stringutils::split(trimmed, ",");
148 |
149 | if (tokens.size() < 3) {
150 | continue;
151 | }
152 |
153 | CSKK_DEBUG() << "Load dictionary: " << trimmed;
154 |
155 | FcitxSkkDictType type = FSDT_Invalid;
156 | int mode = 0;
157 | std::string path;
158 | std::string encoding;
159 | bool complete = false;
160 |
161 | for (const auto &token : tokens) {
162 | auto equal = token.find('=');
163 | if (equal == std::string::npos) {
164 | continue;
165 | }
166 |
167 | auto key = token.substr(0, equal);
168 | auto value = token.substr(equal + 1);
169 |
170 | // These keys from gui/dictmodel.cpp
171 | // Couldn't find a good way to make parser common for Qt classes and here.
172 | if (key == "type") {
173 | if (value == "file") {
174 | type = FSDT_File;
175 | }
176 | } else if (key == "file") {
177 | path = value;
178 | } else if (key == "mode") {
179 | if (value == "readonly") {
180 | mode = 1;
181 | } else if (value == "readwrite") {
182 | mode = 2;
183 | }
184 | } else if (key == "encoding") {
185 | encoding = value;
186 | } else if (key == "complete") {
187 | if (value == "true") {
188 | complete = true;
189 | }
190 | }
191 | }
192 |
193 | // encoding is not optional now, but for compatibility from fcitx5-skk.
194 | encoding = !encoding.empty() ? encoding : "euc-jp";
195 |
196 | if (type == FSDT_Invalid) {
197 | CSKK_WARN() << "Dictionary entry has invalid type. Ignored.";
198 | continue;
199 | }
200 | if (path.empty() || mode == 0) {
201 | CSKK_WARN() << "Invalid dictionary path or mode. Ignored";
202 | continue;
203 | }
204 | if (mode == 1) {
205 | // readonly mode
206 | auto *dict = skk_file_dict_new(path.c_str(), encoding.c_str(), complete);
207 | if (dict) {
208 | CSKK_DEBUG() << "Adding file dict: " << path
209 | << " complete:" << complete;
210 | dictionaries_.emplace_back(dict);
211 | } else {
212 | CSKK_WARN() << "Static dictionary load error. Ignored: " << path;
213 | }
214 | } else {
215 | // read/write mode
216 | constexpr char configDir[] = "$FCITX_CONFIG_DIR/";
217 | constexpr auto var_len = sizeof(configDir) - 1;
218 | std::string realpath = path;
219 | if (stringutils::startsWith(path, configDir)) {
220 | realpath = stringutils::joinPath(
221 | StandardPath::global().userDirectory(StandardPath::Type::PkgData),
222 | path.substr(var_len));
223 | }
224 | auto *userdict =
225 | skk_user_dict_new(realpath.c_str(), encoding.c_str(), complete);
226 | if (userdict) {
227 | CSKK_DEBUG() << "Adding user dict: " << realpath;
228 | dictionaries_.emplace_back(userdict);
229 | } else {
230 | CSKK_WARN() << "User dictionary load error. Ignored: " << realpath;
231 | }
232 | }
233 | }
234 | }
235 |
236 | void FcitxCskkEngine::freeDictionaries() {
237 | CSKK_DEBUG() << "Cskk free dict";
238 | for (auto *dictionary : dictionaries_) {
239 | skk_free_dictionary(dictionary);
240 | }
241 | dictionaries_.clear();
242 | }
243 |
244 | KeyList FcitxCskkEngine::getSelectionKeys(
245 | CandidateSelectionKeys candidateSelectionKeys) {
246 | switch (candidateSelectionKeys) {
247 | case CandidateSelectionKeys::ABCD:
248 | return fcitx::KeyList{Key(FcitxKey_a), Key(FcitxKey_b), Key(FcitxKey_c),
249 | Key(FcitxKey_d), Key(FcitxKey_e), Key(FcitxKey_f),
250 | Key(FcitxKey_g), Key(FcitxKey_h), Key(FcitxKey_i),
251 | Key(FcitxKey_j)};
252 | case CandidateSelectionKeys::QwertyCenter:
253 | return fcitx::KeyList{Key(FcitxKey_a), Key(FcitxKey_s),
254 | Key(FcitxKey_d), Key(FcitxKey_f),
255 | Key(FcitxKey_g), Key(FcitxKey_h),
256 | Key(FcitxKey_j), Key(FcitxKey_k),
257 | Key(FcitxKey_l), Key(FcitxKey_semicolon)};
258 | case CandidateSelectionKeys::Number:
259 | default:
260 | return fcitx::KeyList{Key(FcitxKey_1), Key(FcitxKey_2), Key(FcitxKey_3),
261 | Key(FcitxKey_4), Key(FcitxKey_5), Key(FcitxKey_6),
262 | Key(FcitxKey_7), Key(FcitxKey_8), Key(FcitxKey_9),
263 | Key(FcitxKey_0)};
264 | }
265 | }
266 |
267 | std::string
268 | FcitxCskkEngine::subModeIconImpl(const InputMethodEntry & /*unused*/,
269 | InputContext &ic) {
270 | auto *context = ic.propertyFor(&factory_);
271 | auto current_input_mode = context->getInputMode();
272 | switch (current_input_mode) {
273 | case InputMode::Ascii:
274 | return "cskk-ascii";
275 | case InputMode::HankakuKatakana:
276 | return "cskk-hankakukana";
277 | case InputMode::Hiragana:
278 | return "cskk-hiragana";
279 | case InputMode::Katakana:
280 | return "cskk-katakana";
281 | case InputMode::Zenkaku:
282 | return "cskk-zenei";
283 | default:
284 | return "";
285 | }
286 | }
287 |
288 | bool FcitxCskkEngine::isEngineReady() { return factory_.registered(); }
289 |
290 | /*******************************************************************************
291 | * CskkContext
292 | ******************************************************************************/
293 |
294 | FcitxCskkContext::FcitxCskkContext(FcitxCskkEngine *engine, InputContext *ic)
295 | : context_(skk_context_new(nullptr, 0)), ic_(ic), engine_(engine) {
296 | CSKK_DEBUG() << "Cskk context new";
297 | if (!context_) {
298 | // new context wasn't created
299 | CSKK_ERROR() << "Failed to create new cskk context";
300 | }
301 | }
302 |
303 | FcitxCskkContext::~FcitxCskkContext() { skk_free_context(context_); }
304 |
305 | void FcitxCskkContext::keyEvent(KeyEvent &keyEvent) {
306 | if (!context_) {
307 | CSKK_ERROR() << "CSKK Context is not setup. Ignored key.";
308 | return;
309 | }
310 | auto candidateList = std::dynamic_pointer_cast(
311 | ic_->inputPanel().candidateList());
312 | if (candidateList != nullptr && !candidateList->empty()) {
313 | if (handleCandidateSelection(candidateList, keyEvent)) {
314 | updateUI();
315 | return;
316 | }
317 | }
318 |
319 | auto composition_mode = skk_context_get_composition_mode(context_);
320 | if (composition_mode != CompositionMode::CompositionSelection &&
321 | composition_mode != CompositionMode::Completion) {
322 | CSKK_DEBUG() << "not composition selection. destroy candidate list.";
323 | ic_->inputPanel().setCandidateList(nullptr);
324 | }
325 |
326 | uint32_t modifiers =
327 | static_cast(keyEvent.rawKey().states() & KeyState::SimpleMask);
328 | CskkKeyEvent *cskkKeyEvent = skk_key_event_new_from_fcitx_keyevent(
329 | keyEvent.rawKey().sym(), modifiers, keyEvent.isRelease());
330 |
331 | if (skk_context_process_key_event(context_, cskkKeyEvent)) {
332 | CSKK_DEBUG() << "Key processed in context.";
333 | keyEvent.filterAndAccept();
334 | }
335 |
336 | if (keyEvent.filtered()) {
337 | updateUI();
338 | }
339 | }
340 |
341 | bool FcitxCskkContext::handleCandidateSelection(
342 | const std::shared_ptr &candidateList,
343 | KeyEvent &keyEvent) {
344 | if (keyEvent.isRelease()) {
345 | return false;
346 | }
347 | CSKK_DEBUG() << "handleCandidateSelection";
348 | const auto config = engine_->config();
349 |
350 | if (keyEvent.key().checkKeyList(*config.prevCursorKey)) {
351 | candidateList->prevCandidate();
352 | keyEvent.filterAndAccept();
353 | } else if (keyEvent.key().checkKeyList(*config.nextCursorKey)) {
354 | candidateList->nextCandidate();
355 | keyEvent.filterAndAccept();
356 | } else if (keyEvent.key().checkKeyList(*config.nextPageKey)) {
357 | candidateList->next();
358 | keyEvent.filterAndAccept();
359 | } else if (keyEvent.key().checkKeyList(*config.prevPageKey)) {
360 | candidateList->prev();
361 | keyEvent.filterAndAccept();
362 | } else if (keyEvent.key().check(Key(FcitxKey_Return))) {
363 | CSKK_DEBUG() << "return key caught in handle candidate";
364 | candidateList->candidate(candidateList->cursorIndex()).select(ic_);
365 | keyEvent.filterAndAccept();
366 | } else {
367 | KeyList selectionKeys = FcitxCskkEngine::getSelectionKeys(
368 | engine_->config().candidateSelectionKeys.value());
369 | if (auto idx = keyEvent.key().keyListIndex(selectionKeys);
370 | 0 <= idx && idx < candidateList->size()) {
371 | CSKK_DEBUG() << "Select from page. Idx: " << idx;
372 | candidateList->candidate(idx).select(ic_);
373 | keyEvent.filterAndAccept();
374 | }
375 | }
376 |
377 | return keyEvent.filtered();
378 | }
379 |
380 | void FcitxCskkContext::reset() {
381 | if (context_) {
382 | skk_context_reset(context_);
383 | }
384 | updateUI();
385 | }
386 |
387 | void FcitxCskkContext::updateUI() {
388 | if (!context_) {
389 | CSKK_WARN() << "No context setup";
390 | return;
391 | }
392 | const auto &config = engine_->config();
393 | auto &inputPanel = ic_->inputPanel();
394 | inputPanel.reset();
395 |
396 | // Output
397 | if (auto *output = skk_context_poll_output(context_)) {
398 | CSKK_DEBUG() << "output: " << output;
399 | if (strlen(output) > 0) {
400 | ic_->commitString(output);
401 | }
402 | skk_free_string(output);
403 | }
404 |
405 | // Preedit
406 | uint32_t stateStackLen;
407 | auto *preeditDetail = skk_context_get_preedit_detail(context_, &stateStackLen);
408 | auto [mainPreedit, supplementPreedit] =
409 | FcitxCskkContext::formatPreedit(preeditDetail, stateStackLen);
410 | skk_free_preedit_detail(preeditDetail, stateStackLen);
411 | // CandidateList
412 | int currentCursorPosition =
413 | skk_context_get_current_candidate_cursor_position(context_);
414 | bool showCandidateList =
415 | currentCursorPosition > engine_->config().pageStartIdx.value() - 1;
416 | if (showCandidateList) {
417 | char *current_to_composite = skk_context_get_current_to_composite(context_);
418 | auto currentCandidateList =
419 | std::dynamic_pointer_cast(
420 | ic_->inputPanel().candidateList());
421 | if (currentCandidateList == nullptr || currentCandidateList->empty() ||
422 | (strcmp(currentCandidateList->to_composite().c_str(),
423 | current_to_composite) != 0)) {
424 | // update whole currentCandidateList only if needed
425 | CSKK_DEBUG() << "Set new candidate list on UI update";
426 | inputPanel.setCandidateList(
427 | std::make_unique(engine_, ic_));
428 | } else {
429 | // Sync UI with actual data
430 | currentCandidateList->setCursorPosition(
431 | currentCursorPosition);
432 | }
433 |
434 | } else {
435 | inputPanel.setCandidateList(nullptr);
436 | }
437 |
438 | if (ic_->capabilityFlags().test(CapabilityFlag::Preedit)) {
439 | inputPanel.setClientPreedit(mainPreedit);
440 | if ((config.showAnnotationCondition.value() ==
441 | ShowAnnotationCondition::Always) ||
442 | (config.showAnnotationCondition.value() ==
443 | ShowAnnotationCondition::SingleCandidate &&
444 | !showCandidateList)) {
445 | inputPanel.setPreedit(supplementPreedit);
446 | }
447 | ic_->updatePreedit();
448 | } else {
449 | inputPanel.setPreedit(mainPreedit);
450 | }
451 |
452 | // StatusArea for status icon
453 | ic_->updateUserInterface(UserInterfaceComponent::StatusArea);
454 | ic_->updateUserInterface(UserInterfaceComponent::InputPanel);
455 | }
456 |
457 | void FcitxCskkContext::applyConfig() {
458 | CSKK_DEBUG() << "apply config";
459 | if (!context_) {
460 | CSKK_WARN() << "No context setup. Ignoring config.";
461 | return;
462 | }
463 | const auto &config = engine_->config();
464 |
465 | skk_context_set_rule(context_, config.cskkRule->c_str());
466 | skk_context_set_input_mode(context_, *config.inputMode);
467 | skk_context_set_dictionaries(context_, engine_->dictionaries().data(),
468 | engine_->dictionaries().size());
469 | skk_context_set_period_style(context_, *config.periodStyle);
470 | skk_context_set_comma_style(context_, *config.commaStyle);
471 | }
472 |
473 | void FcitxCskkContext::copyTo(InputContextProperty * /*unused*/) {
474 | // auto otherContext = dynamic_cast(context);
475 | // Ignored.
476 | // Even if fcitx5 global option is set to share input state、it only shares
477 | // the selection of the addon for this input method.
478 | // fcitx5-cskk will just hold each cskkcontext in each input context's
479 | // property and shares nothing.
480 | }
481 |
482 | bool FcitxCskkContext::saveDictionary() {
483 | if (!context_) {
484 | CSKK_WARN() << "No cskk context setup. Ignored dictionary save.";
485 | return false;
486 | }
487 | skk_context_save_dictionaries(context_);
488 | // cskk v0.8 doesn't return value on save dict, return true for now.
489 | return true;
490 | }
491 |
492 | int FcitxCskkContext::getInputMode() {
493 | if (!context_) {
494 | CSKK_WARN() << "No cskk context setup. No inputmode.";
495 | return -1;
496 | }
497 | return skk_context_get_input_mode(context_);
498 | }
499 |
500 | /**
501 | * format preedit state into Text.
502 | * Returns tuple of
503 | * Main content is something you always want to show, supplement content is
504 | * something you may show when you have space.
505 | */
506 | std::tuple
507 | FcitxCskkContext::formatPreedit(CskkStateInfoFfi *cskkStateInfoArray,
508 | uint32_t stateLen) {
509 | std::string precomposition_marker = "▽";
510 | std::string selection_marker = "▼";
511 | std::string completion_marker = "■";
512 | Text mainContent;
513 | Text supplementContent;
514 | size_t mainCursorIdx = 0;
515 | for (uint32_t i = 0; i < stateLen; i++) {
516 | auto cskkStateInfo = cskkStateInfoArray[i];
517 | switch (cskkStateInfo.tag) {
518 | case DirectStateInfo: {
519 | auto directStateInfo = cskkStateInfo.direct_state_info;
520 | if (directStateInfo.confirmed) {
521 | mainCursorIdx += strlen(directStateInfo.confirmed);
522 | mainContent.append(directStateInfo.confirmed, TextFormatFlag::NoFlag);
523 | }
524 | if (directStateInfo.unconverted) {
525 | mainCursorIdx += strlen(directStateInfo.unconverted);
526 | mainContent.append(directStateInfo.unconverted,
527 | TextFormatFlag::Underline);
528 | }
529 | } break;
530 | case PreCompositionStateInfo: {
531 | auto precompositionStateInfo = cskkStateInfo.pre_composition_state_info;
532 | mainCursorIdx += precomposition_marker.length();
533 | mainContent.append(precomposition_marker, TextFormatFlag::DontCommit);
534 | if (precompositionStateInfo.confirmed) {
535 | mainCursorIdx += strlen(precompositionStateInfo.confirmed);
536 | mainContent.append(precompositionStateInfo.confirmed,
537 | TextFormatFlag::NoFlag);
538 | }
539 | if (precompositionStateInfo.kana_to_composite) {
540 | mainCursorIdx += strlen(precompositionStateInfo.kana_to_composite);
541 | mainContent.append(precompositionStateInfo.kana_to_composite,
542 | TextFormatFlag::Underline);
543 | }
544 | if (precompositionStateInfo.unconverted) {
545 | mainCursorIdx += strlen(precompositionStateInfo.unconverted);
546 | mainContent.append(precompositionStateInfo.unconverted,
547 | TextFormatFlag::Underline);
548 | }
549 | } break;
550 | case PreCompositionOkuriganaStateInfo: {
551 | auto precompositionOkuriganaStateInfo =
552 | cskkStateInfo.pre_composition_okurigana_state_info;
553 | mainContent.append(precomposition_marker, TextFormatFlag::DontCommit);
554 | mainCursorIdx += precomposition_marker.length();
555 | if (precompositionOkuriganaStateInfo.confirmed) {
556 | mainCursorIdx += strlen(precompositionOkuriganaStateInfo.confirmed);
557 | mainContent.append(precompositionOkuriganaStateInfo.confirmed,
558 | TextFormatFlag::NoFlag);
559 | }
560 | if (precompositionOkuriganaStateInfo.kana_to_composite) {
561 | mainCursorIdx +=
562 | strlen(precompositionOkuriganaStateInfo.kana_to_composite);
563 | mainContent.append(precompositionOkuriganaStateInfo.kana_to_composite,
564 | TextFormatFlag::Underline);
565 | }
566 | if (precompositionOkuriganaStateInfo.unconverted) {
567 | mainContent.append("*", TextFormatFlags{TextFormatFlag::Underline,
568 | TextFormatFlag::DontCommit});
569 | mainCursorIdx +=
570 | strlen(precompositionOkuriganaStateInfo.unconverted) + 1;
571 | mainContent.append(precompositionOkuriganaStateInfo.unconverted,
572 | TextFormatFlag::Underline);
573 | }
574 | } break;
575 | case CompositionSelectionStateInfo: {
576 | auto compositionSelectionStateInfo =
577 | cskkStateInfo.composition_selection_state_info;
578 |
579 | if (compositionSelectionStateInfo.confirmed) {
580 | mainContent.append(compositionSelectionStateInfo.confirmed);
581 | mainCursorIdx += strlen(compositionSelectionStateInfo.confirmed);
582 | }
583 | mainContent.append(selection_marker, TextFormatFlag::DontCommit);
584 | mainCursorIdx += selection_marker.length();
585 |
586 | std::string tmpContentString;
587 | if (compositionSelectionStateInfo.composited) {
588 | mainCursorIdx += strlen(compositionSelectionStateInfo.composited);
589 | tmpContentString.append(compositionSelectionStateInfo.composited);
590 | }
591 | if (compositionSelectionStateInfo.okuri) {
592 | mainCursorIdx += strlen(compositionSelectionStateInfo.okuri);
593 | tmpContentString.append(compositionSelectionStateInfo.okuri);
594 | }
595 | mainContent.append(tmpContentString, TextFormatFlag::Underline);
596 |
597 | if (compositionSelectionStateInfo.annotation) {
598 | supplementContent.append(compositionSelectionStateInfo.annotation,
599 | TextFormatFlag::DontCommit);
600 | }
601 | } break;
602 | case RegisterStateInfo: {
603 | auto registerStateInfo = cskkStateInfo.register_state_info;
604 | mainContent.append(selection_marker, TextFormatFlag::DontCommit);
605 | mainCursorIdx += selection_marker.length();
606 | if (registerStateInfo.confirmed) {
607 | mainCursorIdx += strlen(registerStateInfo.confirmed);
608 | mainContent.append(registerStateInfo.confirmed,
609 | TextFormatFlag::DontCommit);
610 | }
611 | if (registerStateInfo.kana_to_composite) {
612 | mainCursorIdx += strlen(registerStateInfo.kana_to_composite);
613 | mainContent.append(registerStateInfo.kana_to_composite,
614 | TextFormatFlag::DontCommit);
615 | }
616 | if (registerStateInfo.okuri) {
617 | mainCursorIdx += strlen(registerStateInfo.okuri);
618 | mainContent.append(registerStateInfo.okuri, TextFormatFlag::DontCommit);
619 | }
620 | if (registerStateInfo.postfix) {
621 | mainCursorIdx += strlen(registerStateInfo.postfix);
622 | mainContent.append(registerStateInfo.postfix,
623 | TextFormatFlag::DontCommit);
624 | }
625 | mainCursorIdx += strlen("【");
626 | mainContent.append("【", TextFormatFlag::DontCommit);
627 | } break;
628 | case CompleteStateInfo: {
629 | auto completeStateInfo = cskkStateInfo.complete_state_info;
630 |
631 | if (completeStateInfo.confirmed) {
632 | mainContent.append(completeStateInfo.confirmed);
633 | mainCursorIdx += strlen(completeStateInfo.confirmed);
634 | }
635 | mainContent.append(completion_marker, TextFormatFlag::DontCommit);
636 | mainCursorIdx += completion_marker.length();
637 |
638 | if (completeStateInfo.completed) {
639 | mainCursorIdx += strlen(completeStateInfo.completed);
640 | mainContent.append(completeStateInfo.completed,
641 | TextFormatFlag::Underline);
642 | }
643 | if (completeStateInfo.completed_midashi) {
644 | supplementContent.append(completeStateInfo.completed_midashi,
645 | TextFormatFlag::DontCommit);
646 | }
647 | } break;
648 | }
649 | }
650 | // FIXME: Silently assuming length is less than int_max here. May fail when
651 | // length is over UINT_MAX. very unlikely, not high priority.
652 | mainContent.setCursor((int)mainCursorIdx);
653 | // Starting from 1 on purpose. No paren for submodes on top of the stack.
654 | for (uint32_t i = 1; i < stateLen; i++) {
655 | mainContent.append("】", TextFormatFlag::DontCommit);
656 | }
657 |
658 | return {mainContent, supplementContent};
659 | }
660 |
661 | /*******************************************************************************
662 | * FcitxCskkFactory
663 | ******************************************************************************/
664 |
665 | AddonInstance *FcitxCskkFactory::create(AddonManager *manager) {
666 | {
667 | CSKK_DEBUG() << "**** CSKK FcitxCskkFactory Create ****";
668 | registerDomain("fcitx5-cskk", FCITX_INSTALL_LOCALEDIR);
669 | auto *engine = new FcitxCskkEngine(manager->instance());
670 | if (engine->isEngineReady()) {
671 | return engine;
672 | }
673 | return nullptr;
674 | }
675 | }
676 | } // namespace fcitx
677 |
678 | FCITX_ADDON_FACTORY_V2(cskk, fcitx::FcitxCskkFactory);
679 |
--------------------------------------------------------------------------------
/src/cskk.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Naoaki Iwakiri
3 | * This program is released under GNU General Public License version 3 or later
4 | * You should have received a copy of the GNU General Public License along with
5 | * this program. If not, see .
6 | *
7 | * Creation Date: 2021-04-30
8 | *
9 | * SPDX-License-Identifier: GPL-3.0-or-later
10 | * SPDX-FileType: SOURCE
11 | * SPDX-FileName: cskk.h
12 | * SPDX-FileCopyrightText: Copyright (c) 2021 Naoaki Iwakiri
13 | */
14 |
15 | #ifndef FCITX5_CSKK_CSKK_H
16 | #define FCITX5_CSKK_CSKK_H
17 |
18 | #include "cskkconfig.h"
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include
29 | #include
30 | #include
31 | #include
32 | #include
33 | #include
34 | #include
35 |
36 | extern "C" {
37 | #include
38 | }
39 |
40 | namespace fcitx {
41 |
42 | class FcitxCskkContext;
43 | class FcitxCskkCandidateList;
44 |
45 | class FcitxCskkEngine final : public InputMethodEngineV2 {
46 | public:
47 | explicit FcitxCskkEngine(Instance *instance);
48 | ~FcitxCskkEngine() override;
49 |
50 | void keyEvent(const InputMethodEntry &entry, KeyEvent &keyEvent) override;
51 | void activate(const InputMethodEntry & /*entry*/,
52 | InputContextEvent & /*event*/) override;
53 | void deactivate(const InputMethodEntry &entry,
54 | InputContextEvent &event) override;
55 | void reset(const InputMethodEntry &entry, InputContextEvent &event) override;
56 | void save() override;
57 | std::string subModeIconImpl(const InputMethodEntry & /*unused*/,
58 | InputContext & /*unused*/) override;
59 |
60 | // Configuration methods are called from fctix5-configtool via DBus message
61 | // to fcitx5 server.
62 | const Configuration *getConfig() const override { return &config_; }
63 | void setConfig(const RawConfig &config) override;
64 | void reloadConfig() override;
65 |
66 | const auto &dictionaries() { return dictionaries_; }
67 | const auto &config() { return config_; }
68 | FcitxCskkContext *context(InputContext *ic) {
69 | return ic->propertyFor(&factory_);
70 | }
71 |
72 | static KeyList
73 | getSelectionKeys(CandidateSelectionKeys candidateSelectionKeys);
74 |
75 | bool isEngineReady();
76 |
77 | private:
78 | Instance *instance_;
79 | FactoryFor factory_;
80 | FcitxCskkConfig config_;
81 | std::vector dictionaries_;
82 |
83 | void loadDictionary();
84 | void freeDictionaries();
85 | };
86 |
87 | class FcitxCskkContext final : public InputContextProperty {
88 | public:
89 | FcitxCskkContext(FcitxCskkEngine *engine, InputContext *ic);
90 | ~FcitxCskkContext() override;
91 | // Copy used for sharing state among programs
92 | void copyTo(InputContextProperty *state) override;
93 |
94 | void keyEvent(KeyEvent &keyEvent);
95 | void reset();
96 | void updateUI();
97 | void applyConfig();
98 |
99 | bool saveDictionary();
100 | // value castable to InputMode
101 | int getInputMode();
102 |
103 | // FIXME: Ideally, don't use this context() and prepare public function for
104 | // each usage to separate the responsibility.
105 | auto &context() { return context_; }
106 |
107 | private:
108 | // TODO: unique_ptr using some wrapper class for Rust exposed pointer? Need
109 | // bit more research.
110 | CskkContext *context_;
111 | InputContext *ic_;
112 | FcitxCskkEngine *engine_;
113 | bool handleCandidateSelection(
114 | const std::shared_ptr &candidateList,
115 | KeyEvent &keyEvent);
116 | static std::tuple formatPreedit(CskkStateInfoFfi *cskkStateInfo,
117 | uint32_t stateLen);
118 | };
119 |
120 | class FcitxCskkFactory final : public AddonFactory {
121 | public:
122 | AddonInstance *create(AddonManager *manager) override;
123 | };
124 |
125 | } // namespace fcitx
126 | #endif // FCITX5_CSKK_CSKK_H
127 |
--------------------------------------------------------------------------------
/src/cskkcandidatelist.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Naoaki Iwakiri
3 | * This program is released under GNU General Public License version 3 or later
4 | * You should have received a copy of the GNU General Public License along with
5 | * this program. If not, see .
6 | *
7 | * Creation Date: 2021-05-07
8 | *
9 | * SPDX-License-Identifier: GPL-3.0-or-later
10 | * SPDX-FileType: SOURCE
11 | * SPDX-FileName: fcitxcskkcandidatelist.cpp
12 | * SPDX-FileCopyrightText: Copyright (c) 2021 Naoaki Iwakiri
13 | */
14 |
15 | #include "cskkcandidatelist.h"
16 | #include "cskk.h"
17 | #include "cskkconfig.h"
18 | #include "log.h"
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 |
29 | extern "C" {
30 | #include
31 | }
32 |
33 | namespace fcitx {
34 | /*******************************************************************************
35 | * FcitxCskkCandidateList
36 | ******************************************************************************/
37 |
38 | FcitxCskkCandidateList::FcitxCskkCandidateList(FcitxCskkEngine *engine,
39 | InputContext *ic)
40 | : engine_(engine), ic_(ic) {
41 | CSKK_DEBUG() << "Construct FcitxCskkCandidateList";
42 | setPageable(this);
43 | setCursorMovable(this);
44 |
45 | FcitxCskkContext *fcitxCskkContext = engine_->context(ic_);
46 | CskkContext *cskkContext = fcitxCskkContext->context();
47 |
48 | auto totalSize = skk_context_get_current_candidate_count(cskkContext);
49 | std::vector candidates;
50 | candidates.resize(totalSize);
51 | auto loadedSize = skk_context_get_current_candidates(
52 | cskkContext, candidates.data(), totalSize, 0);
53 | totalSize_ = loadedSize;
54 | for (auto i = 0; i < static_cast(totalSize_); i++) {
55 | Text text;
56 | text.append(candidates[i]);
57 | words_.emplace_back(
58 | std::make_unique(engine_, text, i));
59 | }
60 |
61 | skk_free_candidate_list(candidates.data(), loadedSize);
62 |
63 | const auto &config = engine_->config();
64 | auto labels =
65 | FcitxCskkCandidateList::getLabels(config.candidateSelectionKeys.value());
66 | for (char label : labels) {
67 | auto theLabel = {label, ' ', '\0'};
68 | labels_.emplace_back(Text(theLabel));
69 | }
70 |
71 | char *to_composite = skk_context_get_current_to_composite(cskkContext);
72 | wordToComposite_ = std::string(to_composite);
73 | skk_free_string(to_composite);
74 |
75 | pageSize_ = config.pageSize.value();
76 | pageStartOffset_ = config.pageStartIdx.value() - 1;
77 | totalPage_ = ((totalSize_ - pageStartOffset_ - 1) / pageSize_);
78 |
79 | auto cursorPosition =
80 | skk_context_get_current_candidate_cursor_position(cskkContext);
81 | setCursorPosition(cursorPosition);
82 | }
83 | const Text &FcitxCskkCandidateList::label(int idx) const {
84 | return labels_[idx];
85 | }
86 | const CandidateWord &FcitxCskkCandidateList::candidate(int idx) const {
87 | return *words_[pageFirst_ + idx];
88 | }
89 | // number of candidates on the current page.
90 | int FcitxCskkCandidateList::size() const {
91 | return static_cast(pageLast_ - pageFirst_);
92 | }
93 | int FcitxCskkCandidateList::cursorIndex() const { return cursorIndex_; }
94 | CandidateLayoutHint FcitxCskkCandidateList::layoutHint() const {
95 | return *engine_->config().candidateLayout;
96 | }
97 | void FcitxCskkCandidateList::prevCandidate() {
98 | auto newCursorPos = static_cast(cursorIndex_ + pageFirst_ - 1);
99 | setCursorPosition(newCursorPos);
100 | }
101 | void FcitxCskkCandidateList::nextCandidate() {
102 | auto newCursorPos = static_cast(cursorIndex_ + pageFirst_ + 1);
103 | setCursorPosition(newCursorPos);
104 | }
105 | void FcitxCskkCandidateList::setCursorPosition(int cursorPosition) {
106 | // This might be duplicating call to the same cursor position, but doesn't
107 | // harm to sync the position.
108 | FcitxCskkContext *fcitxCskkContext = engine_->context(ic_);
109 | CskkContext *cskkContext = fcitxCskkContext->context();
110 | skk_context_select_candidate_at(cskkContext, cursorPosition);
111 |
112 | // Assume totalSize = 27, cursorPosition = 14, pageStartOffset = 3, page_size
113 | // = 10.
114 | //
115 | // 0~3: not in page. 4~13: 0th page. 14~23: 1st page. 24~26: 2nd page.
116 | currentPage_ =
117 | static_cast((cursorPosition - pageStartOffset_ - 1) / pageSize_);
118 | pageFirst_ = currentPage_ * pageSize_ + pageStartOffset_ + 1;
119 | pageLast_ = std::min(totalSize_, pageFirst_ + pageSize_);
120 | cursorIndex_ = static_cast(cursorPosition - pageFirst_);
121 |
122 | // assert!(pageFirst_ <= cursorPosition)
123 | // assert!(cursorPosition < pageLast_)
124 | // assert!(pageFirst_ + cursorIndex_ < pageLast_)
125 | }
126 | bool FcitxCskkCandidateList::hasPrev() const { return currentPage_ > 1; }
127 | bool FcitxCskkCandidateList::hasNext() const {
128 | return currentPage_ < static_cast(totalPage_);
129 | }
130 | void FcitxCskkCandidateList::prev() {
131 | auto newCursorPos = static_cast(pageFirst_ - pageSize_);
132 | setCursorPosition(newCursorPos);
133 | }
134 | void FcitxCskkCandidateList::next() {
135 | auto newCursorPos = static_cast(pageFirst_ + pageSize_);
136 | usedNextBefore_ = true;
137 | setCursorPosition(newCursorPos);
138 | }
139 | int FcitxCskkCandidateList::totalPages() const {
140 | return static_cast(totalPage_);
141 | }
142 | int FcitxCskkCandidateList::currentPage() const {
143 | return static_cast(currentPage_);
144 | }
145 | void FcitxCskkCandidateList::setPage(int page) {
146 | auto newCursorPos =
147 | static_cast(pageStartOffset_ + (page * pageSize_) + 1);
148 | setCursorPosition(newCursorPos);
149 | }
150 | bool FcitxCskkCandidateList::usedNextBefore() const { return usedNextBefore_; }
151 | std::string FcitxCskkCandidateList::getLabels(
152 | CandidateSelectionKeys candidateSelectionKeys) {
153 | switch (candidateSelectionKeys) {
154 | case CandidateSelectionKeys::ABCD:
155 | return "abcdefghij";
156 | case CandidateSelectionKeys::QwertyCenter:
157 | return "asdfghjkl;";
158 | case CandidateSelectionKeys::Number:
159 | default:
160 | return "1234567890";
161 | }
162 | }
163 |
164 | FcitxCskkCandidateList::~FcitxCskkCandidateList() = default;
165 |
166 | /*******************************************************************************
167 | * FcitxCskkCandidateWord
168 | ******************************************************************************/
169 | FcitxCskkCandidateWord::FcitxCskkCandidateWord(FcitxCskkEngine *engine,
170 | Text text, int cursorPosition)
171 | : engine_(engine), cursorPosition_(cursorPosition) {
172 | CSKK_DEBUG() << "candidate word create: " << text.toString();
173 | setText(std::move(text));
174 | }
175 | void FcitxCskkCandidateWord::select(InputContext *inputContext) const {
176 | {
177 | auto *fcitxCskkContext = engine_->context(inputContext);
178 | skk_context_confirm_candidate_at(fcitxCskkContext->context(),
179 | static_cast(cursorPosition_));
180 | fcitxCskkContext->updateUI();
181 | }
182 | }
183 |
184 | } // namespace fcitx
--------------------------------------------------------------------------------
/src/cskkcandidatelist.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Naoaki Iwakiri
3 | * This program is released under GNU General Public License version 3 or later
4 | * You should have received a copy of the GNU General Public License along with
5 | * this program. If not, see .
6 | *
7 | * Creation Date: 2021-05-07
8 | *
9 | * SPDX-License-Identifier: GPL-3.0-or-later
10 | * SPDX-FileType: SOURCE
11 | * SPDX-FileName: fcitxcskkcandidatelist.h
12 | * SPDX-FileCopyrightText: Copyright (c) 2021 Naoaki Iwakiri
13 | */
14 |
15 | #ifndef FCITX5_CSKK_CSKKCANDIDATELIST_H
16 | #define FCITX5_CSKK_CSKKCANDIDATELIST_H
17 |
18 | #include "cskk.h"
19 | #include "cskkconfig.h"
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 |
26 | namespace fcitx {
27 |
28 | class FcitxCskkCandidateWord;
29 |
30 | class FcitxCskkCandidateList : public CandidateList,
31 | public CursorMovableCandidateList,
32 | public PageableCandidateList {
33 | public:
34 | FcitxCskkCandidateList(FcitxCskkEngine *engine, InputContext *ic);
35 | ~FcitxCskkCandidateList() override;
36 |
37 | // CandidateList
38 | // disabling [[nodiscard]] lint since it's not clear how this should be used
39 | // from fcitx5.
40 |
41 | /// idx seems like the 0-origin idx in the shown page.
42 | // NOLINTNEXTLINE(modernize-use-nodiscard)
43 | const Text &label(int idx) const override;
44 | /// idx seems like the 0-origin idx in the shown page.
45 | // NOLINTNEXTLINE(modernize-use-nodiscard)
46 | const CandidateWord &candidate(int idx) const override;
47 | // NOLINTNEXTLINE(modernize-use-nodiscard)
48 | int size() const override;
49 | // NOLINTNEXTLINE(modernize-use-nodiscard)
50 | int cursorIndex() const override;
51 | // NOLINTNEXTLINE(modernize-use-nodiscard)
52 | CandidateLayoutHint layoutHint() const override;
53 |
54 | // CursorMovableCandidateList
55 | void prevCandidate() override;
56 | void nextCandidate() override;
57 |
58 | // PagableCandidateList
59 | // Need for paging
60 | // FIXME?: Assumed has previous 'page'. not candidate.
61 | // NOLINTNEXTLINE(modernize-use-nodiscard)
62 | bool hasPrev() const override;
63 | // NOLINTNEXTLINE(modernize-use-nodiscard)
64 | bool hasNext() const override;
65 | void prev() override;
66 | void next() override;
67 | // NOLINTNEXTLINE(modernize-use-nodiscard)
68 | bool usedNextBefore() const override;
69 | // Following are optional.
70 | // NOLINTNEXTLINE(modernize-use-nodiscard)
71 | int totalPages() const override;
72 | // NOLINTNEXTLINE(modernize-use-nodiscard)
73 | int currentPage() const override;
74 | void setPage(int /*unused*/) override;
75 |
76 | const auto &to_composite() { return wordToComposite_; }
77 | /// cursorPosition is the position of the original cskk candidate list.
78 | void setCursorPosition(int cursorPosition);
79 |
80 | private:
81 | FcitxCskkEngine *engine_;
82 | InputContext *ic_;
83 | std::string wordToComposite_;
84 | std::vector labels_;
85 | std::vector> words_;
86 |
87 | int cursorIndex_{};
88 | unsigned int pageStartOffset_;
89 | unsigned int pageSize_;
90 | unsigned int totalSize_;
91 | unsigned int totalPage_;
92 | int currentPage_{};
93 |
94 | // Not sure what this is.
95 | bool usedNextBefore_ = false;
96 |
97 | // the position of the first candidate in this list in whole candidate list
98 | unsigned int pageFirst_{};
99 | // the position of the last candidate + 1 in this list in whole candidate
100 | // list. equals to pageFirst_ of next page if next page exists.
101 | unsigned int pageLast_{};
102 |
103 | static std::string getLabels(CandidateSelectionKeys candidateSelectionKeys);
104 | };
105 |
106 | class FcitxCskkCandidateWord : public CandidateWord {
107 | public:
108 | FcitxCskkCandidateWord(FcitxCskkEngine *engine, Text text,
109 | int cursorPosition);
110 | void select(InputContext *inputContext) const override;
111 |
112 | private:
113 | FcitxCskkEngine *engine_;
114 | int cursorPosition_;
115 | };
116 |
117 | } // namespace fcitx
118 | #endif // FCITX5_CSKK_CSKKCANDIDATELIST_H
119 |
--------------------------------------------------------------------------------
/src/cskkconfig.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Naoaki Iwakiri
3 | * This program is released under GNU General Public License version 3 or later
4 | * You should have received a copy of the GNU General Public License along with
5 | * this program. If not, see .
6 | *
7 | * Creation Date: 2021-05-15
8 | *
9 | * SPDX-License-Identifier: GPL-3.0-or-later
10 | * SPDX-FileType: SOURCE
11 | * SPDX-FileName: cskkconfig.h
12 | * SPDX-FileCopyrightText: Copyright (c) 2021 Naoaki Iwakiri
13 | */
14 |
15 | #ifndef FCITX5_CSKK_CSKKCONFIG_H
16 | #define FCITX5_CSKK_CSKKCONFIG_H
17 |
18 | extern "C" {
19 | #include
20 | }
21 | #include "log.h"
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | namespace fcitx {
28 |
29 | // TODO: use i18n annotation creation macro for ease
30 | FCITX_CONFIG_ENUM_NAME(InputMode, "Hiragana", "Katakana", "HankakuKana",
31 | "Zenkaku", "Ascii")
32 | FCITX_CONFIG_ENUM_NAME_WITH_I18N(PeriodStyle, "。", ".")
33 | FCITX_CONFIG_ENUM_NAME_WITH_I18N(CommaStyle, "、", ",")
34 |
35 | FCITX_CONFIG_ENUM_NAME_WITH_I18N(CandidateLayoutHint, N_("Not set"),
36 | N_("Vertical"), N_("Horizontal"));
37 |
38 | FCITX_CONFIG_ENUM(CandidateSelectionKeys, Number, ABCD, QwertyCenter)
39 |
40 | enum class ShowAnnotationCondition { Always, SingleCandidate, Never };
41 | FCITX_CONFIG_ENUM_NAME_WITH_I18N(ShowAnnotationCondition, N_("Always"),
42 | N_("SingleCandidate"), N_("Never"));
43 |
44 | static constexpr const char *CandidateSelectionKeys_Annotations[] = {
45 | "Number (1,2,3,...)", "ABCD (a,b,c,d,...)",
46 | "Qwerty Center row (a,s,d,f,...)"};
47 | struct CandidateSelectionKeysAnnotation : public EnumAnnotation {
48 | void dumpDescription(RawConfig &config) const {
49 | EnumAnnotation::dumpDescription(config);
50 | int length = sizeof(CandidateSelectionKeys_Annotations) /
51 | sizeof(CandidateSelectionKeys_Annotations[0]);
52 | for (int i = 0; i < length; i++) {
53 | config.setValueByPath("Enum/" + std::to_string(i),
54 | CandidateSelectionKeys_Annotations[i]);
55 | config.setValueByPath("EnumI18n/" + std::to_string(i),
56 | _(CandidateSelectionKeys_Annotations[i]));
57 | }
58 | }
59 | };
60 |
61 | struct InputModeAnnotation : public EnumAnnotation {
62 | void dumpDescription(RawConfig &config) const {
63 | EnumAnnotation::dumpDescription(config);
64 | int length = sizeof(_InputMode_Names) / sizeof(_InputMode_Names[0]);
65 | for (int i = 0; i < length; i++) {
66 | // FIXME: bit not sure if path is correct. Might need namespacing per each
67 | // configuration?
68 | config.setValueByPath("Enum/" + std::to_string(i), _InputMode_Names[i]);
69 | config.setValueByPath("EnumI18n/" + std::to_string(i),
70 | _(_InputMode_Names[i]));
71 | }
72 | }
73 | };
74 |
75 | struct FcitxCskkRuleAnnotation : public EnumAnnotation {
76 | void dumpDescription(RawConfig &config) const {
77 | EnumAnnotation::dumpDescription(config);
78 | uint length;
79 | auto rules = skk_get_rules(&length);
80 | for (uint i = 0; i < length; i++) {
81 | config.setValueByPath("Enum/" + std::to_string(i), rules[i].id);
82 | config.setValueByPath("EnumI18n/" + std::to_string(i), rules[i].name);
83 | }
84 | skk_free_rules(rules, length);
85 | }
86 | };
87 |
88 | FCITX_CONFIGURATION(
89 | FcitxCskkConfig,
90 | OptionWithAnnotation cskkRule{
91 | this, "Rule", _("Rule"), "default"};
92 | OptionWithAnnotation inputMode{
93 | this, "InitialInputMode", _("InitialInputMode"), Hiragana};
94 | OptionWithAnnotation periodStyle{
95 | this, "Period style", _("Period style"), PeriodStyle::PeriodJa};
96 | OptionWithAnnotation commaStyle{
97 | this, "Comma style", _("Comma style"), CommaStyle::CommaJa};
98 | // Must be >0 because addon cannot hook in on first transition to
99 | // composition selection mode.
100 | Option pageStartIdx{
101 | this, "Candidates to show before showing in list",
102 | _("Candidates to show before showing in list"), 3, IntConstrain(1)};
103 | Option pageSize{this, "Candidate list page size",
104 | _("Candidate list page size"), 5,
105 | IntConstrain(1, 10)};
106 | OptionWithAnnotation
107 | candidateLayout{this, "Candidate Layout", _("Candidate Layout"),
108 | CandidateLayoutHint::Vertical};
109 | KeyListOption prevCursorKey{
110 | this,
111 | "CursorUp",
112 | _("Cursor Up"),
113 | {Key(FcitxKey_Up)},
114 | KeyListConstrain({KeyConstrainFlag::AllowModifierLess})};
115 | KeyListOption nextCursorKey{
116 | this,
117 | "CursorDown",
118 | _("Cursor Down"),
119 | {Key(FcitxKey_Down)},
120 | KeyListConstrain({KeyConstrainFlag::AllowModifierLess})};
121 | KeyListOption prevPageKey{
122 | this,
123 | "CandidatesPageUpKey",
124 | _("Candidates Page Previous Page"),
125 | {Key(FcitxKey_Page_Up), Key(FcitxKey_x)},
126 | KeyListConstrain({KeyConstrainFlag::AllowModifierLess})};
127 | KeyListOption nextPageKey{
128 | this,
129 | "CandidatesPageDownKey",
130 | _("Candidates Page Next Page"),
131 | {Key(FcitxKey_Page_Down), Key(FcitxKey_space)},
132 | KeyListConstrain({KeyConstrainFlag::AllowModifierLess})};
133 |
134 | OptionWithAnnotation
136 | candidateSelectionKeys{this, "Candidate selection keys",
137 | _("Candidate selection keys"),
138 | CandidateSelectionKeys::Number};
139 | OptionWithAnnotation
141 | showAnnotationCondition{this, "Show Annotation when",
142 | _("Show Annotation when"),
143 | ShowAnnotationCondition::Always};
144 | ExternalOption dictionary{
145 | this, "Dictionary", _("Dictionary"),
146 | "fcitx://config/addon/cskk/dictionary_list"};) // FCITX_CONFIGURATION
147 | } // namespace fcitx
148 | #endif // FCITX5_CSKK_CSKKCONFIG_H
149 |
--------------------------------------------------------------------------------
/src/dictionary_list.in:
--------------------------------------------------------------------------------
1 | type=file,file=@SKK_DICT_DEFAULT_PATH@,mode=readonly,encoding=@SKK_DICT_DEFAULT_ENCODING@
--------------------------------------------------------------------------------
/src/log.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Naoaki Iwakiri
3 | * This program is released under GNU General Public License version 3 or later
4 | * You should have received a copy of the GNU General Public License along with
5 | * this program. If not, see .
6 | *
7 | * Creation Date: 2021-05-07
8 | *
9 | * SPDX-License-Identifier: GPL-3.0-or-later
10 | * SPDX-FileType: SOURCE
11 | * SPDX-FileName: log.h
12 | * SPDX-FileCopyrightText: Copyright (c) 2021 Naoaki Iwakiri
13 | */
14 |
15 | #ifndef FCITX5_CSKK_LOG_H
16 | #define FCITX5_CSKK_LOG_H
17 | #include
18 |
19 | FCITX_DECLARE_LOG_CATEGORY(cskk_log);
20 | #define CSKK_DEBUG() FCITX_LOGC(cskk_log, Debug) << "\t**CSKK** "
21 | #define CSKK_WARN() FCITX_LOGC(cskk_log, Warn) << "\t**CSKK** "
22 | #define CSKK_ERROR() FCITX_LOGC(cskk_log, Error) << "\t**CSKK** "
23 |
24 | #endif // FCITX5_CSKK_LOG_H
25 |
--------------------------------------------------------------------------------
/test/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | if (GOOGLETEST)
2 | message("Setting up test")
3 | add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/googletest ${PROJECT_SOURCE_DIR}/third_party/googletest/build)
4 | enable_testing()
5 | add_executable(runTest ${PROJECT_SOURCE_DIR}/test/main.cpp ${PROJECT_SOURCE_DIR}/test/basic_test.cpp)
6 |
7 | target_include_directories(
8 | runTest PUBLIC
9 | ${PROJECT_SOURCE_DIR}/third_party/googletest/googletest/include
10 | )
11 | target_link_libraries(
12 | runTest
13 | gtest
14 | )
15 |
16 | add_test(NAME runTest COMMAND runTest)
17 | endif ()
--------------------------------------------------------------------------------
/test/basic_test.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Naoaki Iwakiri
3 | * This program is released under GNU General Public License version 3 or later
4 | * You should have received a copy of the GNU General Public License along with
5 | * this program. If not, see .
6 | *
7 | * Creation Date: 2021-05-08
8 | *
9 | * SPDX-License-Identifier: GPL-3.0-or-later
10 | * SPDX-FileType: SOURCE
11 | * SPDX-FileName: basic_test.cpp
12 | * SPDX-FileCopyrightText: Copyright (c) 2021 Naoaki Iwakiri
13 | */
14 |
15 | #include "gtest/gtest.h"
16 | // TODO: Add real test
17 | // Test to check that test compiles...
18 | class TestTest : public ::testing::Test {};
19 |
20 | TEST_F(TestTest, A) { EXPECT_EQ(1, 1); }
21 | TEST_F(TestTest, B) { EXPECT_EQ(1, 2); }
--------------------------------------------------------------------------------
/test/main.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Naoaki Iwakiri
3 | * This program is released under GNU General Public License version 3 or later
4 | * You should have received a copy of the GNU General Public License along with
5 | * this program. If not, see .
6 | *
7 | * Creation Date: 2021-05-08
8 | *
9 | * SPDX-License-Identifier: GPL-3.0-or-later
10 | * SPDX-FileType: SOURCE
11 | * SPDX-FileName: main.cpp
12 | * SPDX-FileCopyrightText: Copyright (c) 2021 Naoaki Iwakiri
13 | */
14 |
15 | #include "gtest/gtest.h"
16 |
17 | int main(int argc, char **argv) {
18 | ::testing::InitGoogleTest(&argc, argv);
19 | return RUN_ALL_TESTS();
20 | }
21 |
--------------------------------------------------------------------------------