From ab165fef49f68f53e8baea8d7d71f73f81e9d2c5 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 19 Aug 2014 16:02:28 +0300 Subject: In inventory and help window use actions to open another windows. --- src/gui/windows/helpwindow.cpp | 11 +++-------- src/gui/windows/inventorywindow.cpp | 21 +++------------------ 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/src/gui/windows/helpwindow.cpp b/src/gui/windows/helpwindow.cpp index d1083b0a9..91e05bcdb 100644 --- a/src/gui/windows/helpwindow.cpp +++ b/src/gui/windows/helpwindow.cpp @@ -24,6 +24,8 @@ #include "configuration.h" +#include "input/inputmanager.h" + #include "gui/gui.h" #include "gui/windows/didyouknowwindow.h" @@ -97,14 +99,7 @@ HelpWindow::HelpWindow() : void HelpWindow::action(const ActionEvent &event) { if (event.getId() == "DYK") - { - if (didYouKnowWindow) - { - didYouKnowWindow->setVisible(!didYouKnowWindow->isWindowVisible()); - if (didYouKnowWindow->isWindowVisible()) - didYouKnowWindow->requestMoveToTop(); - } - } + inputManager.executeAction(InputAction::WINDOW_DIDYOUKNOW); } void HelpWindow::handleLink(const std::string &link, diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index 53e847af0..3865647e0 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -311,30 +311,15 @@ void InventoryWindow::action(const ActionEvent &event) const std::string &eventId = event.getId(); if (eventId == "outfit") { - if (outfitWindow) - { - outfitWindow->setVisible(!outfitWindow->isWindowVisible()); - if (outfitWindow->isWindowVisible()) - outfitWindow->requestMoveToTop(); - } + inputManager.executeAction(InputAction::WINDOW_OUTFIT); } else if (eventId == "shop") { - if (shopWindow) - { - shopWindow->setVisible(!shopWindow->isWindowVisible()); - if (shopWindow->isWindowVisible()) - shopWindow->requestMoveToTop(); - } + inputManager.executeAction(InputAction::WINDOW_SHOP); } else if (eventId == "equipment") { - if (equipmentWindow) - { - equipmentWindow->setVisible(!equipmentWindow->isWindowVisible()); - if (equipmentWindow->isWindowVisible()) - equipmentWindow->requestMoveToTop(); - } + inputManager.executeAction(InputAction::WINDOW_EQUIPMENT); } else if (eventId == "close") { -- cgit v1.2.3-70-g09d2