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 **************************************************************************/
31 Levelset::Levelset(QString name, QList<Level> levelList)
39 bool Levelset::isValid()
44 if (levels_.isEmpty())
50 int Levelset::numberOfLevels()
52 return levels_.length();
55 Level Levelset::getLevel(int index)
58 return levels_.value(index); //Returns a default constructed Level if called with invalid index
62 int Levelset::getTotalHighScore()
65 settings.beginGroup(name_);
66 return settings.value("TotalHighScore",54000*10).toInt();
69 void Levelset::setTotalHighScore(int highscore)
73 settings.beginGroup(name_);
74 settings.setValue("TotalHighScore", highscore);
78 int Levelset::getLevelHighScore(int index)
81 QString group = name_.append("/LevelHighScore");
82 settings.beginGroup(group);
84 return settings.value(QString(index),54000).toInt();
87 void Levelset::setLevelHighScore(int index, int highScore)
90 QString group = name_.append("/LevelHighScore");
91 settings.beginGroup(group);
93 settings.setValue(QString(index),highScore);