From a02e2ba72702226cc25b245cc0e2615ead279cee Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 25 May 2017 19:47:29 +0300 Subject: Add chat command for clear current outfit. --- src/actions/commands.cpp | 9 +++++++++ src/actions/commands.h | 1 + src/dyetool/actions/commands.cpp | 1 + src/enums/input/inputaction.h | 1 + src/gui/popups/popupmenu.cpp | 7 +------ src/input/inputactionmap.h | 6 ++++++ src/input/pages/outfits.cpp | 6 ++++++ 7 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index 71dd2e7b4..ae50680fb 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -1895,6 +1895,15 @@ impHandler0(outfitToChat) return true; } +impHandler0(outfitClear) +{ + if (!outfitWindow) + return false; + + outfitWindow->clearCurrentOutfit(); + return true; +} + impHandler(moveAttackUp) { if (!actorManager) diff --git a/src/actions/commands.h b/src/actions/commands.h index 6c2c6cc9d..0b6f0cf30 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -153,6 +153,7 @@ namespace Actions decHandler(partyExpShare); decHandler(partyAutoItemShare); decHandler(outfitToChat); + decHandler(outfitClear); decHandler(moveAttackUp); decHandler(moveAttackDown); decHandler(movePriorityAttackUp); diff --git a/src/dyetool/actions/commands.cpp b/src/dyetool/actions/commands.cpp index 956c5e0ed..a8e882a8c 100644 --- a/src/dyetool/actions/commands.cpp +++ b/src/dyetool/actions/commands.cpp @@ -153,6 +153,7 @@ impHandlerVoid(partyItemShare) impHandlerVoid(partyExpShare) impHandlerVoid(partyAutoItemShare) impHandlerVoid(outfitToChat) +impHandlerVoid(outfitClear) impHandlerVoid(moveAttackUp) impHandlerVoid(moveAttackDown) impHandlerVoid(movePriorityAttackUp) diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h index f838bf092..94b37066b 100644 --- a/src/enums/input/inputaction.h +++ b/src/enums/input/inputaction.h @@ -695,6 +695,7 @@ enumStart(InputAction) SHOW_ITEMS, COMMAND_SEND_MOUSE_KEY, COMMAND_SEND_CHARS, + CLEAR_OUTFIT, TOTAL } enumEnd(InputAction); diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 4218a1101..35c459953 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -792,7 +792,7 @@ void PopupMenu::showOutfitsWindowPopup(const int x, const int y) mBrowserBox->addRow("##3---"); // TRANSLATORS: popup menu item // TRANSLATORS: clear selected outfit - mBrowserBox->addRow("clear outfit", _("Clear outfit")); + mBrowserBox->addRow("/clearoutfit", _("Clear outfit")); mBrowserBox->addRow("##3---"); addWindowMenu(outfitWindow); @@ -1243,11 +1243,6 @@ void PopupMenu::handleLink(const std::string &link, showChangePos(getX(), getY()); return; } - else if (link == "clear outfit") - { - if (outfitWindow) - outfitWindow->clearCurrentOutfit(); - } else if (link == "clipboard copy") { if (mTextField) diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index b49b36904..a21cc42c1 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -5660,6 +5660,12 @@ static const InputActionData inputActionData "sendchar|sendchars|charsend", UseArgs_true, Protected_true}, + {"keyClearOutfit", + defaultAction(&Actions::outfitClear), + InputCondition::DEFAULT | InputCondition::INGAME, + "clearoutfit|outfitclear", + UseArgs_false, + Protected_true}, }; #undef defaultAction diff --git a/src/input/pages/outfits.cpp b/src/input/pages/outfits.cpp index 5a938217d..0b9beabd3 100644 --- a/src/input/pages/outfits.cpp +++ b/src/input/pages/outfits.cpp @@ -42,6 +42,12 @@ SetupActionData setupActionDataOutfits[] = InputAction::WEAR_OUTFIT, "", }, + { + // TRANSLATORS: input action name + N_("Clear outfit"), + InputAction::CLEAR_OUTFIT, + "", + }, { // TRANSLATORS: input action name N_("Copy Outfit to other outfit"), -- cgit v1.2.3-70-g09d2