Moved Menu stuff to its own directory
[supertux.git] / src / supertux / menu / 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 <sstream>
18
19 #include "gui/menu.hpp"
20 #include "gui/menu_item.hpp"
21 #include "supertux/gameconfig.hpp"
22 #include "util/gettext.hpp"
23
24 enum ProfileMenuIDs {
25   
26 };
27
28 class ProfileMenu : public Menu
29 {
30 public:
31   ProfileMenu() {
32     add_label(_("Select Profile"));
33     add_hl();
34     for(int i = 0; i < 5; ++i)
35     {
36       std::ostringstream out;
37       out << "Profile " << i+1;
38       add_entry(i+1, out.str());
39     }
40
41     add_hl();
42     add_back(_("Back"));
43   }
44
45   void menu_action(MenuItem* item) {
46     g_config->profile = item->id;
47     Menu::set_current(0);
48   }
49 };
50
51 Menu* profile_menu = 0;
52
53 Menu* get_profile_menu()
54 {
55   //static ProfileMenu menu;
56   profile_menu = new ProfileMenu();
57   return profile_menu;
58 }
59
60 void free_profile_menu()
61 {
62   delete profile_menu;
63   profile_menu = 0;
64 }
65
66 /*
67   std::string
68   TitleScreen::get_slotinfo(int slot)
69   {
70   std::string tmp;
71   std::string title;
72
73   std::string basename = current_world->get_basedir();
74   basename = basename.substr(0, basename.length()-1);
75   std::string worlddirname = FileSystem::basename(basename);
76   std::ostringstream stream;
77   stream << "profile" << config->profile << "/" << worlddirname << "_" << slot << ".stsg";
78   std::string slotfile = stream.str();
79
80   try {
81   lisp::Parser parser;
82   const lisp::Lisp* root = parser.parse(slotfile);
83
84   const lisp::Lisp* savegame = root->get_lisp("supertux-savegame");
85   if(!savegame)
86   throw std::runtime_error("file is not a supertux-savegame.");
87
88   savegame->get("title", title);
89   } catch(std::exception& ) {
90   std::ostringstream slottitle;
91   slottitle << _("Slot") << " " << slot << " - " << _("Free");
92   return slottitle.str();
93   }
94
95   std::ostringstream slottitle;
96   slottitle << _("Slot") << " " << slot << " - " << title;
97   return slottitle.str();
98   }
99 */
100
101 /* EOF */