summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2022-04-11 14:29:44 +0800
committerPeng Wu <alexepico@gmail.com>2022-04-11 14:30:50 +0800
commit8de48eef341d2894b4d5ea6ee8a8fe8eaf53520f (patch)
tree4be2f4cfd29f3dfb741ece73ed7aa7871bddbe16 /src
parent276c943916535faff124e43503edc3d05c83cdd7 (diff)
downloadibus-libpinyin-8de48eef341d2894b4d5ea6ee8a8fe8eaf53520f.tar.gz
ibus-libpinyin-8de48eef341d2894b4d5ea6ee8a8fe8eaf53520f.tar.xz
ibus-libpinyin-8de48eef341d2894b4d5ea6ee8a8fe8eaf53520f.zip
Add English candidates option
Diffstat (limited to 'src')
-rw-r--r--src/PYConfig.cc3
-rw-r--r--src/PYConfig.h6
-rw-r--r--src/PYPConfig.cc9
-rw-r--r--src/PYPPhoneticEditor.cc2
4 files changed, 15 insertions, 5 deletions
diff --git a/src/PYConfig.cc b/src/PYConfig.cc
index d74cad3..4238b95 100644
--- a/src/PYConfig.cc
+++ b/src/PYConfig.cc
@@ -45,7 +45,6 @@ Config::initDefaultValues (void)
m_remember_every_input = FALSE;
m_sort_option = SORT_BY_PHRASE_LENGTH_AND_PINYIN_LENGTH_AND_FREQUENCY;
m_show_suggestion = FALSE;
- m_emoji_candidate = TRUE;
m_shift_select_candidate = FALSE;
m_minus_equal_page = TRUE;
@@ -76,6 +75,8 @@ Config::initDefaultValues (void)
m_english_input_mode = TRUE;
m_table_input_mode = TRUE;
m_use_custom_table = FALSE;
+ m_emoji_candidate = TRUE;
+ m_english_candidate = TRUE;
m_network_dictionary_start_timestamp = 0;
m_network_dictionary_end_timestamp = 0;
diff --git a/src/PYConfig.h b/src/PYConfig.h
index 328e0e9..9a69ceb 100644
--- a/src/PYConfig.h
+++ b/src/PYConfig.h
@@ -60,7 +60,6 @@ public:
gboolean rememberEveryInput (void) const { return m_remember_every_input; }
sort_option_t sortOption (void) const { return m_sort_option; }
gboolean showSuggestion (void) const { return m_show_suggestion; }
- gboolean emojiCandidate (void) const { return m_emoji_candidate; }
gboolean shiftSelectCandidate (void) const { return m_shift_select_candidate; }
gboolean minusEqualPage (void) const { return m_minus_equal_page; }
gboolean commaPeriodPage (void) const { return m_comma_period_page; }
@@ -81,6 +80,8 @@ public:
gboolean englishInputMode (void) const { return m_english_input_mode; }
gboolean tableInputMode (void) const { return m_table_input_mode; }
gboolean useCustomTable (void) const { return m_use_custom_table; }
+ gboolean emojiCandidate (void) const { return m_emoji_candidate; }
+ gboolean englishCandidate (void) const { return m_english_candidate; }
std::string mainSwitch (void) const { return m_main_switch; }
std::string letterSwitch (void) const { return m_letter_switch; }
@@ -144,7 +145,6 @@ protected:
gboolean m_remember_every_input;
sort_option_t m_sort_option;
gboolean m_show_suggestion;
- gboolean m_emoji_candidate;
gboolean m_shift_select_candidate;
gboolean m_minus_equal_page;
@@ -171,6 +171,8 @@ protected:
gboolean m_english_input_mode;
gboolean m_table_input_mode;
gboolean m_use_custom_table;
+ gboolean m_emoji_candidate;
+ gboolean m_english_candidate;
std::string m_main_switch;
std::string m_letter_switch;
diff --git a/src/PYPConfig.cc b/src/PYPConfig.cc
index 3daa5c6..b608022 100644
--- a/src/PYPConfig.cc
+++ b/src/PYPConfig.cc
@@ -37,7 +37,6 @@ const gchar * const CONFIG_DISPLAY_STYLE = "display-style";
const gchar * const CONFIG_REMEMBER_EVERY_INPUT = "remember-every-input";
const gchar * const CONFIG_SORT_OPTION = "sort-candidate-option";
const gchar * const CONFIG_SHOW_SUGGESTION = "show-suggestion";
-const gchar * const CONFIG_EMOJI_CANDIDATE = "emoji-candidate";
const gchar * const CONFIG_SHIFT_SELECT_CANDIDATE = "shift-select-candidate";
const gchar * const CONFIG_MINUS_EQUAL_PAGE = "minus-equal-page";
const gchar * const CONFIG_COMMA_PERIOD_PAGE = "comma-period-page";
@@ -61,6 +60,8 @@ const gchar * const CONFIG_LUA_EXTENSION = "lua-extension";
const gchar * const CONFIG_ENGLISH_INPUT_MODE = "english-input-mode";
const gchar * const CONFIG_TABLE_INPUT_MODE = "table-input-mode";
const gchar * const CONFIG_USE_CUSTOM_TABLE = "use-custom-table";
+const gchar * const CONFIG_EMOJI_CANDIDATE = "emoji-candidate";
+const gchar * const CONFIG_ENGLISH_CANDIDATE = "english-candidate";
const gchar * const CONFIG_IMPORT_CUSTOM_TABLE = "import-custom-table";
const gchar * const CONFIG_EXPORT_CUSTOM_TABLE = "export-custom-table";
const gchar * const CONFIG_CLEAR_CUSTOM_TABLE = "clear-custom-table";
@@ -132,7 +133,9 @@ LibPinyinConfig::initDefaultValues (void)
m_remember_every_input = FALSE;
m_sort_option = SORT_BY_PHRASE_LENGTH_AND_PINYIN_LENGTH_AND_FREQUENCY;
m_show_suggestion = FALSE;
+
m_emoji_candidate = TRUE;
+ m_english_candidate = TRUE;
m_shift_select_candidate = FALSE;
m_minus_equal_page = TRUE;
@@ -295,7 +298,9 @@ LibPinyinConfig::readDefaultValues (void)
}
m_show_suggestion = read (CONFIG_SHOW_SUGGESTION, false);
+
m_emoji_candidate = read (CONFIG_EMOJI_CANDIDATE, true);
+ m_english_candidate = read (CONFIG_ENGLISH_CANDIDATE, true);
m_dictionaries = read (CONFIG_DICTIONARIES, "");
m_opencc_config = read (CONFIG_OPENCC_CONFIG, "s2t.json");
@@ -399,6 +404,8 @@ LibPinyinConfig::valueChanged (const std::string &schema_id,
m_show_suggestion = normalizeGVariant (value, false);
} else if (CONFIG_EMOJI_CANDIDATE == name) {
m_emoji_candidate = normalizeGVariant (value, true);
+ } else if (CONFIG_ENGLISH_CANDIDATE == name) {
+ m_english_candidate = normalizeGVariant (value, true);
} else if (CONFIG_DICTIONARIES == name) {
m_dictionaries = normalizeGVariant (value, std::string (""));
} else if (CONFIG_OPENCC_CONFIG == name) {
diff --git a/src/PYPPhoneticEditor.cc b/src/PYPPhoneticEditor.cc
index 4d6c76b..8854b89 100644
--- a/src/PYPPhoneticEditor.cc
+++ b/src/PYPPhoneticEditor.cc
@@ -255,7 +255,7 @@ PhoneticEditor::updateCandidates (void)
m_traditional_candidates.processCandidates (m_candidates);
#ifdef IBUS_BUILD_ENGLISH_INPUT_MODE
- if (!m_config.doublePinyin () && m_config.englishInputMode ())
+ if (m_config.englishCandidate ())
m_english_candidates.processCandidates (m_candidates);
#endif