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