/*************************************************************************** * Copyright (C) 2006 by Matthew Williams * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ #include #include #include #include #include #include #include #include #include "ksquareswindow.h" #include "ksquaresdemowindow.h" #include "settings.h" static const char description[] = I18N_NOOP("Take it in turns to draw lines.\nIf you complete a squares, you get another go."); static const char version[] = "0.5"; int main(int argc, char **argv) { QApplication app(argc, argv); Kdelibs4ConfigMigrator migrate(QLatin1String("ksquares")); migrate.setConfigFiles(QStringList() << QLatin1String("ksquaresrc")); migrate.setUiFiles(QStringList() << QLatin1String("ksquaresui.rc")); migrate.migrate(); KAboutData about("ksquares", i18n("KSquares"), version, i18n(description), KAboutLicense::GPL, i18n("(C) 2006-2007 Matt Williams"), "http://games.kde.org/ksquares"); about.addAuthor( i18n("Matt Williams"), i18n("Original creator and maintainer"), "matt@milliams.com", "http://milliams.com" ); about.addCredit(i18n("Fela Winkelmolen"), i18n("Many patches and bugfixes")); about.addCredit(i18n("Tom Vincent Peters"), i18n("Hard AI")); QCommandLineParser parser; KAboutData::setApplicationData(about); parser.addVersionOption(); parser.addHelpOption(); parser.addOption(QCommandLineOption(QStringList() << QLatin1String("demo"), i18n("Run game in demo (autoplay) mode"))); //PORTING SCRIPT: adapt aboutdata variable if necessary about.setupCommandLine(&parser); parser.process(app); about.processCommandLine(&parser); KDBusService service; // default names for players KConfigGroup cg(KSharedConfig::openConfig(), "General"); if (cg.readEntry("initializeNames", true)) { QStringList playerNames; playerNames << KUser().property(KUser::FullName).toString(); playerNames << i18nc("default name of player", "Player %1", 2); playerNames << i18nc("default name of player", "Player %1", 3); playerNames << i18nc("default name of player", "Player %1", 4); Settings::setPlayerNames(playerNames); cg.writeEntry("initializeNames", false); } if (parser.isSet("demo")) { KSquaresDemoWindow *demoWindow = new KSquaresDemoWindow; demoWindow->show(); demoWindow->gameNew(); } else { KSquaresWindow *mainWindow = new KSquaresWindow; mainWindow->show(); } return app.exec(); }