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

ksquares

main.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2006 by Matthew Williams    <matt@milliams.com>         *
00003  *                                                                         *
00004  *   This program is free software; you can redistribute it and/or modify  *
00005  *   it under the terms of the GNU General Public License as published by  *
00006  *   the Free Software Foundation; either version 2 of the License, or     *
00007  *   (at your option) any later version.                                   *
00008  ***************************************************************************/
00009 
00010 #include <KApplication>
00011 #include <KAboutData>
00012 #include <KCmdLineArgs>
00013 #include <KLocale>
00014 #include <KUser>
00015 
00016 #include <KDebug>
00017 
00018 #include "ksquareswindow.h"
00019 #include "ksquaresdemowindow.h"
00020 #include "settings.h"
00021 
00022 static const char description[] =
00023     I18N_NOOP("Take it in turns to draw lines.\nIf you complete a squares, you get another go.");
00024 
00025 static const char version[] = "0.4";
00026 
00027 int main(int argc, char **argv)
00028 {
00029     KAboutData about("ksquares", 0, ki18n("KSquares"), version, ki18n(description),
00030         KAboutData::License_GPL, ki18n("(C) 2006-2007 Matt Williams"), KLocalizedString(), 
00031         "http://games.kde.org/ksquares");
00032     about.addAuthor( ki18n("Matt Williams"), ki18n("Original creator and maintainer"), "matt@milliams.com", "http://milliams.com" );
00033     about.addCredit(ki18n("Fela Winkelmolen"), ki18n("Many patches and bugfixes"));
00034     
00035     KCmdLineArgs::init(argc, argv, &about);
00036 
00037     KCmdLineOptions options;
00038     options.add("demo", ki18n("Run game in demo (autoplay) mode"));
00039     KCmdLineArgs::addCmdLineOptions( options );
00040     KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
00041     
00042     KApplication app;
00043     KGlobal::locale()->insertCatalog("libkdegames");
00044     
00045     // default names for players
00046     KConfigGroup cg(KGlobal::config(), "General");
00047     if (cg.readEntry<bool>("initializeNames", true)) {
00048         QStringList playerNames;
00049         playerNames << KUser().property(KUser::FullName).toString();
00050         playerNames << i18nc("default name of second player", "Player 2");
00051         playerNames << i18nc("default name of third player", "Player 3");
00052         playerNames << i18nc("default name of fourth player", "Player 4");
00053         Settings::setPlayerNames(playerNames);
00054         cg.writeEntry("initializeNames", false);
00055     }
00056     
00057     if (args->isSet("demo"))
00058     {
00059         KSquaresDemoWindow *demoWindow = new KSquaresDemoWindow;
00060         demoWindow->show();
00061         demoWindow->gameNew();
00062     }
00063     else
00064     {
00065         KSquaresWindow *mainWindow = new KSquaresWindow;
00066         mainWindow->show();
00067     }
00068     args->clear();
00069     
00070     return app.exec();
00071 }

ksquares

Skip menu "ksquares"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

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