1 /**************************************************************************
2 Ghosts Overboard - a game for 'Meego 1.2 Harmattan'
4 Copyright (C) 2011 Heli Hyvättinen
6 This file is part of Ghosts Overboard
8 Ghosts Overboard is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 **************************************************************************/
32 Levelset::Levelset(QString name, QList<Level> levelList)
40 bool Levelset::isValid()
45 if (levels_.isEmpty())
51 int Levelset::numberOfLevels()
53 return levels_.length();
56 Level Levelset::getLevel(int index)
59 return levels_.value(index); //Returns a default constructed Level if called with invalid index
63 int Levelset::getTotalHighScore()
66 settings.beginGroup(name_);
67 return settings.value("TotalHighScore",900*1000*100).toInt();
70 void Levelset::setTotalHighScore(int highscore)
74 settings.beginGroup(name_);
75 settings.setValue("TotalHighScore", highscore);
79 int Levelset::getLevelHighScore(int index)
82 QString group = name_;
83 group.append("/LevelHighScore");
84 settings.beginGroup(group);
88 return settings.value(QString(index),900*1000).toInt();
91 void Levelset::setLevelHighScore(int index, int highScore)
94 QString group = name_;
95 group.append("/LevelHighScore");
96 settings.beginGroup(group);
100 settings.setValue(QString(index),highScore);