diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-01-09 14:16:53 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-01-09 14:16:53 +0300 |
commit | 46585d7c62a53bfaf5173aa4e67d64735af1d2ed (patch) | |
tree | 3ffa2902ee94455441dcc7fe4ae7b1e027e302e7 /src/gui/windows/setup.cpp | |
parent | b3ad7da111d1a21f14de39d84be97104a9666017 (diff) | |
download | manaverse-46585d7c62a53bfaf5173aa4e67d64735af1d2ed.tar.gz manaverse-46585d7c62a53bfaf5173aa4e67d64735af1d2ed.tar.bz2 manaverse-46585d7c62a53bfaf5173aa4e67d64735af1d2ed.tar.xz manaverse-46585d7c62a53bfaf5173aa4e67d64735af1d2ed.zip |
add ability to notify setup pages about disconnect from server.
Show mods page only if connected to server.
Diffstat (limited to 'src/gui/windows/setup.cpp')
-rw-r--r-- | src/gui/windows/setup.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/gui/windows/setup.cpp b/src/gui/windows/setup.cpp index cd6e62882..5ba27f23c 100644 --- a/src/gui/windows/setup.cpp +++ b/src/gui/windows/setup.cpp @@ -59,6 +59,7 @@ Setup::Setup() : Window(_("Setup"), false, nullptr, "setup.xml"), gcn::ActionListener(), mTabs(), + mModsTab(nullptr), mWindowsToReset(), mButtons(), mResetWindows(nullptr), @@ -125,7 +126,6 @@ void Setup::postInit() 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_Mods(this)); mTabs.push_back(new Setup_Other(this)); FOR_EACH (std::list<SetupTab*>::const_iterator, i, mTabs) @@ -203,6 +203,9 @@ void Setup::setInGame(const bool inGame) void Setup::externalUpdate() { + mModsTab = new Setup_Mods(this); + mTabs.push_back(mModsTab); + mPanel->addTab(mModsTab->getName(), mModsTab); FOR_EACH (std::list<SetupTab*>::const_iterator, it, mTabs) { if (*it) @@ -210,6 +213,23 @@ void Setup::externalUpdate() } } +void Setup::externalUnload() +{ + FOR_EACH (std::list<SetupTab*>::const_iterator, it, mTabs) + { + if (*it) + (*it)->externalUnloaded(); + } + if (mModsTab) + { + mTabs.remove(mModsTab); + Tab *const tab = mPanel->getTab(mModsTab->getName()); + mPanel->removeTab(tab); + delete mModsTab; + mModsTab = nullptr; + } +} + void Setup::registerWindowForReset(Window *const window) { mWindowsToReset.push_back(window); |