From 7216bcd03777defa253f2c70eeda364f345970dc Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Thu, 14 Jun 2018 15:53:43 +0800 Subject: add option show suggestion --- src/PYConfig.cc | 1 + src/PYConfig.h | 2 ++ src/PYPConfig.cc | 6 ++++++ 3 files changed, 9 insertions(+) diff --git a/src/PYConfig.cc b/src/PYConfig.cc index f10a1f9..9f47cb7 100644 --- a/src/PYConfig.cc +++ b/src/PYConfig.cc @@ -44,6 +44,7 @@ Config::initDefaultValues (void) m_page_size = 5; m_remember_every_input = FALSE; m_sort_option = SORT_BY_PHRASE_LENGTH_AND_PINYIN_LENGTH_AND_FREQUENCY; + m_show_suggestion = TRUE; m_shift_select_candidate = FALSE; m_minus_equal_page = TRUE; diff --git a/src/PYConfig.h b/src/PYConfig.h index c982ec5..3a01762 100644 --- a/src/PYConfig.h +++ b/src/PYConfig.h @@ -47,6 +47,7 @@ public: guint pageSize (void) const { return m_page_size; } 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 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; } @@ -96,6 +97,7 @@ protected: guint m_page_size; gboolean m_remember_every_input; sort_option_t m_sort_option; + gboolean m_show_suggestion; gboolean m_shift_select_candidate; gboolean m_minus_equal_page; diff --git a/src/PYPConfig.cc b/src/PYPConfig.cc index aa13f6c..2253b00 100644 --- a/src/PYPConfig.cc +++ b/src/PYPConfig.cc @@ -35,6 +35,7 @@ const gchar * const CONFIG_ORIENTATION = "lookup-table-orientation const gchar * const CONFIG_PAGE_SIZE = "lookup-table-page-size"; 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_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"; @@ -98,6 +99,7 @@ LibPinyinConfig::initDefaultValues (void) m_page_size = 5; m_remember_every_input = FALSE; m_sort_option = SORT_BY_PHRASE_LENGTH_AND_PINYIN_LENGTH_AND_FREQUENCY; + m_show_suggestion = TRUE; m_shift_select_candidate = FALSE; m_minus_equal_page = TRUE; @@ -204,6 +206,8 @@ LibPinyinConfig::readDefaultValues (void) } } + m_show_suggestion = read (CONFIG_SHOW_SUGGESTION, true); + m_dictionaries = read (CONFIG_DICTIONARIES, ""); m_main_switch = read (CONFIG_MAIN_SWITCH, ""); @@ -265,6 +269,8 @@ LibPinyinConfig::valueChanged (const std::string &schema_id, m_sort_option = sort_options[i].sort_option; } } + } else if (CONFIG_SHOW_SUGGESTION == name) { + m_show_suggestion = normalizeGVariant (value, true); } else if (CONFIG_DICTIONARIES == name) { m_dictionaries = normalizeGVariant (value, std::string ("")); } else if (CONFIG_MAIN_SWITCH == name) { -- cgit