1/*
2 Copyright (C) 2002-2005, Jason Katz-Brown <jasonkb@mit.edu>
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 <QFile>
20
21#include <kapplication.h>
22#include <klocale.h>
23#include <kcmdlineargs.h>
24#include <kaboutdata.h>
25#include <kdebug.h>
26#include <kurl.h>
27#include <kglobal.h>
28#include "kolf.h"
29
30#include <iostream>
31#include <kdemacros.h>
32using namespace std;
33
34static const char description[] =
35I18N_NOOP("KDE Minigolf Game");
36
37static const char version[] = "1.10"; // = KDE 4.6 Release
38
39
40int main(int argc, char **argv)
41{
42 KAboutData aboutData( "kolf", 0, ki18n("Kolf"), version, ki18n(description), KAboutData::License_GPL, ki18n("(c) 2002-2010, Kolf developers"), KLocalizedString(), "http://games.kde.org/kolf");
43
44 aboutData.addAuthor(ki18n("Stefan Majewsky"), ki18n("Current maintainer"), "majewsky@gmx.net");
45 aboutData.addAuthor(ki18n("Jason Katz-Brown"), ki18n("Former main author"), "jasonkb@mit.edu");
46 aboutData.addAuthor(ki18n("Niklas Knutsson"), ki18n("Advanced putting mode"));
47 aboutData.addAuthor(ki18n("Rik Hemsley"), ki18n("Border around course"));
48 aboutData.addAuthor(ki18n("Timo A. Hummel"), ki18n("Some good sound effects"), "timo.hummel@gmx.net");
49
50 aboutData.addCredit(ki18n("Rob Renaud"), ki18n("Wall-bouncing help"));
51 aboutData.addCredit(ki18n("Aaron Seigo"), ki18n("Suggestions, bug reports"));
52 aboutData.addCredit(ki18n("Erin Catto"), ki18n("Developer of Box2D physics engine"));
53 aboutData.addCredit(ki18n("Ryan Cumming"), ki18n("Vector class (Kolf 1)"));
54 aboutData.addCredit(ki18n("Daniel Matza-Brown"), ki18n("Working wall-bouncing algorithm (Kolf 1)"));
55
56 KCmdLineArgs::init(argc, argv, &aboutData);
57
58 KCmdLineOptions options;
59 options.add("+file", ki18n("File"));
60 options.add("course-info ", ki18n("Print course information and exit"));
61 KCmdLineArgs::addCmdLineOptions(options);
62
63 // I've actually added this for my web site uploaded courses display
64 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
65 if (args->isSet("course-info"))
66 {
67 KCmdLineArgs::enable_i18n();
68
69 QString filename(args->getOption("course-info"));
70 if (QFile::exists(filename))
71 {
72 CourseInfo info;
73 KolfGame::courseInfo(info, filename);
74
75 cout << info.name.toLatin1().constData()
76 << " - " << i18n("By %1", info.author).toLatin1().constData()
77 << " - " << i18n("%1 holes", info.holes).toLatin1().constData()
78 << " - " << i18n("par %1", info.par).toLatin1().constData()
79 << endl;
80
81 return 0;
82 }
83 else
84 {
85 KCmdLineArgs::usageError(i18n("Course %1 does not exist.", filename));
86 }
87 }
88
89 QApplication::setColorSpec(QApplication::ManyColor);
90 KApplication a;
91 KGlobal::locale()->insertCatalog( QLatin1String( "libkdegames" ));
92
93 KolfWindow *top = new KolfWindow;
94
95 if (args->count() >= 1)
96 {
97 KUrl url = args->url(args->count() - 1);
98 top->openUrl(url);
99 args->clear();
100 }
101 else
102 top->closeGame();
103
104 top->show();
105
106 return a.exec();
107}
108
109