~neon/kolf/master

« back to all changes in this revision

Viewing changes to game.cpp

  • Committer: Paul Broadbent
  • Date: 2007-02-21 16:56:45 UTC
  • Revision ID: git-v1:efe052a813b637d1d76e2e8f554980812626e167
KConfig ports

svn path=/trunk/KDE/kdegames/kolf/; revision=636003

Show diffs side-by-side

added added

removed removed

Lines of Context:
375
375
        }
376
376
}
377
377
 
378
 
void Bridge::load(KConfig *cfg)
 
378
void Bridge::load(KConfigGroup *cfgGroup)
379
379
{
380
 
        doLoad(cfg);
 
380
        doLoad(cfgGroup);
381
381
}
382
382
 
383
 
void Bridge::doLoad(KConfig *cfg)
 
383
void Bridge::doLoad(KConfigGroup *cfgGroup)
384
384
{
385
 
        newSize(cfg->readEntry("width", width()), cfg->readEntry("height", height()));
386
 
        setTopWallVisible(cfg->readEntry("topWallVisible", topWallVisible()));
387
 
        setBotWallVisible(cfg->readEntry("botWallVisible", botWallVisible()));
388
 
        setLeftWallVisible(cfg->readEntry("leftWallVisible", leftWallVisible()));
389
 
        setRightWallVisible(cfg->readEntry("rightWallVisible", rightWallVisible()));
 
385
        newSize(cfgGroup->readEntry("width", width()), cfgGroup->readEntry("height", height()));
 
386
        setTopWallVisible(cfgGroup->readEntry("topWallVisible", topWallVisible()));
 
387
        setBotWallVisible(cfgGroup->readEntry("botWallVisible", botWallVisible()));
 
388
        setLeftWallVisible(cfgGroup->readEntry("leftWallVisible", leftWallVisible()));
 
389
        setRightWallVisible(cfgGroup->readEntry("rightWallVisible", rightWallVisible()));
390
390
 
391
391
        baseX = x();
392
392
        baseY = y();
400
400
        baseRightWallY = rightWall->y();
401
401
}
402
402
 
403
 
void Bridge::save(KConfig *cfg)
 
403
void Bridge::save(KConfigGroup *cfgGroup)
404
404
{
405
 
        doSave(cfg);
 
405
        doSave(cfgGroup);
406
406
}
407
407
 
408
 
void Bridge::doSave(KConfig *cfg)
 
408
void Bridge::doSave(KConfigGroup *cfgGroup)
409
409
{
410
 
        cfg->writeEntry("width", width());
411
 
        cfg->writeEntry("height", height());
412
 
        cfg->writeEntry("topWallVisible", topWallVisible());
413
 
        cfg->writeEntry("botWallVisible", botWallVisible());
414
 
        cfg->writeEntry("leftWallVisible", leftWallVisible());
415
 
        cfg->writeEntry("rightWallVisible", rightWallVisible());
 
410
        cfgGroup->writeEntry("width", width());
 
411
        cfgGroup->writeEntry("height", height());
 
412
        cfgGroup->writeEntry("topWallVisible", topWallVisible());
 
413
        cfgGroup->writeEntry("botWallVisible", botWallVisible());
 
414
        cfgGroup->writeEntry("leftWallVisible", leftWallVisible());
 
415
        cfgGroup->writeEntry("rightWallVisible", rightWallVisible());
416
416
}
417
417
 
418
418
QList<QGraphicsItem *> Bridge::moveableItems() const
569
569
        right->setGame(game);
570
570
}
571
571
 
572
 
void Windmill::save(KConfig *cfg)
 
572
void Windmill::save(KConfigGroup *cfgGroup)
573
573
{
574
 
        cfg->writeEntry("speed", speed);
575
 
        cfg->writeEntry("bottom", m_bottom);
 
574
        cfgGroup->writeEntry("speed", speed);
 
575
        cfgGroup->writeEntry("bottom", m_bottom);
576
576
 
577
 
        doSave(cfg);
 
577
        doSave(cfgGroup);
578
578
}
579
579
 
580
 
void Windmill::load(KConfig *cfg)
 
580
void Windmill::load(KConfigGroup *cfgGroup)
581
581
{
582
 
        setSpeed(cfg->readEntry("speed", -1));
 
582
        setSpeed(cfgGroup->readEntry("speed", -1));
583
583
 
584
 
        doLoad(cfg);
 
584
        doLoad(cfgGroup);
585
585
 
586
586
        left->editModeChanged(false);
587
587
        right->editModeChanged(false);
588
588
        guard->editModeChanged(false);
589
589
 
590
 
        setBottom(cfg->readEntry("bottom", true));
 
590
        setBottom(cfgGroup->readEntry("bottom", true));
591
591
 
592
592
        baseGuardMin = guard->getMin();
593
593
        baseGuardMax = guard->getMax();
674
674
        Bridge::resize(resizeFactor);
675
675
}
676
676
 
677
 
void Sign::load(KConfig *cfg)
 
677
void Sign::load(KConfigGroup *cfgGroup)
678
678
{
679
 
        m_text = cfg->readEntry("Comment", m_text);
680
 
        m_untranslatedText = cfg->readEntryUntranslated("Comment", m_untranslatedText);
 
679
        m_text = cfgGroup->readEntry("Comment", m_text);
 
680
        m_untranslatedText = cfgGroup->readEntryUntranslated("Comment", m_untranslatedText);
681
681
 
682
 
        doLoad(cfg);
 
682
        doLoad(cfgGroup);
683
683
}
684
684
 
685
 
void Sign::save(KConfig *cfg)
 
685
void Sign::save(KConfigGroup *cfgGroup)
686
686
{
687
 
        cfg->writeEntry("Comment", m_untranslatedText);
 
687
        cfgGroup->writeEntry("Comment", m_untranslatedText);
688
688
 
689
 
        doSave(cfg);
 
689
        doSave(cfgGroup);
690
690
}
691
691
 
692
692
void Sign::setText(const QString &text)
908
908
        }
909
909
}
910
910
 
911
 
void KolfEllipse::load(KConfig *cfg)
 
911
void KolfEllipse::load(KConfigGroup *cfgGroup)
912
912
{
913
 
        setChangeEnabled(cfg->readEntry("changeEnabled", changeEnabled()));
914
 
        setChangeEvery(cfg->readEntry("changeEvery", changeEvery()));
 
913
        setChangeEnabled(cfgGroup->readEntry("changeEnabled", changeEnabled()));
 
914
        setChangeEvery(cfgGroup->readEntry("changeEvery", changeEvery()));
915
915
        double newWidth = width(), newHeight = height();
916
 
        newWidth = cfg->readEntry("width", newWidth);
917
 
        newHeight = cfg->readEntry("height", newHeight);
 
916
        newWidth = cfgGroup->readEntry("width", newWidth);
 
917
        newHeight = cfgGroup->readEntry("height", newHeight);
918
918
        newSize(newWidth, newHeight);
919
919
        moveBy(0, 0); 
920
920
921
921
 
922
 
void KolfEllipse::save(KConfig *cfg)
 
922
void KolfEllipse::save(KConfigGroup *cfgGroup)
923
923
{
924
 
        cfg->writeEntry("changeEvery", changeEvery());
925
 
        cfg->writeEntry("changeEnabled", changeEnabled());
926
 
        cfg->writeEntry("width", width());
927
 
        cfg->writeEntry("height", height());
 
924
        cfgGroup->writeEntry("changeEvery", changeEvery());
 
925
        cfgGroup->writeEntry("changeEnabled", changeEnabled());
 
926
        cfgGroup->writeEntry("width", width());
 
927
        cfgGroup->writeEntry("height", height());
928
928
}
929
929
 
930
930
Config *KolfEllipse::config(QWidget *parent)
1330
1330
        pixmap=game->renderer->renderSvg("cup", (int)rect().width(), (int)rect().height(), 0);
1331
1331
}
1332
1332
 
1333
 
void Cup::save(KConfig *cfg)
 
1333
void Cup::save(KConfigGroup *cfgGroup)
1334
1334
{
1335
 
        cfg->writeEntry("dummykey", true);
 
1335
        cfgGroup->writeEntry("dummykey", true);
1336
1336
}
1337
1337
 
1338
1338
void Cup::saveState(StateDB *db)
1590
1590
        playSound("blackhole");
1591
1591
}
1592
1592
 
1593
 
void BlackHole::load(KConfig *cfg)
 
1593
void BlackHole::load(KConfigGroup *cfgGroup)
1594
1594
{
1595
 
        QPoint exit = cfg->readEntry("exit", exit);
 
1595
        QPoint exit = cfgGroup->readEntry("exit", exit);
1596
1596
        exitItem->setPos(exit.x(), exit.y());
1597
 
        exitDeg = cfg->readEntry("exitDeg", exitDeg);
1598
 
        m_minSpeed = cfg->readEntry("minspeed", m_minSpeed);
1599
 
        m_maxSpeed = cfg->readEntry("maxspeed", m_maxSpeed);
 
1597
        exitDeg = cfgGroup->readEntry("exitDeg", exitDeg);
 
1598
        m_minSpeed = cfgGroup->readEntry("minspeed", m_minSpeed);
 
1599
        m_maxSpeed = cfgGroup->readEntry("maxspeed", m_maxSpeed);
1600
1600
        exitItem->updateArrowAngle();
1601
1601
        exitItem->updateArrowLength();
1602
1602
 
1637
1637
        exitItem->setVisible(true);
1638
1638
}
1639
1639
 
1640
 
void BlackHole::save(KConfig *cfg)
 
1640
void BlackHole::save(KConfigGroup *cfgGroup)
1641
1641
{
1642
 
        cfg->writeEntry("exit", QPointF(exitItem->x(), exitItem->y()));
1643
 
        cfg->writeEntry("exitDeg", exitDeg);
1644
 
        cfg->writeEntry("minspeed", m_minSpeed);
1645
 
        cfg->writeEntry("maxspeed", m_maxSpeed);
 
1642
        cfgGroup->writeEntry("exit", QPointF(exitItem->x(), exitItem->y()));
 
1643
        cfgGroup->writeEntry("exitDeg", exitDeg);
 
1644
        cfgGroup->writeEntry("minspeed", m_minSpeed);
 
1645
        cfgGroup->writeEntry("maxspeed", m_maxSpeed);
1646
1646
}
1647
1647
 
1648
1648
HoleResult BlackHole::result(QPointF p, double s, bool * /*wasCenter*/)
2213
2213
        return false;
2214
2214
}
2215
2215
 
2216
 
void Wall::load(KConfig *cfg)
 
2216
void Wall::load(KConfigGroup *cfgGroup)
2217
2217
{
2218
2218
        QPoint start(startPoint());
2219
 
        start = cfg->readEntry("startPoint", start);
 
2219
        start = cfgGroup->readEntry("startPoint", start);
2220
2220
        QPoint end(endPoint());
2221
 
        end = cfg->readEntry("endPoint", end);
 
2221
        end = cfgGroup->readEntry("endPoint", end);
2222
2222
 
2223
2223
        setLine(start.x(), start.y(), end.x(), end.y());
2224
2224
 
2227
2227
        endItem->setPos(end.x()-1, end.y()-1);
2228
2228
}
2229
2229
 
2230
 
void Wall::save(KConfig *cfg)
 
2230
void Wall::save(KConfigGroup *cfgGroup)
2231
2231
{
2232
 
        cfg->writeEntry("startPoint", QPoint((int)startItem->x(), (int)startItem->y()));
2233
 
        cfg->writeEntry("endPoint", QPoint((int)endItem->x(), (int)endItem->y()));
 
2232
        cfgGroup->writeEntry("startPoint", QPoint((int)startItem->x(), (int)startItem->y()));
 
2233
        cfgGroup->writeEntry("endPoint", QPoint((int)endItem->x(), (int)endItem->y()));
2234
2234
}
2235
2235
 
2236
2236
void Wall::doAdvance()
2442
2442
        regAdv = false;
2443
2443
        curHole = 0; // will get ++'d
2444
2444
        cfg = 0;
 
2445
        cfgGroup = 0;
2445
2446
        setFilename(filename);
2446
2447
        this->players = players;
2447
2448
        this->obj = obj;
2596
2597
        {
2597
2598
                for (; scoreboardHoles < curHole; ++scoreboardHoles)
2598
2599
                {
2599
 
                        cfg->setGroup(QString("%1-hole@-50,-50|0").arg(scoreboardHoles + 1));
2600
 
                        emit newHole(cfg->readEntry("par", 3));
 
2600
                        cfgGroup = new KConfigGroup(cfg->group(QString("%1-hole@-50,-50|0").arg(scoreboardHoles + 1)));
 
2601
                        emit newHole(cfgGroup->readEntry("par", 3));
2601
2602
                }
2602
2603
 
2603
2604
                // lets load all of the scores from saved game if there are any
3775
3776
 
3776
3777
                for (; scoreboardHoles < curHole; ++scoreboardHoles)
3777
3778
                {
3778
 
                        cfg->setGroup(QString("%1-hole@-50,-50|0").arg(scoreboardHoles + 1));
3779
 
                        emit newHole(cfg->readEntry("par", 3));
 
3779
                        cfgGroup = new KConfigGroup(cfg->group(QString("%1-hole@-50,-50|0").arg(scoreboardHoles + 1)));
 
3780
                        emit newHole(cfgGroup->readEntry("par", 3));
3780
3781
                }
3781
3782
 
3782
3783
                resetHoleScores();
3837
3838
        // we do this here for the hell of it.
3838
3839
        // there is no fake id, by the way,
3839
3840
        // because it's old and when i added ids i forgot to change it.
3840
 
        cfg->setGroup("0-course@-50,-50");
3841
 
        holeInfo.setAuthor(cfg->readEntry("author", holeInfo.author()));
3842
 
        holeInfo.setName(cfg->readEntry("Name", holeInfo.name()));
3843
 
        holeInfo.setUntranslatedName(cfg->readEntryUntranslated("Name", holeInfo.untranslatedName()));
 
3841
        cfgGroup = new KConfigGroup(cfg->group(QString("0-course@-50,-50")));
 
3842
        holeInfo.setAuthor(cfgGroup->readEntry("author", holeInfo.author()));
 
3843
        holeInfo.setName(cfgGroup->readEntry("Name", holeInfo.name()));
 
3844
        holeInfo.setUntranslatedName(cfgGroup->readEntryUntranslated("Name", holeInfo.untranslatedName()));
3844
3845
        emit titleChanged(holeInfo.name());
3845
3846
 
3846
 
        cfg->setGroup(QString("%1-hole@-50,-50|0").arg(curHole));
3847
 
        curPar = cfg->readEntry("par", 3);
 
3847
        cfgGroup = new KConfigGroup(KSharedConfig::openConfig(filename), QString("%1-hole@-50,-50|0").arg(curHole));
 
3848
        curPar = cfgGroup->readEntry("par", 3);
3848
3849
        holeInfo.setPar(curPar);
3849
 
        holeInfo.borderWallsChanged(cfg->readEntry("borderWalls", holeInfo.borderWalls()));
3850
 
        holeInfo.setMaxStrokes(cfg->readEntry("maxstrokes", 10));
3851
 
        bool hasFinalLoad = cfg->readEntry("hasFinalLoad", true);
 
3850
        holeInfo.borderWallsChanged(cfgGroup->readEntry("borderWalls", holeInfo.borderWalls()));
 
3851
        holeInfo.setMaxStrokes(cfgGroup->readEntry("maxstrokes", 10));
 
3852
        bool hasFinalLoad = cfgGroup->readEntry("hasFinalLoad", true);
3852
3853
 
3853
3854
        QStringList missingPlugins;
3854
3855
        QStringList groups = cfg->groupList();
3859
3860
        for (QStringList::Iterator it = groups.begin(); it != groups.end(); ++it)
3860
3861
        {
3861
3862
                // [<holeNum>-<name>@<x>,<y>|<id>]
3862
 
                cfg->setGroup(*it);
 
3863
                cfgGroup = new KConfigGroup(cfg->group(*it));
3863
3864
 
3864
3865
                const int len = (*it).length();
3865
3866
                const int dashIndex = (*it).indexOf("-");
3930
3931
                        // make things actually show
3931
3932
                        if (!hasFinalLoad)
3932
3933
                        {
3933
 
                                cfg->setGroup(makeGroup(id, curHole, sceneItem->name(), x, y));
3934
 
                                sceneItem->load(cfg);
 
3934
                                cfgGroup = new KConfigGroup(cfg->group(makeGroup(id, curHole, sceneItem->name(), x, y)));
 
3935
                                sceneItem->load(cfgGroup);
3935
3936
                        }
3936
3937
 
3937
3938
                        // we don't allow multiple items for the same thing in
3991
3992
                                else
3992
3993
                                {
3993
3994
                                        QString group = makeGroup(item->curId(), curHole, item->name(), (int)(*qsceneItem)->x(), (int)(*qsceneItem)->y());
3994
 
                                        cfg->setGroup(group);
3995
 
                                        item->load(cfg);
 
3995
                                        cfgGroup = new KConfigGroup(cfg->group(group));
 
3996
                                        item->load(cfgGroup);
3996
3997
                                }
3997
3998
                        }
3998
3999
                }
4001
4002
                qsceneItem = qtodo.constBegin();
4002
4003
                for (citem = todo.constBegin(); citem != todo.constEnd(); ++citem)
4003
4004
                {
4004
 
                        cfg->setGroup(makeGroup((*citem)->curId(), curHole, (*citem)->name(), (int)(*qsceneItem)->x(), (int)(*qsceneItem)->y()));
4005
 
                        (*citem)->load(cfg);
 
4005
                        cfgGroup = new KConfigGroup(cfg->group(makeGroup((*citem)->curId(), curHole, (*citem)->name(), (int)(*qsceneItem)->x(), (int)(*qsceneItem)->y())));
 
4006
                        (*citem)->load(cfgGroup);
4006
4007
 
4007
4008
                        qsceneItem++;
4008
4009
                }
4328
4329
                {
4329
4330
                        citem->clean();
4330
4331
 
4331
 
                        cfg->setGroup(makeGroup(citem->curId(), curHole, citem->name(), (int)(*item)->x(), (int)(*item)->y()));
4332
 
                        citem->save(cfg);
 
4332
                        cfgGroup = new KConfigGroup(cfg->group(makeGroup(citem->curId(), curHole, citem->name(), (int)(*item)->x(), (int)(*item)->y())));
 
4333
                        citem->save(cfgGroup);
4333
4334
                }
4334
4335
        }
4335
4336
 
4336
4337
        // save where ball starts (whiteBall tells all)
4337
 
        cfg->setGroup(QString("%1-ball@%2,%3").arg(curHole).arg((int)whiteBall->x()).arg((int)whiteBall->y()));
4338
 
        cfg->writeEntry("dummykey", true);
 
4338
        cfgGroup = new KConfigGroup(cfg->group(QString("%1-ball@%2,%3").arg(curHole).arg((int)whiteBall->x()).arg((int)whiteBall->y())));
 
4339
        cfgGroup->writeEntry("dummykey", true);
4339
4340
 
4340
 
        cfg->setGroup("0-course@-50,-50");
4341
 
        cfg->writeEntry("author", holeInfo.author());
4342
 
        cfg->writeEntry("Name", holeInfo.untranslatedName());
 
4341
        cfgGroup = new KConfigGroup(cfg->group(QString("0-course@-50,-50")));
 
4342
        cfgGroup->writeEntry("author", holeInfo.author());
 
4343
        cfgGroup->writeEntry("Name", holeInfo.untranslatedName());
4343
4344
 
4344
4345
        // save hole info
4345
 
        cfg->setGroup(QString("%1-hole@-50,-50|0").arg(curHole));
4346
 
        cfg->writeEntry("par", holeInfo.par());
4347
 
        cfg->writeEntry("maxstrokes", holeInfo.maxStrokes());
4348
 
        cfg->writeEntry("borderWalls", holeInfo.borderWalls());
4349
 
        cfg->writeEntry("hasFinalLoad", hasFinalLoad);
 
4346
        cfgGroup = new KConfigGroup(cfg->group(QString("%1-hole@-50,-50|0").arg(curHole)));
 
4347
        cfgGroup->writeEntry("par", holeInfo.par());
 
4348
        cfgGroup->writeEntry("maxstrokes", holeInfo.maxStrokes());
 
4349
        cfgGroup->writeEntry("borderWalls", holeInfo.borderWalls());
 
4350
        cfgGroup->writeEntry("hasFinalLoad", hasFinalLoad);
4350
4351
 
4351
4352
        cfg->sync();
4352
4353
 
4516
4517
 
4517
4518
void KolfGame::courseInfo(CourseInfo &info, const QString& filename)
4518
4519
{
4519
 
        KConfig cfg(filename);
4520
 
        cfg.setGroup("0-course@-50,-50");
4521
 
        info.author = cfg.readEntry("author", info.author);
4522
 
        info.name = cfg.readEntry("Name", cfg.readEntry("name", info.name));
4523
 
        info.untranslatedName = cfg.readEntryUntranslated("Name", cfg.readEntryUntranslated("name", info.name));
 
4520
        KConfig config(filename);
 
4521
        KConfigGroup configGroup (config.group(QString("0-course@-50,-50")));
 
4522
        info.author = configGroup.readEntry("author", info.author);
 
4523
        info.name = configGroup.readEntry("Name", configGroup.readEntry("name", info.name));
 
4524
        info.untranslatedName = configGroup.readEntryUntranslated("Name", configGroup.readEntryUntranslated("name", info.name));
4524
4525
 
4525
4526
        unsigned int hole = 1;
4526
4527
        unsigned int par= 0;
4527
4528
        while (1)
4528
4529
        {
4529
4530
                QString group = QString("%1-hole@-50,-50|0").arg(hole);
4530
 
                if (!cfg.hasGroup(group))
 
4531
                if (!config.hasGroup(group))
4531
4532
                {
4532
4533
                        hole--;
4533
4534
                        break;
4534
4535
                }
4535
4536
 
4536
 
                cfg.setGroup(group);
4537
 
                par += cfg.readEntry("par", 3);
 
4537
                configGroup = KConfigGroup(config.group(group));
 
4538
                par += configGroup.readEntry("par", 3);
4538
4539
 
4539
4540
                hole++;
4540
4541
        }
4545
4546
 
4546
4547
void KolfGame::scoresFromSaved(KConfig *config, PlayerList &players)
4547
4548
{
4548
 
        config->setGroup("0 Saved Game");
4549
 
        int numPlayers = config->readEntry("Players", 0);
 
4549
        KConfigGroup *configGroup  = new KConfigGroup(config->group(QString("0 Saved Game")));
 
4550
        int numPlayers = configGroup->readEntry("Players", 0);
4550
4551
        if (numPlayers <= 0)
4551
4552
                return;
4552
4553
 
4553
4554
        for (int i = 1; i <= numPlayers; ++i)
4554
4555
        {
4555
4556
                // this is same as in kolf.cpp, but we use saved game values
4556
 
                config->setGroup(QString::number(i));
 
4557
                configGroup = new KConfigGroup(config->group(QString::number(i)));
4557
4558
                players.append(Player());
4558
 
                players.last().ball()->setColor(config->readEntry("Color", "#ffffff"));
4559
 
                players.last().setName(config->readEntry("Name"));
 
4559
                players.last().ball()->setColor(configGroup->readEntry("Color", "#ffffff"));
 
4560
                players.last().setName(configGroup->readEntry("Name"));
4560
4561
                players.last().setId(i);
4561
4562
 
4562
 
                QStringList scores(config->readEntry("Scores",QStringList()));
 
4563
                QStringList scores(configGroup->readEntry("Scores",QStringList()));
4563
4564
                QList<int> intscores;
4564
4565
                for (QStringList::Iterator it = scores.begin(); it != scores.end(); ++it)
4565
4566
                        intscores.append((*it).toInt());
4571
4572
void KolfGame::saveScores(KConfig *config)
4572
4573
{
4573
4574
        // wipe out old player info
4574
 
        QStringList groups = config->groupList();
 
4575
        QStringList groups = cfg->groupList();
4575
4576
        for (QStringList::Iterator it = groups.begin(); it != groups.end(); ++it)
4576
4577
        {
4577
4578
                // this deletes all int groups, ie, the player info groups
4581
4582
                        config->deleteGroup(*it);
4582
4583
        }
4583
4584
 
4584
 
        config->setGroup("0 Saved Game");
4585
 
        config->writeEntry("Players", players->count());
4586
 
        config->writeEntry("Course", filename);
4587
 
        config->writeEntry("Current Hole", curHole);
 
4585
        KConfigGroup *configGroup  = new KConfigGroup(config->group(QString("0 Saved Game")));
 
4586
        configGroup->writeEntry("Players", players->count());
 
4587
        configGroup->writeEntry("Course", filename);
 
4588
        configGroup->writeEntry("Current Hole", curHole);
4588
4589
 
4589
4590
        for (PlayerList::Iterator it = players->begin(); it != players->end(); ++it)
4590
4591
        {
4591
 
                config->setGroup(QString::number((*it).id()));
4592
 
                config->writeEntry("Name", (*it).name());
4593
 
                config->writeEntry("Color", (*it).ball()->color().name());
 
4592
                configGroup  = new KConfigGroup(config->group(QString::number((*it).id())));
 
4593
                configGroup->writeEntry("Name", (*it).name());
 
4594
                configGroup->writeEntry("Color", (*it).ball()->color().name());
4594
4595
 
4595
4596
                QStringList scores;
4596
4597
                QList<int> intscores = (*it).scores();
4597
4598
                for (QList<int>::Iterator it = intscores.begin(); it != intscores.end(); ++it)
4598
4599
                        scores.append(QString::number(*it));
4599
4600
 
4600
 
                config->writeEntry("Scores", scores);
 
4601
                configGroup->writeEntry("Scores", scores);
4601
4602
        }
4602
4603
}
4603
4604