From 8ad2fe11ef255b3443eb8b98d3eb40a54b04cbb4 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 4 Feb 2014 16:30:58 +0300 Subject: rename Setup into SetupWindow. --- src/gui/windows/chatwindow.cpp | 2 +- src/gui/windows/debugwindow.cpp | 2 +- src/gui/windows/didyouknowwindow.cpp | 2 +- src/gui/windows/equipmentwindow.cpp | 2 +- src/gui/windows/helpwindow.cpp | 2 +- src/gui/windows/inventorywindow.cpp | 2 +- src/gui/windows/minimap.cpp | 2 +- src/gui/windows/setup.cpp | 287 ----------------------------------- src/gui/windows/setup.h | 89 ----------- src/gui/windows/setupwindow.cpp | 287 +++++++++++++++++++++++++++++++++++ src/gui/windows/setupwindow.h | 90 +++++++++++ src/gui/windows/shortcutwindow.cpp | 2 +- src/gui/windows/skilldialog.cpp | 2 +- src/gui/windows/socialwindow.cpp | 2 +- src/gui/windows/statuswindow.cpp | 2 +- src/gui/windows/tradewindow.cpp | 2 +- 16 files changed, 389 insertions(+), 388 deletions(-) delete mode 100644 src/gui/windows/setup.cpp delete mode 100644 src/gui/windows/setup.h create mode 100644 src/gui/windows/setupwindow.cpp create mode 100644 src/gui/windows/setupwindow.h (limited to 'src/gui/windows') diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 955171bea..976a8dfd8 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -43,7 +43,7 @@ #include "gui/viewport.h" #include "gui/windows/emotewindow.h" -#include "gui/windows/setup.h" +#include "gui/windows/setupwindow.h" #include "gui/windows/whoisonline.h" #include "gui/widgets/tabs/battletab.h" diff --git a/src/gui/windows/debugwindow.cpp b/src/gui/windows/debugwindow.cpp index 02a79d0de..b4d14e404 100644 --- a/src/gui/windows/debugwindow.cpp +++ b/src/gui/windows/debugwindow.cpp @@ -31,7 +31,7 @@ #include "gui/viewport.h" -#include "gui/windows/setup.h" +#include "gui/windows/setupwindow.h" #include "gui/widgets/label.h" #include "gui/widgets/layout.h" diff --git a/src/gui/windows/didyouknowwindow.cpp b/src/gui/windows/didyouknowwindow.cpp index 37c970562..93166e6fa 100644 --- a/src/gui/windows/didyouknowwindow.cpp +++ b/src/gui/windows/didyouknowwindow.cpp @@ -26,7 +26,7 @@ #include "gui/sdlfont.h" -#include "gui/windows/setup.h" +#include "gui/windows/setupwindow.h" #include "gui/widgets/button.h" #include "gui/widgets/browserbox.h" diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp index dcc4c9d77..3b97e12d7 100644 --- a/src/gui/windows/equipmentwindow.cpp +++ b/src/gui/windows/equipmentwindow.cpp @@ -36,7 +36,7 @@ #include "gui/popups/itempopup.h" -#include "gui/windows/setup.h" +#include "gui/windows/setupwindow.h" #include "gui/widgets/button.h" #include "gui/widgets/playerbox.h" diff --git a/src/gui/windows/helpwindow.cpp b/src/gui/windows/helpwindow.cpp index 854ac8cbd..eb2300e0e 100644 --- a/src/gui/windows/helpwindow.cpp +++ b/src/gui/windows/helpwindow.cpp @@ -27,7 +27,7 @@ #include "gui/sdlfont.h" #include "gui/windows/didyouknowwindow.h" -#include "gui/windows/setup.h" +#include "gui/windows/setupwindow.h" #include "gui/widgets/button.h" #include "gui/widgets/browserbox.h" diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index 02b30aed7..6fd2ab95b 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -38,7 +38,7 @@ #include "gui/windows/equipmentwindow.h" #include "gui/windows/itemamountwindow.h" #include "gui/windows/outfitwindow.h" -#include "gui/windows/setup.h" +#include "gui/windows/setupwindow.h" #include "gui/windows/shopwindow.h" #include "gui/windows/tradewindow.h" diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp index 177be8a74..02be64a13 100644 --- a/src/gui/windows/minimap.cpp +++ b/src/gui/windows/minimap.cpp @@ -33,7 +33,7 @@ #include "gui/popups/textpopup.h" -#include "gui/windows/setup.h" +#include "gui/windows/setupwindow.h" #include "resources/image.h" #include "resources/imagehelper.h" diff --git a/src/gui/windows/setup.cpp b/src/gui/windows/setup.cpp deleted file mode 100644 index d0ecc2d6d..000000000 --- a/src/gui/windows/setup.cpp +++ /dev/null @@ -1,287 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2014 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "gui/windows/setup.h" - -#include "configuration.h" -#include "game.h" -#include "main.h" -#include "touchmanager.h" - -#include "gui/windows/chatwindow.h" - -#include "gui/widgets/tabs/setup_audio.h" -#include "gui/widgets/tabs/setup_chat.h" -#include "gui/widgets/tabs/setup_colors.h" -#include "gui/widgets/tabs/setup_input.h" -#include "gui/widgets/tabs/setup_joystick.h" -#include "gui/widgets/tabs/setup_mods.h" -#include "gui/widgets/tabs/setup_other.h" -#include "gui/widgets/tabs/setup_perfomance.h" -#include "gui/widgets/tabs/setup_players.h" -#include "gui/widgets/tabs/setup_relations.h" -#include "gui/widgets/tabs/setup_theme.h" -#include "gui/widgets/tabs/setup_touch.h" -#include "gui/widgets/tabs/setup_video.h" -#include "gui/widgets/tabs/setup_visual.h" - -#include "gui/widgets/label.h" - -#include "utils/dtor.h" -#include "utils/gettext.h" - -#include "debug.h" - -extern Window *statusWindow; -Setup *setupWindow = nullptr; - -Setup::Setup() : - // TRANSLATORS: setup window name - Window(_("Setup"), false, nullptr, "setup.xml"), - gcn::ActionListener(), - mTabs(), - mModsTab(nullptr), - mWindowsToReset(), - mButtons(), - mResetWindows(nullptr), - mPanel(new TabbedArea(this)), - mVersion(new Label(this, FULL_VERSION)) -{ - mPanel->postInit(); - setCloseButton(true); - setResizable(true); - setStickyButtonLock(true); -} - -void Setup::postInit() -{ - int width = 620; - const int height = 450; - - if (config.getIntValue("screenwidth") >= 730) - width += 100; - - setContentSize(width, height); - setMinWidth(310); - setMinHeight(210); - - static const char *buttonNames[] = - { - // TRANSLATORS: setup button - N_("Apply"), - // TRANSLATORS: setup button - N_("Cancel"), - // TRANSLATORS: setup button - N_("Store"), - // TRANSLATORS: setup button - N_("Reset Windows"), - nullptr - }; - int x = width; - const int buttonPadding = getOption("buttonPadding", 5); - for (const char ** curBtn = buttonNames; *curBtn; ++ curBtn) - { - Button *const btn = new Button(this, gettext(*curBtn), *curBtn, this); - mButtons.push_back(btn); - x -= btn->getWidth() + buttonPadding; - btn->setPosition(x, height - btn->getHeight() - buttonPadding); - add(btn); - - // Store this button, as it needs to be enabled/disabled - if (!strcmp(*curBtn, "Reset Windows")) - mResetWindows = btn; - } - - mPanel->setDimension(gcn::Rectangle(5, 5, width - 10, height - 40)); - mPanel->enableScrollButtons(true); - - mTabs.push_back(new Setup_Video(this)); - mTabs.push_back(new Setup_Visual(this)); - mTabs.push_back(new Setup_Audio(this)); - mTabs.push_back(new Setup_Perfomance(this)); - mTabs.push_back(new Setup_Touch(this)); - mTabs.push_back(new Setup_Input(this)); - mTabs.push_back(new Setup_Joystick(this)); - mTabs.push_back(new Setup_Colors(this)); - mTabs.push_back(new Setup_Chat(this)); - mTabs.push_back(new Setup_Players(this)); - mTabs.push_back(new Setup_Relations(this)); - mTabs.push_back(new Setup_Theme(this)); - mTabs.push_back(new Setup_Other(this)); - - FOR_EACH (std::list::const_iterator, i, mTabs) - { - SetupTab *const tab = *i; - mPanel->addTab(tab->getName(), tab); - } - add(mPanel); - - if (mResetWindows) - { - mVersion->setPosition(9, - height - mVersion->getHeight() - mResetWindows->getHeight() - 9); - } - else - { - mVersion->setPosition(9, height - mVersion->getHeight() - 30); - } - add(mVersion); - - center(); - - widgetResized(gcn::Event(nullptr)); - setInGame(false); - enableVisibleSound(true); -} - -Setup::~Setup() -{ - delete_all(mTabs); - mButtons.clear(); -} - -void Setup::action(const gcn::ActionEvent &event) -{ - if (Game::instance()) - Game::instance()->resetAdjustLevel(); - const std::string &eventId = event.getId(); - - if (eventId == "Apply") - { - setVisible(false); - for_each(mTabs.begin(), mTabs.end(), std::mem_fun(&SetupTab::apply)); - } - else if (eventId == "Cancel") - { - doCancel(); - } - else if (eventId == "Store") - { - if (chatWindow) - chatWindow->saveState(); - config.write(); - serverConfig.write(); - } - else if (eventId == "Reset Windows") - { - // Bail out if this action happens to be activated before the windows - // are created (though it should be disabled then) - if (!statusWindow) - return; - - FOR_EACH (std::list::const_iterator, it, mWindowsToReset) - { - if (*it) - (*it)->resetToDefaultSize(); - } - } -} - -void Setup::setInGame(const bool inGame) -{ - mResetWindows->setEnabled(inGame); -} - -void Setup::externalUpdate() -{ - unloadModTab(); - mModsTab = new Setup_Mods(this); - mTabs.push_back(mModsTab); - mPanel->addTab(mModsTab->getName(), mModsTab); - FOR_EACH (std::list::const_iterator, it, mTabs) - { - if (*it) - (*it)->externalUpdated(); - } -} - -void Setup::unloadModTab() -{ - if (mModsTab) - { - mTabs.remove(mModsTab); - Tab *const tab = mPanel->getTab(mModsTab->getName()); - mPanel->removeTab(tab); - delete mModsTab; - mModsTab = nullptr; - } -} - -void Setup::externalUnload() -{ - FOR_EACH (std::list::const_iterator, it, mTabs) - { - if (*it) - (*it)->externalUnloaded(); - } - unloadModTab(); -} - -void Setup::registerWindowForReset(Window *const window) -{ - mWindowsToReset.push_back(window); -} - -void Setup::doCancel() -{ - setVisible(false); - for_each(mTabs.begin(), mTabs.end(), std::mem_fun(&SetupTab::cancel)); -} - -void Setup::activateTab(const std::string &name) -{ - std::string tmp = gettext(name.c_str()); - mPanel->setSelectedTabByName(tmp); -} - -void Setup::setVisible(bool visible) -{ - touchManager.setTempHide(visible); - Window::setVisible(visible); -} - -void Setup::widgetResized(const gcn::Event &event) -{ - Window::widgetResized(event); - - const gcn::Rectangle area = getChildrenArea(); - int x = area.width; - const int height = area.height; - const int width = area.width; - const int buttonPadding = getOption("buttonPadding", 5); - mPanel->setDimension(gcn::Rectangle(5, 5, width - 10, height - 40)); - FOR_EACH (std::vector::iterator, it, mButtons) - { - Button *const btn = *it; - x -= btn->getWidth() + buttonPadding; - btn->setPosition(x, height - btn->getHeight() - buttonPadding); - } - if (mResetWindows) - { - mVersion->setPosition(9, - height - mVersion->getHeight() - mResetWindows->getHeight() - 9); - } - else - { - mVersion->setPosition(9, height - mVersion->getHeight() - 30); - } -} diff --git a/src/gui/windows/setup.h b/src/gui/windows/setup.h deleted file mode 100644 index 4c9ab2fb7..000000000 --- a/src/gui/windows/setup.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2014 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef GUI_WINDOWS_SETUP_H -#define GUI_WINDOWS_SETUP_H - -#include "gui/widgets/tabbedarea.h" - -#include "gui/widgets/window.h" - -#include - -#include - -class Label; -class SetupTab; - -/** - * The setup dialog. Displays several tabs for configuring different aspects - * of the game. - * - * \ingroup GUI - */ -class Setup final : public Window, public gcn::ActionListener -{ - public: - Setup(); - - A_DELETE_COPY(Setup) - - ~Setup(); - - void postInit() override final; - - void action(const gcn::ActionEvent &event) override final; - - void setInGame(const bool inGame); - - void externalUpdate(); - - void externalUnload(); - - void registerWindowForReset(Window *const window); - - void clearWindowsForReset() - { mWindowsToReset.clear(); } - - void doCancel(); - - void activateTab(const std::string &name); - - void setVisible(bool visible) override final; - - void widgetResized(const gcn::Event &event) override final; - - private: - void unloadModTab(); - - std::list mTabs; - SetupTab *mModsTab; - std::list mWindowsToReset; - std::vector mButtons; - Button *mResetWindows; - TabbedArea *mPanel; - Label *mVersion; -}; - -extern Setup* setupWindow; - -#endif // GUI_WINDOWS_SETUP_H diff --git a/src/gui/windows/setupwindow.cpp b/src/gui/windows/setupwindow.cpp new file mode 100644 index 000000000..e17b8f432 --- /dev/null +++ b/src/gui/windows/setupwindow.cpp @@ -0,0 +1,287 @@ +/* + * The ManaPlus Client + * Copyright (C) 2004-2009 The Mana World Development Team + * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2011-2014 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "gui/windows/setupwindow.h" + +#include "configuration.h" +#include "game.h" +#include "main.h" +#include "touchmanager.h" + +#include "gui/windows/chatwindow.h" + +#include "gui/widgets/tabs/setup_audio.h" +#include "gui/widgets/tabs/setup_chat.h" +#include "gui/widgets/tabs/setup_colors.h" +#include "gui/widgets/tabs/setup_input.h" +#include "gui/widgets/tabs/setup_joystick.h" +#include "gui/widgets/tabs/setup_mods.h" +#include "gui/widgets/tabs/setup_other.h" +#include "gui/widgets/tabs/setup_perfomance.h" +#include "gui/widgets/tabs/setup_players.h" +#include "gui/widgets/tabs/setup_relations.h" +#include "gui/widgets/tabs/setup_theme.h" +#include "gui/widgets/tabs/setup_touch.h" +#include "gui/widgets/tabs/setup_video.h" +#include "gui/widgets/tabs/setup_visual.h" + +#include "gui/widgets/label.h" + +#include "utils/dtor.h" +#include "utils/gettext.h" + +#include "debug.h" + +extern Window *statusWindow; +SetupWindow *setupWindow = nullptr; + +SetupWindow::SetupWindow() : + // TRANSLATORS: setup window name + Window(_("Setup"), false, nullptr, "setup.xml"), + gcn::ActionListener(), + mTabs(), + mModsTab(nullptr), + mWindowsToReset(), + mButtons(), + mResetWindows(nullptr), + mPanel(new TabbedArea(this)), + mVersion(new Label(this, FULL_VERSION)) +{ + mPanel->postInit(); + setCloseButton(true); + setResizable(true); + setStickyButtonLock(true); +} + +void SetupWindow::postInit() +{ + int width = 620; + const int height = 450; + + if (config.getIntValue("screenwidth") >= 730) + width += 100; + + setContentSize(width, height); + setMinWidth(310); + setMinHeight(210); + + static const char *buttonNames[] = + { + // TRANSLATORS: setup button + N_("Apply"), + // TRANSLATORS: setup button + N_("Cancel"), + // TRANSLATORS: setup button + N_("Store"), + // TRANSLATORS: setup button + N_("Reset Windows"), + nullptr + }; + int x = width; + const int buttonPadding = getOption("buttonPadding", 5); + for (const char ** curBtn = buttonNames; *curBtn; ++ curBtn) + { + Button *const btn = new Button(this, gettext(*curBtn), *curBtn, this); + mButtons.push_back(btn); + x -= btn->getWidth() + buttonPadding; + btn->setPosition(x, height - btn->getHeight() - buttonPadding); + add(btn); + + // Store this button, as it needs to be enabled/disabled + if (!strcmp(*curBtn, "Reset Windows")) + mResetWindows = btn; + } + + mPanel->setDimension(gcn::Rectangle(5, 5, width - 10, height - 40)); + mPanel->enableScrollButtons(true); + + mTabs.push_back(new Setup_Video(this)); + mTabs.push_back(new Setup_Visual(this)); + mTabs.push_back(new Setup_Audio(this)); + mTabs.push_back(new Setup_Perfomance(this)); + mTabs.push_back(new Setup_Touch(this)); + mTabs.push_back(new Setup_Input(this)); + mTabs.push_back(new Setup_Joystick(this)); + mTabs.push_back(new Setup_Colors(this)); + mTabs.push_back(new Setup_Chat(this)); + mTabs.push_back(new Setup_Players(this)); + mTabs.push_back(new Setup_Relations(this)); + mTabs.push_back(new Setup_Theme(this)); + mTabs.push_back(new Setup_Other(this)); + + FOR_EACH (std::list::const_iterator, i, mTabs) + { + SetupTab *const tab = *i; + mPanel->addTab(tab->getName(), tab); + } + add(mPanel); + + if (mResetWindows) + { + mVersion->setPosition(9, + height - mVersion->getHeight() - mResetWindows->getHeight() - 9); + } + else + { + mVersion->setPosition(9, height - mVersion->getHeight() - 30); + } + add(mVersion); + + center(); + + widgetResized(gcn::Event(nullptr)); + setInGame(false); + enableVisibleSound(true); +} + +SetupWindow::~SetupWindow() +{ + delete_all(mTabs); + mButtons.clear(); +} + +void SetupWindow::action(const gcn::ActionEvent &event) +{ + if (Game::instance()) + Game::instance()->resetAdjustLevel(); + const std::string &eventId = event.getId(); + + if (eventId == "Apply") + { + setVisible(false); + for_each(mTabs.begin(), mTabs.end(), std::mem_fun(&SetupTab::apply)); + } + else if (eventId == "Cancel") + { + doCancel(); + } + else if (eventId == "Store") + { + if (chatWindow) + chatWindow->saveState(); + config.write(); + serverConfig.write(); + } + else if (eventId == "Reset Windows") + { + // Bail out if this action happens to be activated before the windows + // are created (though it should be disabled then) + if (!statusWindow) + return; + + FOR_EACH (std::list::const_iterator, it, mWindowsToReset) + { + if (*it) + (*it)->resetToDefaultSize(); + } + } +} + +void SetupWindow::setInGame(const bool inGame) +{ + mResetWindows->setEnabled(inGame); +} + +void SetupWindow::externalUpdate() +{ + unloadModTab(); + mModsTab = new Setup_Mods(this); + mTabs.push_back(mModsTab); + mPanel->addTab(mModsTab->getName(), mModsTab); + FOR_EACH (std::list::const_iterator, it, mTabs) + { + if (*it) + (*it)->externalUpdated(); + } +} + +void SetupWindow::unloadModTab() +{ + if (mModsTab) + { + mTabs.remove(mModsTab); + Tab *const tab = mPanel->getTab(mModsTab->getName()); + mPanel->removeTab(tab); + delete mModsTab; + mModsTab = nullptr; + } +} + +void SetupWindow::externalUnload() +{ + FOR_EACH (std::list::const_iterator, it, mTabs) + { + if (*it) + (*it)->externalUnloaded(); + } + unloadModTab(); +} + +void SetupWindow::registerWindowForReset(Window *const window) +{ + mWindowsToReset.push_back(window); +} + +void SetupWindow::doCancel() +{ + setVisible(false); + for_each(mTabs.begin(), mTabs.end(), std::mem_fun(&SetupTab::cancel)); +} + +void SetupWindow::activateTab(const std::string &name) +{ + std::string tmp = gettext(name.c_str()); + mPanel->setSelectedTabByName(tmp); +} + +void SetupWindow::setVisible(bool visible) +{ + touchManager.setTempHide(visible); + Window::setVisible(visible); +} + +void SetupWindow::widgetResized(const gcn::Event &event) +{ + Window::widgetResized(event); + + const gcn::Rectangle area = getChildrenArea(); + int x = area.width; + const int height = area.height; + const int width = area.width; + const int buttonPadding = getOption("buttonPadding", 5); + mPanel->setDimension(gcn::Rectangle(5, 5, width - 10, height - 40)); + FOR_EACH (std::vector::iterator, it, mButtons) + { + Button *const btn = *it; + x -= btn->getWidth() + buttonPadding; + btn->setPosition(x, height - btn->getHeight() - buttonPadding); + } + if (mResetWindows) + { + mVersion->setPosition(9, + height - mVersion->getHeight() - mResetWindows->getHeight() - 9); + } + else + { + mVersion->setPosition(9, height - mVersion->getHeight() - 30); + } +} diff --git a/src/gui/windows/setupwindow.h b/src/gui/windows/setupwindow.h new file mode 100644 index 000000000..65dcf23e5 --- /dev/null +++ b/src/gui/windows/setupwindow.h @@ -0,0 +1,90 @@ +/* + * The ManaPlus Client + * Copyright (C) 2004-2009 The Mana World Development Team + * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2011-2014 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef GUI_WINDOWS_SETUP_H +#define GUI_WINDOWS_SETUP_H + +#include "gui/widgets/tabbedarea.h" + +#include "gui/widgets/window.h" + +#include + +#include + +class Label; +class SetupTab; + +/** + * The setup dialog. Displays several tabs for configuring different aspects + * of the game. + * + * \ingroup GUI + */ +class SetupWindow final : public Window, + public gcn::ActionListener +{ + public: + SetupWindow(); + + A_DELETE_COPY(SetupWindow) + + ~SetupWindow(); + + void postInit() override final; + + void action(const gcn::ActionEvent &event) override final; + + void setInGame(const bool inGame); + + void externalUpdate(); + + void externalUnload(); + + void registerWindowForReset(Window *const window); + + void clearWindowsForReset() + { mWindowsToReset.clear(); } + + void doCancel(); + + void activateTab(const std::string &name); + + void setVisible(bool visible) override final; + + void widgetResized(const gcn::Event &event) override final; + + private: + void unloadModTab(); + + std::list mTabs; + SetupTab *mModsTab; + std::list mWindowsToReset; + std::vector mButtons; + Button *mResetWindows; + TabbedArea *mPanel; + Label *mVersion; +}; + +extern SetupWindow* setupWindow; + +#endif // GUI_WINDOWS_SETUP_H diff --git a/src/gui/windows/shortcutwindow.cpp b/src/gui/windows/shortcutwindow.cpp index 5cf2ad7df..6a7a176a2 100644 --- a/src/gui/windows/shortcutwindow.cpp +++ b/src/gui/windows/shortcutwindow.cpp @@ -22,7 +22,7 @@ #include "gui/windows/shortcutwindow.h" -#include "gui/windows/setup.h" +#include "gui/windows/setupwindow.h" #include "gui/widgets/layout.h" #include "gui/widgets/scrollarea.h" diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index 197c60a90..04baad26a 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -33,7 +33,7 @@ #include "gui/popups/textpopup.h" -#include "gui/windows/setup.h" +#include "gui/windows/setupwindow.h" #include "gui/windows/shortcutwindow.h" #include "gui/widgets/button.h" diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp index ec7fce182..8e5f4c312 100644 --- a/src/gui/windows/socialwindow.cpp +++ b/src/gui/windows/socialwindow.cpp @@ -35,7 +35,7 @@ #include "gui/windows/confirmdialog.h" #include "gui/windows/okdialog.h" -#include "gui/windows/setup.h" +#include "gui/windows/setupwindow.h" #include "gui/windows/textdialog.h" #include "gui/windows/whoisonline.h" diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp index 8d78447a7..62c5c38ba 100644 --- a/src/gui/windows/statuswindow.cpp +++ b/src/gui/windows/statuswindow.cpp @@ -36,7 +36,7 @@ #include "gui/viewport.h" #include "gui/windows/equipmentwindow.h" -#include "gui/windows/setup.h" +#include "gui/windows/setupwindow.h" #include "gui/widgets/button.h" #include "gui/widgets/label.h" diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp index dfdc53a5c..a379f0f28 100644 --- a/src/gui/windows/tradewindow.cpp +++ b/src/gui/windows/tradewindow.cpp @@ -35,7 +35,7 @@ #include "gui/windows/inventorywindow.h" #include "gui/windows/itemamountwindow.h" -#include "gui/windows/setup.h" +#include "gui/windows/setupwindow.h" #include "gui/widgets/button.h" #include "gui/widgets/itemcontainer.h" -- cgit v1.2.3-60-g2f50