Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:aualin:kde
kdegames3
kdegames-trinity-fix-highscore.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File kdegames-trinity-fix-highscore.diff of Package kdegames3
commit 18b5622af48967838240687fc54ff937acaae903 Author: tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> Date: 1260832269 +0000 Fix high scores display git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1062508 283d02a7-25f6-0310-bc7c-ecb5cbfe19da diff --git a/katomic/gamewidget.cpp b/katomic/gamewidget.cpp index fc6838a..165e55c 100644 --- a/katomic/gamewidget.cpp +++ b/katomic/gamewidget.cpp @@ -116,6 +116,25 @@ void GameWidget::getMoves(int moves) ys->setText(current); } +void GameWidget::mergeHighScores(int l) +{ + KConfigGroup oldConfig(kapp->config(), QString("High Scores Level %1").arg(l).utf8()); + KConfigGroup newConfig(kapp->config(), QString("Highscores Level %1").arg(l).utf8()); + + newConfig.writeEntry("LastPlayer", oldConfig.readEntry("LastPlayer")); + + QString num; + for (int i = 1; i <= 10; ++i) + { + num.setNum(i); + QString key = "Pos" + num + "Name"; + newConfig.writeEntry(key, oldConfig.readEntry(key, "-")); + key = "Pos" + num + "Score"; + newConfig.writeEntry(key, oldConfig.readEntry(key, "-")); + } + kapp->config()->sync(); +} + void GameWidget::updateLevel (int l) { level=l; @@ -128,7 +147,11 @@ void GameWidget::updateLevel (int l) cfg.setGroup("Level"); feld->load(cfg); - highScore->setConfigGroup(QString("High Scores Level %1").arg(level)); + if (!kapp->config()->hasGroup(QString("Highscores Level %1").arg(level)) && + kapp->config()->hasGroup(QString("High Scores Level %1").arg(level))) + mergeHighScores(level); + + highScore->setConfigGroup(QString("Highscores Level %1").arg(level)); highest.setNum(highScore->highScore()); if (highest != "0" ) hs->setText(highest); diff --git a/katomic/gamewidget.h b/katomic/gamewidget.h index 6259e6b..00e9537 100644 --- a/katomic/gamewidget.h +++ b/katomic/gamewidget.h @@ -28,6 +28,9 @@ class GameWidget : public QWidget // bringt level auf neuesten stand void updateLevel (int); + // copy highscores from "High Scores" key to "Highscores" key + void mergeHighScores(int l); + // restart current level void restartLevel();
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor