summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2014-12-16 13:43:22 +0800
committerPeng Wu <alexepico@gmail.com>2014-12-16 13:52:20 +0800
commitb33cb8b01df86ed635b372f9c171996b0432fa2e (patch)
tree4f7cc92d89f1576ae46d5962401f833db7e0c30c
parentcb73f581e5e8d33a681caf89dfb4bf76a77db370 (diff)
downloadibus-libpinyin-b33cb8b01df86ed635b372f9c171996b0432fa2e.tar.gz
ibus-libpinyin-b33cb8b01df86ed635b372f9c171996b0432fa2e.tar.xz
ibus-libpinyin-b33cb8b01df86ed635b372f9c171996b0432fa2e.zip
refine code style
-rw-r--r--src/PYConfig.h19
-rw-r--r--src/PYPConfig.cc23
2 files changed, 23 insertions, 19 deletions
diff --git a/src/PYConfig.h b/src/PYConfig.h
index 5c3f88a..89a5252 100644
--- a/src/PYConfig.h
+++ b/src/PYConfig.h
@@ -46,10 +46,6 @@ public:
guint orientation (void) const { return m_orientation; }
guint pageSize (void) const { return m_page_size; }
gboolean rememberEveryInput (void) const { return m_remember_every_input; }
- std::string mainSwitch (void) const { return m_main_switch; }
- std::string letterSwitch (void) const { return m_letter_switch; }
- std::string punctSwitch (void) const { return m_punct_switch; }
- std::string tradSwitch (void) const { return m_trad_switch; }
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; }
@@ -69,6 +65,11 @@ public:
gboolean auxiliarySelectKeyKP (void) const { return m_auxiliary_select_key_kp; }
gboolean enterKey (void) const { return m_enter_key; }
+ std::string mainSwitch (void) const { return m_main_switch; }
+ std::string letterSwitch (void) const { return m_letter_switch; }
+ std::string punctSwitch (void) const { return m_punct_switch; }
+ std::string tradSwitch (void) const { return m_trad_switch; }
+
protected:
bool read (const gchar * name, bool defval);
gint read (const gchar * name, gint defval);
@@ -96,10 +97,6 @@ protected:
guint m_page_size;
gboolean m_remember_every_input;
- std::string m_main_switch;
- std::string m_letter_switch;
- std::string m_punct_switch;
- std::string m_trad_switch;
gboolean m_shift_select_candidate;
gboolean m_minus_equal_page;
gboolean m_comma_period_page;
@@ -122,6 +119,12 @@ protected:
gboolean m_auxiliary_select_key_kp;
gboolean m_enter_key;
+
+ std::string m_main_switch;
+ std::string m_letter_switch;
+ std::string m_punct_switch;
+ std::string m_trad_switch;
+
};
diff --git a/src/PYPConfig.cc b/src/PYPConfig.cc
index 2449eb7..c9d2194 100644
--- a/src/PYPConfig.cc
+++ b/src/PYPConfig.cc
@@ -33,11 +33,6 @@ const gchar * const CONFIG_FUZZY_PINYIN = "FuzzyPinyin";
const gchar * const CONFIG_ORIENTATION = "LookupTableOrientation";
const gchar * const CONFIG_PAGE_SIZE = "LookupTablePageSize";
const gchar * const CONFIG_REMEMBER_EVERY_INPUT = "RememberEveryInput";
-/* const gchar * const CONFIG_CTRL_SWITCH = "CtrlSwitch"; */
-const gchar * const CONFIG_MAIN_SWITCH = "MainSwitch";
-const gchar * const CONFIG_LETTER_SWITCH = "LetterSwitch";
-const gchar * const CONFIG_PUNCT_SWITCH = "PunctSwitch";
-const gchar * const CONFIG_TRAD_SWITCH = "TradSwitch";
const gchar * const CONFIG_SHIFT_SELECT_CANDIDATE = "ShiftSelectCandidate";
const gchar * const CONFIG_MINUS_EQUAL_PAGE = "MinusEqualPage";
const gchar * const CONFIG_COMMA_PERIOD_PAGE = "CommaPeriodPage";
@@ -59,6 +54,11 @@ const gchar * const CONFIG_AUXILIARY_SELECT_KEY_KP = "AuxiliarySelectKey_KP";
const gchar * const CONFIG_ENTER_KEY = "EnterKey";
const gchar * const CONFIG_IMPORT_DICTIONARY = "ImportDictionary";
const gchar * const CONFIG_CLEAR_USER_DATA = "ClearUserData";
+/* const gchar * const CONFIG_CTRL_SWITCH = "CtrlSwitch"; */
+const gchar * const CONFIG_MAIN_SWITCH = "MainSwitch";
+const gchar * const CONFIG_LETTER_SWITCH = "LetterSwitch";
+const gchar * const CONFIG_PUNCT_SWITCH = "PunctSwitch";
+const gchar * const CONFIG_TRAD_SWITCH = "TradSwitch";
const pinyin_option_t PINYIN_DEFAULT_OPTION =
PINYIN_INCOMPLETE |
@@ -173,12 +173,13 @@ LibPinyinConfig::readDefaultValues (void)
}
m_remember_every_input = read (CONFIG_REMEMBER_EVERY_INPUT, false);
- m_main_switch = read(CONFIG_MAIN_SWITCH, std::string ("<Shift>"));
- m_letter_switch = read(CONFIG_LETTER_SWITCH, std::string (""));
- m_punct_switch = read(CONFIG_PUNCT_SWITCH, std::string ("<Control>period"));
- m_trad_switch = read(CONFIG_TRAD_SWITCH, std::string ("<Control><Shift>f"));
m_dictionaries = read (CONFIG_DICTIONARIES, std::string ("2"));
+ m_main_switch = read (CONFIG_MAIN_SWITCH, std::string ("<Shift>"));
+ m_letter_switch = read (CONFIG_LETTER_SWITCH, std::string (""));
+ m_punct_switch = read (CONFIG_PUNCT_SWITCH, std::string ("<Control>period"));
+ m_trad_switch = read (CONFIG_TRAD_SWITCH, std::string ("<Control><Shift>f"));
+
/* fuzzy pinyin */
if (read (CONFIG_FUZZY_PINYIN, false))
m_option_mask |= PINYIN_AMB_ALL;
@@ -223,6 +224,8 @@ LibPinyinConfig::valueChanged (const std::string &section,
}
} else if (CONFIG_REMEMBER_EVERY_INPUT == name) {
m_remember_every_input = normalizeGVariant (value, false);
+ } else if (CONFIG_DICTIONARIES == name) {
+ m_dictionaries = normalizeGVariant (value, std::string ("2"));
} else if (CONFIG_MAIN_SWITCH == name) {
m_main_switch = normalizeGVariant (value, std::string ("<Shift>"));
} else if (CONFIG_LETTER_SWITCH == name) {
@@ -231,8 +234,6 @@ LibPinyinConfig::valueChanged (const std::string &section,
m_punct_switch = normalizeGVariant (value, std::string ("<Control>period"));
} else if (CONFIG_TRAD_SWITCH == name) {
m_trad_switch = normalizeGVariant (value, std::string ("<Control><Shift>f"));
- } else if (CONFIG_DICTIONARIES == name) {
- m_dictionaries = normalizeGVariant (value, std::string ("2"));
}
/* fuzzy pinyin */
else if (CONFIG_FUZZY_PINYIN == name) {