Skip to content
9 changes: 9 additions & 0 deletions data/icons/scalable/apps/fcitx-lotus-default.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions data/icons/scalable/apps/fcitx-lotus-emoji-default.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 12 additions & 12 deletions data/icons/scalable/apps/fcitx-lotus-emoji.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions data/icons/scalable/apps/fcitx-lotus-off-default.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 23 additions & 24 deletions data/icons/scalable/apps/fcitx-lotus-off.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 32 additions & 27 deletions data/icons/scalable/apps/fcitx-lotus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions src/lotus-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,11 @@ namespace fcitx {
OptionWithAnnotation<std::string, StringListAnnotation> outputCharset{this, "OutputCharset", _("Output Charset"), "Unicode", {}, {}, StringListAnnotation()};
Option<bool> spellCheck{this, "SpellCheck", _("Enable spell check"), true}; Option<bool> macro{this, "Macro", _("Enable Macro"), true};
Option<bool> capitalizeMacro{this, "CapitalizeMacro", _("Capitalize Macro"), true};
Option<bool> autoNonVnRestore{this, "AutoNonVnRestore", _("Auto restore keys with invalid words"), true};
Option<bool> modernStyle{this, "ModernStyle", _("Use oà, _uý (instead of òa, úy)"), true};
Option<bool> freeMarking{this, "FreeMarking", _("Allow type with more freedom"), true};
Option<bool> fixUinputWithAck{this, "FixUinputWithAck", _("Fix uinput mode with ack"), false};
Option<bool> modeMenu{this, "ModeMenu", _("Open typing mode menu with ` key"), true};
Option<bool> autoNonVnRestore{this, "AutoNonVnRestore", _("Auto restore keys with invalid words"), true};
Option<bool> modernStyle{this, "ModernStyle", _("Use oà, _uý (instead of òa, úy)"), true};
Option<bool> freeMarking{this, "FreeMarking", _("Allow type with more freedom"), true};
Option<bool> fixUinputWithAck{this, "FixUinputWithAck", _("Fix uinput mode with ack"), false};
Option<bool> useLotusIcons{this, "UseLotusIcons", _("Use Lotus status icons"), false}; Option<bool> modeMenu{this, "ModeMenu", _("Open typing mode menu with ` key"), true};
SubConfigOption customKeymap{this, "CustomKeymap", _("Custom Keymap"), "fcitx://config/addon/lotus/custom_keymap"};);

} // namespace fcitx
Expand Down
30 changes: 29 additions & 1 deletion src/lotus-engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,17 @@ namespace fcitx {
}));
uiManager.registerAction("lotus-fixuinputwithack", fixUinputWithAckAction_.get());

lotusIconsAction_ = std::make_unique<SimpleAction>();
lotusIconsAction_->setLongText(_("Use Lotus status icons"));
lotusIconsAction_->setIcon("emblem-default");
lotusIconsAction_->setCheckable(true);
connections_.emplace_back(lotusIconsAction_->connect<SimpleAction::Activated>([this](InputContext* ic) {
config_.useLotusIcons.setValue(!*config_.useLotusIcons);
saveConfig();
refreshOption();
updateLotusIconsAction(ic);
}));
uiManager.registerAction("lotus-icons", lotusIconsAction_.get());
typingModeMenuAction_ = std::make_unique<SimpleAction>();
typingModeMenuAction_->setLongText(_("Open typing mode menu"));
typingModeMenuAction_->setIcon("input-keyboard");
Expand Down Expand Up @@ -340,6 +351,7 @@ namespace fcitx {
updateModernStyleAction(nullptr);
updateFreeMarkingAction(nullptr);
updateFixUinputWithAckAction(nullptr);
updateLotusIconsAction(nullptr);
updateTypingModeMenuAction(nullptr);
}

Expand Down Expand Up @@ -420,6 +432,7 @@ namespace fcitx {
statusArea.addAction(StatusGroup::InputMethod, modernStyleAction_.get());
statusArea.addAction(StatusGroup::InputMethod, freeMarkingAction_.get());
statusArea.addAction(StatusGroup::InputMethod, fixUinputWithAckAction_.get());
statusArea.addAction(StatusGroup::InputMethod, lotusIconsAction_.get());
statusArea.addAction(StatusGroup::InputMethod, typingModeMenuAction_.get());
}

Expand Down Expand Up @@ -744,6 +757,14 @@ namespace fcitx {
}
}

void LotusEngine::updateLotusIconsAction(InputContext* ic) {
lotusIconsAction_->setChecked(*config_.useLotusIcons);
lotusIconsAction_->setShortText(*config_.useLotusIcons ? _("Lotus Icons: On") : _("Lotus Icons: Off"));
if (ic) {
lotusIconsAction_->update(ic);
}
}

void LotusEngine::updateTypingModeMenuAction(InputContext* ic) {
typingModeMenuAction_->setChecked(*config_.modeMenu);
typingModeMenuAction_->setShortText(*config_.modeMenu ? _("Typing Mode Menu: On") : _("Typing Mode Menu: Off"));
Expand Down Expand Up @@ -875,10 +896,17 @@ namespace fcitx {
}

std::string LotusEngine::overrideIcon(const InputMethodEntry& /*entry*/) {
if (!*config_.useLotusIcons) {
switch (realMode) {
case LotusMode::Off: return "fcitx-lotus-off-default";
case LotusMode::Emoji: return "fcitx-lotus-emoji-default";
default: return "fcitx-lotus-default";
}
}
switch (realMode) {
case LotusMode::Off: return "fcitx-lotus-off";
case LotusMode::Emoji: return "fcitx-lotus-emoji";
default: return {};
default: return "fcitx-lotus";
}
}

Expand Down
7 changes: 7 additions & 0 deletions src/lotus-engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,12 @@ namespace fcitx {
*/
void updateFixUinputWithAckAction(InputContext* ic);

/**
* @brief Updates the Lotus icons toggle action UI.
* @param ic Current input context.
*/
void updateLotusIconsAction(InputContext* ic);

/**
* @brief Updates the mode-menu action UI.
* @param ic Current input context.
Expand Down Expand Up @@ -321,6 +327,7 @@ namespace fcitx {
std::unique_ptr<SimpleAction> modernStyleAction_;
std::unique_ptr<SimpleAction> freeMarkingAction_;
std::unique_ptr<SimpleAction> fixUinputWithAckAction_;
std::unique_ptr<SimpleAction> lotusIconsAction_;
std::unique_ptr<SimpleAction> typingModeMenuAction_;
std::vector<ScopedConnection> connections_;
CGoObject dictionary_;
Expand Down
Loading