• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

libkdegames/kggzgames

kggzrankingsdialog.cpp

Go to the documentation of this file.
00001 /*
00002     This file is part of the kggzgames library.
00003     Copyright (c) 2007 Josef Spillner <josef@ggzgamingzone.org>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to
00017     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018     Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #include "kggzrankingsdialog.h"
00022 
00023 #include <kggzmod/module.h>
00024 
00025 #include <KDebug>
00026 #include <KScoreDialog>
00027 #include <KHighscore>
00028 
00029 class KGGZRankingsDialogPrivate
00030 {
00031     public:
00032         KGGZRankingsDialogPrivate(KGGZRankingsDialog* qq);
00033 
00034         KGGZRankingsDialog* q;
00035 
00036         KGGZMod::Module *m_mod;
00037         QWidget *m_parent;
00038 
00039         // slots
00040         void slotRankings(const KGGZMod::Event& event);
00041 };
00042 
00043 KGGZRankingsDialog::KGGZRankingsDialog(QWidget *parent)
00044 : QObject(), d(new KGGZRankingsDialogPrivate(this))
00045 {
00046     d->m_parent = parent;
00047     d->m_mod = KGGZMod::Module::instance();
00048 
00049     connect(d->m_mod,
00050         SIGNAL(signalEvent(const KGGZMod::Event&)),
00051         this,
00052         SLOT(slotRankings(const KGGZMod::Event&)));
00053 }
00054 
00055 KGGZRankingsDialogPrivate::KGGZRankingsDialogPrivate(KGGZRankingsDialog* qq)
00056 : q(qq)
00057 {
00058 }
00059 
00060 KGGZRankingsDialog::~KGGZRankingsDialog()
00061 {
00062     delete d;
00063 }
00064 
00065 void KGGZRankingsDialogPrivate::slotRankings(const KGGZMod::Event& event)
00066 {
00067     if(event.type() == KGGZMod::Event::rankings)
00068     {
00069         KHighscore highscore;
00070         highscore.setHighscoreGroup("GGZ");
00071 
00072         KGGZMod::RankingsEvent e(event);
00073         for(int i = 0; i < e.count(); i++)
00074         {
00075             QString name = e.name(i);
00076             int score = e.score(i);
00077             kDebug(11004) << "RANKINGS-DIALOG" << name << score;
00078             highscore.writeEntry(i + 1, "Name", name);
00079             highscore.writeEntry(i + 1, "Score", score);
00080         }
00081 
00082         KScoreDialog ksdialog(KScoreDialog::Name, m_parent);
00083         ksdialog.setConfigGroup("GGZ");
00084         ksdialog.exec();
00085     }
00086 }
00087 
00088 #include "kggzrankingsdialog.moc"

libkdegames/kggzgames

Skip menu "libkdegames/kggzgames"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members

API Reference

Skip menu "API Reference"
  • kblackbox
  • kgoldrunner
  • kmahjongg
  • ksquares
  • libkdegames
  •   highscore
  •   kgame
  •   kggzgames
  •   kggzmod
  •   kggznet
  • libkmahjongg
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal