1/*
2 * Copyright (c) 2010 Ni Hui <shuizhuyuanluo@126.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19#include "mainwindow.h"
20#include "settings.h"
21
22#include <KAboutData>
23#include <KApplication>
24#include <KCmdLineArgs>
25#include <KLocale>
26
27#include <ctime>
28
29int main( int argc, char* argv[] )
30{
31 qsrand( time(0) );
32 KAboutData aboutData( "klickety", 0, ki18n( "Klickety" ), "2.0",
33 ki18n( "Klickety is an adaptation of the \"clickomania\" game" ),
34 KAboutData::License_GPL,
35 ki18n( "(c) 2002-2005, Nicolas Hadacek\n(c) 2010, Ni Hui" ),
36 KLocalizedString(), "http://games.kde.org/klickety" );
37
38 KCmdLineArgs::init( argc, argv, &aboutData );
39
40 KCmdLineOptions options;
41 options.add( "KSameMode", ki18n( "Start with KSame compatibility mode" ) );
42 KCmdLineArgs::addCmdLineOptions( options );
43
44 KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
45 bool KSameMode = args->isSet( "KSameMode" );
46
47 // set kconfig instance
48 // we use different file for storing ksame mode configuration
49 if ( KSameMode )
50 Settings::instance( QLatin1String( "ksamerc" ) );
51 else {
52 Settings::instance( QLatin1String( "klicketyrc" ) );
53 }
54 args->clear();
55
56 if ( KSameMode ) {
57 aboutData.setProgramName( ki18n( "SameGame" ) );
58 aboutData.setProgramIconName( "ksame" );
59 aboutData.setShortDescription( ki18n( "A little game about balls and how to get rid of them" ) );
60 aboutData.addAuthor( ki18n( "Marcus Kreutzberger"), ki18n( "Original author" ), "kreutzbe@informatik.mu-luebeck.de" );
61 aboutData.addAuthor( ki18n( "Henrique Pinto"), ki18n( "Past maintainer" ), "henrique.pinto@kdemail.net" );
62 aboutData.addAuthor( ki18n( "Ni Hui" ), ki18n( "Integration with Klickety. Current maintainer" ), "shuizhuyuanluo@126.com" );
63 aboutData.addCredit( ki18n( "Johann Ollivier Lapeyre"), ki18n("Artwork"), "johann.ollivierlapeyre@gmail.com" );
64 }
65 else {
66 aboutData.addAuthor( ki18n( "Nicolas Hadacek" ), ki18n( "Original author" ), "hadacek@kde.org" );
67 aboutData.addAuthor( ki18n( "Ni Hui" ), ki18n( "Rewrite for KDE4. Current maintainer" ), "shuizhuyuanluo@126.com" );
68 aboutData.addCredit( ki18n( "Dan Hill" ), ki18n( "Icons" ) );
69 }
70
71 KApplication app;
72
73 KGlobal::locale()->insertCatalog( QLatin1String( "libkdegames" ) );
74
75 //resource directory for KNewStuff2
76// KStandardDirs::locateLocal("appdata", "themes/");
77
78 // see if we are starting with session management
79 if ( app.isSessionRestored() ) {
80 RESTORE(MainWindow( KSameMode ));
81 }
82 else {
83 MainWindow* window = new MainWindow( KSameMode );
84 window->show();
85 }
86
87 return app.exec();
88}
89