summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2018-06-14 15:21:29 +0800
committerPeng Wu <alexepico@gmail.com>2018-06-14 15:21:29 +0800
commit94e9584b8b81cdcb4bce15ab58e83001bd085192 (patch)
tree91100b7c646d79dfcbce26368f74a1fc0a21bb87
parentb706eb6d35a6ba4fd33e2aeea5325e2db82cb9fe (diff)
downloadibus-libpinyin-94e9584b8b81cdcb4bce15ab58e83001bd085192.tar.gz
ibus-libpinyin-94e9584b8b81cdcb4bce15ab58e83001bd085192.tar.xz
ibus-libpinyin-94e9584b8b81cdcb4bce15ab58e83001bd085192.zip
add option lua converter
-rw-r--r--src/PYConfig.cc1
-rw-r--r--src/PYConfig.h2
-rw-r--r--src/PYPConfig.cc7
-rw-r--r--src/PYPPhoneticEditor.cc2
4 files changed, 11 insertions, 1 deletions
diff --git a/src/PYConfig.cc b/src/PYConfig.cc
index 91b7edb..f10a1f9 100644
--- a/src/PYConfig.cc
+++ b/src/PYConfig.cc
@@ -59,6 +59,7 @@ Config::initDefaultValues (void)
m_init_simp_chinese = TRUE;
m_dictionaries = "";
+ m_lua_converter = "";
m_main_switch = "<Shift>";
m_letter_switch = "";
diff --git a/src/PYConfig.h b/src/PYConfig.h
index 511f5c6..c982ec5 100644
--- a/src/PYConfig.h
+++ b/src/PYConfig.h
@@ -41,6 +41,7 @@ protected:
public:
std::string dictionaries (void) const { return m_dictionaries; }
+ std::string luaConverter (void) const { return m_lua_converter; }
pinyin_option_t option (void) const { return m_option & m_option_mask; }
guint orientation (void) const { return m_orientation; }
guint pageSize (void) const { return m_page_size; }
@@ -87,6 +88,7 @@ protected:
GSettings *m_settings;
std::string m_schema_id;
std::string m_dictionaries;
+ std::string m_lua_converter;
pinyin_option_t m_option;
pinyin_option_t m_option_mask;
diff --git a/src/PYPConfig.cc b/src/PYPConfig.cc
index 68efcb5..aa13f6c 100644
--- a/src/PYPConfig.cc
+++ b/src/PYPConfig.cc
@@ -46,6 +46,7 @@ const gchar * const CONFIG_INIT_FULL = "init-full";
const gchar * const CONFIG_INIT_FULL_PUNCT = "init-full-punct";
const gchar * const CONFIG_INIT_SIMP_CHINESE = "init-simplified-chinese";
const gchar * const CONFIG_DICTIONARIES = "dictionaries";
+const gchar * const CONFIG_LUA_CONVERTER = "lua-converter";
const gchar * const CONFIG_BOPOMOFO_KEYBOARD_MAPPING = "bopomofo-keyboard-mapping";
const gchar * const CONFIG_SELECT_KEYS = "select-keys";
const gchar * const CONFIG_GUIDE_KEY = "guide-key";
@@ -114,6 +115,7 @@ LibPinyinConfig::initDefaultValues (void)
m_bopomofo_keyboard_mapping = ZHUYIN_DEFAULT;
m_dictionaries = "";
+ m_lua_converter = "";
m_main_switch = "<Shift>";
m_letter_switch = "";
@@ -393,6 +395,9 @@ PinyinConfig::readDefaultValues (void)
m_comma_period_page = read (CONFIG_COMMA_PERIOD_PAGE, true);
m_auto_commit = read (CONFIG_AUTO_COMMIT, false);
+ /* lua */
+ m_lua_converter = read (CONFIG_LUA_CONVERTER, "");
+
/* correct pinyin */
if (read (CONFIG_CORRECT_PINYIN, true))
m_option_mask |= PINYIN_CORRECT_ALL;
@@ -451,6 +456,8 @@ PinyinConfig::valueChanged (const std::string &schema_id,
m_minus_equal_page = normalizeGVariant (value, true);
else if (CONFIG_COMMA_PERIOD_PAGE == name)
m_comma_period_page = normalizeGVariant (value, true);
+ else if (CONFIG_LUA_CONVERTER == name)
+ m_lua_converter = normalizeGVariant (value, std::string (""));
else if (CONFIG_AUTO_COMMIT == name)
m_auto_commit = normalizeGVariant (value, false);
else if (CONFIG_IMPORT_DICTIONARY == name) {
diff --git a/src/PYPPhoneticEditor.cc b/src/PYPPhoneticEditor.cc
index d47928a..2be4836 100644
--- a/src/PYPPhoneticEditor.cc
+++ b/src/PYPPhoneticEditor.cc
@@ -219,7 +219,7 @@ PhoneticEditor::updateCandidates (void)
m_lua_trigger_candidates.processCandidates (m_candidates);
- const char * converter = m_config.luaConverter ();
+ const char * converter = m_config.luaConverter ().c_str ();
if (NULL != converter) {
m_lua_converter_candidates.setConverter (converter);