From aefbc69aac9f7c793725153eefce2631555bfd1f Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Wed, 8 Apr 2009 00:44:12 +0200 Subject: Associated setup tab name with the tab itself Keeps things together in the right place and allowed writing a bit more generic code in the Setup class. --- src/gui/setup.cpp | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) (limited to 'src/gui/setup.cpp') diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index 7eb740b1..50068c6e 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -85,31 +85,19 @@ Setup::Setup(): TabbedArea *panel = new TabbedArea; panel->setDimension(gcn::Rectangle(5, 5, width - 10, height - 40)); - SetupTab *tab; - - tab = new Setup_Video(); - panel->addTab(_("Video"), tab); - mTabs.push_back(tab); - - tab = new Setup_Audio(); - panel->addTab(_("Audio"), tab); - mTabs.push_back(tab); - - tab = new Setup_Joystick(); - panel->addTab(_("Joystick"), tab); - mTabs.push_back(tab); - - tab = new Setup_Keyboard(); - panel->addTab(_("Keyboard"), tab); - mTabs.push_back(tab); - - tab = new Setup_Colors(); - panel->addTab(_("Colors"), tab); - mTabs.push_back(tab); - - tab = new Setup_Players(); - panel->addTab(_("Players"), tab); - mTabs.push_back(tab); + mTabs.push_back(new Setup_Video); + mTabs.push_back(new Setup_Audio); + mTabs.push_back(new Setup_Joystick); + mTabs.push_back(new Setup_Keyboard); + mTabs.push_back(new Setup_Colors); + mTabs.push_back(new Setup_Players); + + for (std::list::iterator i = mTabs.begin(), i_end = mTabs.end(); + i != i_end; ++i) + { + SetupTab *tab = *i; + panel->addTab(tab->getName(), tab); + } add(panel); -- cgit v1.2.3-70-g09d2