Warning, file /games/kreversi/src/highscores.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 SPDX-FileCopyrightText: 2004 Nicolas HADACEK <hadacek@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "highscores.h" 0008 0009 #include <QDateTime> 0010 #include <QList> 0011 0012 #include <KLocalizedString> 0013 #include <KConfigGroup> 0014 #include <KConfig> 0015 #include <KGameDifficulty> 0016 0017 namespace KExtHighscore 0018 { 0019 0020 ExtManager::ExtManager() 0021 : Manager(7) 0022 { 0023 setShowMode(NeverShow); 0024 setShowStatistics(true); 0025 setShowDrawGamesStatistic(true); 0026 0027 const uint RANGE[6] = { 0, 32, 40, 48, 56, 64 }; 0028 QList<uint> s; 0029 s.resize(6); 0030 std::copy(RANGE, RANGE+6, s.begin()); 0031 setScoreHistogram(s, ScoreBound); 0032 0033 QList< const KGameDifficultyLevel * > diffList = KGameDifficulty::global()->levels(); 0034 0035 for (int i = 0; i < diffList.size(); i++) 0036 m_typeLabels << diffList.at(i)->title(); 0037 } 0038 0039 0040 QString ExtManager::gameTypeLabel(uint gameType, LabelType type) const 0041 { 0042 switch (type) { 0043 case Standard: 0044 return QString::number(gameType); 0045 case I18N: 0046 return m_typeLabels.at(gameType); 0047 case Icon: 0048 // FIXME dimsuz: implement 0049 break; 0050 case WW: 0051 break; 0052 } 0053 0054 return QString(); 0055 } 0056 0057 0058 // FIXME dimsuz: is this still needed? 0059 /* 0060 void ExtManager::convertLegacy(uint gameType) 0061 { 0062 // Since there is no information about the skill level 0063 // in the legacy highscore list, consider they are 0064 // for beginner skill ... 0065 if ( gameType!=0 ) 0066 return; 0067 0068 KConfigGroup cg(KSharedConfig::openConfig(), "High Score"); 0069 0070 for (uint i = 1; i <= 10; i++) { 0071 QString key = "Pos" + QString::number(i); 0072 QString name = cg.readEntry(key + "Name", QString()); 0073 0074 if ( name.isEmpty() ) 0075 name = i18n("anonymous"); 0076 0077 uint score = cg.readEntry(key + "NumChips", (uint)0); 0078 if ( score==0 ) 0079 continue; 0080 0081 QString sdate = cg.readEntry(key + "Date", QString()); 0082 QDateTime date = QDateTime::fromString(sdate); 0083 Score s(Won); 0084 0085 s.setScore(score); 0086 s.setData("name", name); 0087 if ( date.isValid() ) 0088 s.setData("date", date); 0089 submitLegacyScore(s); 0090 } 0091 } 0092 */ 0093 0094 0095 } // Namespace KExtHighscore