2 * Copyright (c) 2004 Nicolas HADACEK (hadacek@kde.org)
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 2 of the License, or
7 * (at your option) any later version.
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.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #include "highscores.h"
27 #include <kconfiggroup.h>
30 namespace KExtHighscore
33 ExtManager::ExtManager()
36 setShowMode( NeverShow
);
37 setShowStatistics(true);
38 setShowDrawGamesStatistic(true);
40 const uint RANGE
[6] = { 0, 32, 40, 48, 56, 64 };
43 qCopy(RANGE
, RANGE
+ 6, s
.begin());
44 setScoreHistogram(s
, ScoreBound
);
46 // FIXME dimsuz: somehow rearrange the code to be sure that this and in mainwindow.cpp are
48 m_typeLabels
<< i18n("Very Easy") << i18n("Easy") << i18n("Normal");
49 m_typeLabels
<< i18n("Hard") << i18n("Very Hard") << i18n("Unbeatable") << i18n("Champion");
53 QString
ExtManager::gameTypeLabel(uint gameType
, LabelType type
) const
57 return QString::number(gameType
);
59 return m_typeLabels
.at(gameType
);
61 // FIXME dimsuz: implement
71 // FIXME dimsuz: is this still needed?
73 void ExtManager::convertLegacy(uint gameType)
75 // Since there is no information about the skill level
76 // in the legacy highscore list, consider they are
77 // for beginner skill ...
81 KConfigGroup cg(KGlobal::config(), "High Score");
83 for (uint i = 1; i <= 10; i++) {
84 QString key = "Pos" + QString::number(i);
85 QString name = cg.readEntry(key + "Name", QString());
88 name = i18n("anonymous");
90 uint score = cg.readEntry(key + "NumChips", (uint)0);
94 QString sdate = cg.readEntry(key + "Date", QString());
95 QDateTime date = QDateTime::fromString(sdate);
99 s.setData("name", name);
100 if ( date.isValid() )
101 s.setData("date", date);
102 submitLegacyScore(s);