diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-04-25 12:30:15 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-04-25 12:30:15 +0300 |
commit | 8ade9e707f81e11570ec8bac9d4b4157f829a2c6 (patch) | |
tree | 99fdc33862eb8bd909314d3f15b533778c332f1d /src/gui/setup_input.cpp | |
parent | 3d7be7b307d5ebf4171623a6628d66b82ed4e792 (diff) | |
download | manaplus-8ade9e707f81e11570ec8bac9d4b4157f829a2c6.tar.gz manaplus-8ade9e707f81e11570ec8bac9d4b4157f829a2c6.tar.bz2 manaplus-8ade9e707f81e11570ec8bac9d4b4157f829a2c6.tar.xz manaplus-8ade9e707f81e11570ec8bac9d4b4157f829a2c6.zip |
Fix actions translation.
Diffstat (limited to 'src/gui/setup_input.cpp')
-rw-r--r-- | src/gui/setup_input.cpp | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/src/gui/setup_input.cpp b/src/gui/setup_input.cpp index 48ec90124..b1054fac3 100644 --- a/src/gui/setup_input.cpp +++ b/src/gui/setup_input.cpp @@ -145,6 +145,8 @@ Setup_Input::Setup_Input(): k ++; } + fixTranslations(); + // Do the layout LayoutHelper h(this); ContainerPlacer place = h.getPlacer(0, 0); @@ -205,7 +207,6 @@ void Setup_Input::cancel() void Setup_Input::action(const gcn::ActionEvent &event) { - logger->log("event: %s", event.getId().c_str()); const std::string id = event.getId(); if (event.getSource() == mKeyList) @@ -360,3 +361,37 @@ void Setup_Input::keyUnresolved() inputManager.setNewKeyIndex(Input::KEY_NO_VALUE); } } + +void Setup_Input::fixTranslation(SetupActionData *actionDatas, int actionStart, + int actionEnd, std::string text) +{ + int k = 0; + + while (!actionDatas[k].name.empty()) + { + SetupActionData &data = actionDatas[k]; + + const int actionId = data.actionId; + if (actionId >= actionStart && actionId <= actionEnd) + { + data.name = strprintf(gettext(text.c_str()), + actionId - actionStart + 1); + } + k ++; + } +} + +void Setup_Input::fixTranslations() +{ + fixTranslation(setupActionData1, Input::KEY_SHORTCUT_1, + Input::KEY_SHORTCUT_20, "Item Shortcut %d"); + + fixTranslation(setupActionData3, Input::KEY_EMOTE_1, + Input::KEY_EMOTE_48, "Emote Shortcut %d"); + + fixTranslation(setupActionData4, Input::KEY_OUTFIT_1, + Input::KEY_OUTFIT_48, "Outfit Shortcut %d"); + + fixTranslation(setupActionData7, Input::KEY_MOVE_TO_POINT_1, + Input::KEY_MOVE_TO_POINT_48, "Move to point Shortcut %d"); +} |