diff options
-rw-r--r-- | src/game.cpp | 9 | ||||
-rw-r--r-- | src/gui/windowmanager.cpp | 21 | ||||
-rw-r--r-- | src/gui/windows/chatwindow.cpp | 8 | ||||
-rw-r--r-- | src/gui/windows/chatwindow.h | 2 | ||||
-rw-r--r-- | src/input/inputactionmap.h | 4 |
5 files changed, 37 insertions, 7 deletions
diff --git a/src/game.cpp b/src/game.cpp index 21701e02d..54c1581d1 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -199,7 +199,14 @@ static void createGuiWindows() // Create dialogs CREATEWIDGETV0(emoteWindow, EmoteWindow); - CREATEWIDGETV0(chatWindow, ChatWindow); + delete2(debugChatTab) + if (chatWindow) + { + chatWindow->scheduleDelete(); + chatWindow = nullptr; + } + CREATEWIDGETV(chatWindow, ChatWindow, + "Chat"); CREATEWIDGETV0(tradeWindow, TradeWindow); CREATEWIDGETV(equipmentWindow, EquipmentWindow, PlayerInfo::getEquipment(), diff --git a/src/gui/windowmanager.cpp b/src/gui/windowmanager.cpp index 3a95dd712..4c414899f 100644 --- a/src/gui/windowmanager.cpp +++ b/src/gui/windowmanager.cpp @@ -48,9 +48,14 @@ #include "gui/popups/spellpopup.h" #include "gui/popups/textboxpopup.h" +#include "gui/windows/chatwindow.h" #include "gui/windows/didyouknowwindow.h" #include "gui/windows/helpwindow.h" #include "gui/windows/setupwindow.h" + +#include "gui/widgets/tabs/chat/chattab.h" + +#include "utils/gettext.h" #endif // DYECMD #include "gui/widgets/createwidget.h" @@ -123,6 +128,19 @@ void WindowManager::createWindows() CREATEWIDGETV0(itemPopup, ItemPopup); CREATEWIDGETV0(spellPopup, SpellPopup); CREATEWIDGETV0(skillPopup, SkillPopup); + delete2(debugChatTab); + if (chatWindow) + { + chatWindow->scheduleDelete(); + chatWindow = nullptr; + } + CREATEWIDGETV(chatWindow, ChatWindow, + "DebugChat"); + // TRANSLATORS: chat tab header + debugChatTab = new ChatTab(chatWindow, _("Debug"), "", + "#Debug", ChatTabType::DEBUG); + debugChatTab->setAllowHighlight(false); + chatWindow->setVisible(Visible_false); #endif // DYECMD CREATEWIDGETV0(textPopup, TextPopup); @@ -143,6 +161,9 @@ void WindowManager::deleteWindows() delete2(userPalette); delete2(spellManager) delete2(spellShortcut) + + delete2(debugChatTab); + delete2(chatWindow); #endif // DYECMD delete2(textPopup); diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index eea0905cf..279d1c712 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -89,7 +89,7 @@ ChatWindow *chatWindow = nullptr; static const char *const ACTION_COLOR_PICKER = "color picker"; -ChatWindow::ChatWindow() : +ChatWindow::ChatWindow(const std::string &name) : // TRANSLATORS: chat window name Window(_("Chat"), Modal_false, nullptr, "chat.xml"), ActionListener(), @@ -127,7 +127,7 @@ ChatWindow::ChatWindow() : mEnableTradeFilter(config.getBoolValue("enableTradeFilter")), mTmpVisible(false) { - setWindowName("Chat"); + setWindowName(name); if (setupWindow != nullptr) setupWindow->registerWindowForReset(this); @@ -669,7 +669,9 @@ void ChatWindow::chatInput(const std::string &message) const } if (tab != nullptr) tab->chatInput(msg); - Game::instance()->setValidSpeed(); + Game *const game = Game::instance(); + if (game) + game->setValidSpeed(); } void ChatWindow::localChatInput(const std::string &msg) const diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h index 3191c4072..2961af9a1 100644 --- a/src/gui/windows/chatwindow.h +++ b/src/gui/windows/chatwindow.h @@ -64,7 +64,7 @@ class ChatWindow final : public Window, /** * Constructor. */ - ChatWindow(); + ChatWindow(const std::string &name); A_DELETE_COPY(ChatWindow) diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index a87c0cada..cfe709674 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -582,7 +582,7 @@ static const InputActionData inputActionData Input::GRP_DEFAULT | Input::GRP_GUI, &Actions::chatWindowShow, InputAction::NO_VALUE, 50, - InputCondition::GAME | InputCondition::NOTARGET, + InputCondition::SHORTCUT0, "openchat", UseArgs_false, Protected_false}, @@ -2234,7 +2234,7 @@ static const InputActionData inputActionData &Actions::toggleChat, InputAction::NO_VALUE, 50, InputCondition::NOINPUT | InputCondition::NOAWAY - | InputCondition::NOMODAL | InputCondition::INGAME, + | InputCondition::NOMODAL, "chat", UseArgs_false, Protected_false}, |