X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fsupertux%2Foptions_menu.cpp;h=f77b3dd271b5ca8b66bbd1be798cbc38cc1e4fa2;hb=78ac7aef674f518549f96160c6354b589553f952;hp=355102baadfbada0c4f208fe2d0451c29a1b6230;hpb=3aa6936791cf24344e27d452ab2fd8c33fb5a2e8;p=supertux.git
diff --git a/src/supertux/options_menu.cpp b/src/supertux/options_menu.cpp
index 355102baa..f77b3dd27 100644
--- a/src/supertux/options_menu.cpp
+++ b/src/supertux/options_menu.cpp
@@ -15,12 +15,17 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+#include "supertux/options_menu.hpp"
+
#include "audio/sound_manager.hpp"
#include "control/joystickkeyboardcontroller.hpp"
#include "gui/menu.hpp"
+#include "gui/menu_item.hpp"
#include "supertux/gameconfig.hpp"
+#include "supertux/globals.hpp"
#include "supertux/main.hpp"
#include "supertux/profile_menu.hpp"
+#include "supertux/language_menu.hpp"
#include "util/gettext.hpp"
#include "video/renderer.hpp"
@@ -36,71 +41,6 @@ enum OptionsMenuIDs {
MNID_MUSIC
};
-class LanguageMenu : public Menu
-{
-public:
- LanguageMenu() {
- add_label(_("Language"));
- add_hl();
- add_entry(0, std::string("<")+_("auto-detect")+">");
- add_entry(1, "English");
-
- int mnid = 10;
- std::set languages = dictionary_manager.get_languages();
- for (std::set::iterator i = languages.begin(); i != languages.end(); i++) {
- std::string locale_name = *i;
- TinyGetText::LanguageDef ldef = TinyGetText::get_language_def(locale_name);
- std::string locale_fullname = locale_name;
- if (std::string(ldef.code) == locale_name) {
- locale_fullname = ldef.name;
- }
- add_entry(mnid++, locale_fullname);
- }
-
- add_hl();
- add_back(_("Back"));
- }
-
- virtual void menu_action(MenuItem* item) {
- if (item->id == 0) {
- g_config->locale = "";
- dictionary_manager.set_language(g_config->locale);
- g_config->save();
- Menu::pop_current();
- }
- else if (item->id == 1) {
- g_config->locale = "en";
- dictionary_manager.set_language(g_config->locale);
- g_config->save();
- Menu::pop_current();
- }
- int mnid = 10;
- std::set languages = dictionary_manager.get_languages();
- for (std::set::iterator i = languages.begin(); i != languages.end(); i++) {
- std::string locale_name = *i;
- if (item->id == mnid++) {
- g_config->locale = locale_name;
- dictionary_manager.set_language(g_config->locale);
- g_config->save();
- Menu::pop_current();
- }
- }
- }
-};
-
-class OptionsMenu : public Menu
-{
-public:
- OptionsMenu();
- virtual ~OptionsMenu();
-
- virtual void menu_action(MenuItem* item);
-
-protected:
- std::auto_ptr language_menu;
-
-};
-
OptionsMenu::OptionsMenu() :
language_menu()
{