|
18 | 18 | extern "C" { |
19 | 19 | #include <cskk/libcskk.h> |
20 | 20 | } |
| 21 | +#include "log.h" |
21 | 22 | #include <fcitx-config/configuration.h> |
22 | 23 | #include <fcitx-config/enum.h> |
23 | 24 | #include <fcitx-utils/i18n.h> |
@@ -67,8 +68,23 @@ struct InputModeAnnotation : public EnumAnnotation { |
67 | 68 | } |
68 | 69 | }; |
69 | 70 |
|
| 71 | +struct FcitxCskkRuleAnnotation : public EnumAnnotation { |
| 72 | + void dumpDescription(RawConfig &config) const { |
| 73 | + EnumAnnotation::dumpDescription(config); |
| 74 | + uint length; |
| 75 | + auto rules = skk_get_rules(&length); |
| 76 | + for (uint i = 0; i < length; i++) { |
| 77 | + config.setValueByPath("Enum/" + std::to_string(i), rules[i].id); |
| 78 | + config.setValueByPath("EnumI18n/" + std::to_string(i), rules[i].name); |
| 79 | + } |
| 80 | + skk_free_rules(rules, length); |
| 81 | + } |
| 82 | +}; |
| 83 | + |
70 | 84 | FCITX_CONFIGURATION( |
71 | 85 | FcitxCskkConfig, |
| 86 | + OptionWithAnnotation<std::string, FcitxCskkRuleAnnotation> cskkRule{ |
| 87 | + this, "Rule", _("Rule"), "default"}; |
72 | 88 | OptionWithAnnotation<InputMode, InputModeAnnotation> inputMode{ |
73 | 89 | this, "InitialInputMode", _("InitialInputMode"), Hiragana}; |
74 | 90 | OptionWithAnnotation<PeriodStyle, PeriodStyleI18NAnnotation> periodStyle{ |
@@ -118,7 +134,7 @@ FCITX_CONFIGURATION( |
118 | 134 | CandidateSelectionKeys::Number}; |
119 | 135 | // Option<bool> showAnnotation{this, "ShowAnnotation", |
120 | 136 | // _("Show Annotation. Fake yet."), true};); |
121 | | -); |
| 137 | + ) // FCITX_CONFIGURATION |
122 | 138 | } // namespace fcitx |
123 | 139 |
|
124 | 140 | #endif // FCITX5_CSKK_CSKKCONFIG_H |
0 commit comments