Merged changes from branches/supertux-milestone2-grumbel/ to trunk/supertux/
[supertux.git] / src / supertux / profile_menu.cpp
1 //  SuperTux
2 //  Copyright (C) 2008 Ingo Ruhnke <grumbel@gmx.de>
3 //
4 //  This program is free software: you can redistribute it and/or modify
5 //  it under the terms of the GNU General Public License as published by
6 //  the Free Software Foundation, either version 3 of the License, or
7 //  (at your option) any later version.
8 //
9 //  This program is distributed in the hope that it will be useful,
10 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 //  GNU General Public License for more details.
13 //
14 //  You should have received a copy of the GNU General Public License
15 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 #include "gui/menu.hpp"
18 #include "supertux/gameconfig.hpp"
19 #include "util/gettext.hpp"
20
21 enum ProfileMenuIDs {
22   
23 };
24
25 class ProfileMenu : public Menu
26 {
27 public:
28   ProfileMenu() {
29     add_label(_("Select Profile"));
30     add_hl();
31     for(int i = 0; i < 5; ++i)
32     {
33       std::ostringstream out;
34       out << "Profile " << i+1;
35       add_entry(i+1, out.str());
36     }
37
38     add_hl();
39     add_back(_("Back"));
40   }
41
42   void menu_action(MenuItem* item) {
43     g_config->profile = item->id;
44     Menu::set_current(0);
45   }
46 };
47
48 Menu* profile_menu = 0;
49
50 Menu* get_profile_menu()
51 {
52   //static ProfileMenu menu;
53   profile_menu = new ProfileMenu();
54   return profile_menu;
55 }
56
57 void free_profile_menu()
58 {
59   delete profile_menu;
60   profile_menu = 0;
61 }
62
63 /*
64   std::string
65   TitleScreen::get_slotinfo(int slot)
66   {
67   std::string tmp;
68   std::string title;
69
70   std::string basename = current_world->get_basedir();
71   basename = basename.substr(0, basename.length()-1);
72   std::string worlddirname = FileSystem::basename(basename);
73   std::ostringstream stream;
74   stream << "profile" << config->profile << "/" << worlddirname << "_" << slot << ".stsg";
75   std::string slotfile = stream.str();
76
77   try {
78   lisp::Parser parser;
79   const lisp::Lisp* root = parser.parse(slotfile);
80
81   const lisp::Lisp* savegame = root->get_lisp("supertux-savegame");
82   if(!savegame)
83   throw std::runtime_error("file is not a supertux-savegame.");
84
85   savegame->get("title", title);
86   } catch(std::exception& ) {
87   std::ostringstream slottitle;
88   slottitle << _("Slot") << " " << slot << " - " << _("Free");
89   return slottitle.str();
90   }
91
92   std::ostringstream slottitle;
93   slottitle << _("Slot") << " " << slot << " - " << title;
94   return slottitle.str();
95   }
96 */
97
98 /* EOF */