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 QString Levelset::getName()
56 int Levelset::numberOfLevels()
58 return levels_.length();
61 Level Levelset::getLevel(int index)
64 return levels_.value(index); //Returns a default constructed Level if called with invalid index
68 int Levelset::getTotalHighScore()
71 settings.beginGroup(name_);
72 return settings.value("TotalHighScore",900*1000*100).toInt();
75 void Levelset::setTotalHighScore(int highscore)
79 settings.beginGroup(name_);
80 settings.setValue("TotalHighScore", highscore);
84 int Levelset::getLevelHighScore(int index)
87 QString group = name_;
88 group.append("/LevelHighScore");
89 settings.beginGroup(group);
93 return settings.value(QString(index),900*1000).toInt();
96 void Levelset::setLevelHighScore(int index, int highScore)
99 QString group = name_;
100 group.append("/LevelHighScore");
101 settings.beginGroup(group);
103 // qDebug() << group;
105 settings.setValue(QString(index),highScore);