File indexing completed on 2024-04-28 04:04:39

0001 /*
0002     This file is part of the game 'KTron'
0003 
0004     SPDX-FileCopyrightText: 1998-2000 Matthias Kiefer <matthias.kiefer@gmx.de>
0005     SPDX-FileCopyrightText: 2005 Benjamin C. Meyer <ben at meyerhome dot net>
0006     SPDX-FileCopyrightText: 2008-2009 Stas Verberkt <legolas at legolasweb dot nl>
0007 
0008     SPDX-License-Identifier: GPL-2.0-or-later
0009 
0010 */
0011 #include <QApplication>
0012 
0013 #include <KLocalizedString>
0014 #include <KAboutData>
0015 #include <KCrash>
0016 #include <KDBusService>
0017 #include <QCommandLineParser>
0018 #include <QCommandLineOption>
0019 #include <QStandardPaths>
0020 
0021 #include "ktron.h"
0022 #include "renderer.h"
0023 #include "settings.h"
0024 #include "ksnakeduel_version.h"
0025 
0026 
0027 int main(int argc, char* argv[])
0028 {
0029     QApplication app(argc, argv);
0030 
0031     KLocalizedString::setApplicationDomain(QByteArrayLiteral("ksnakeduel"));
0032 
0033     KAboutData aboutData( QStringLiteral("ksnakeduel"), i18n("KSnakeDuel"),
0034             QStringLiteral(KSNAKEDUEL_VERSION_STRING),
0035             i18n("A race in hyperspace"),
0036             KAboutLicense::GPL,
0037             i18n("(c) 1998-2000, Matthias Kiefer\n"
0038                  "(c) 2005, Benjamin Meyer\n"
0039                  "(c) 2008-2009, Stas Verberkt\n"
0040                  "\n"
0041                  "Parts of the algorithms for the computer player are from\n"
0042                  "xtron-1.1 by Rhett D. Jacobs <rhett@hotel.canberra.edu.au>"),
0043             QString(),
0044             QStringLiteral("https://apps.kde.org/ksnakeduel"));
0045     aboutData.addAuthor(i18n("Matthias Kiefer"), i18n("Original author"), QStringLiteral("matthias.kiefer@gmx.de"));
0046     aboutData.addAuthor(i18n("Benjamin Meyer"), i18n("Various improvements"), QStringLiteral("ben+ktron@meyerhome.net"));
0047     aboutData.addAuthor(i18n("Stas Verberkt"), i18n("KDE 4 Port, interface revision and KSnake mode"), QStringLiteral("legolas@legolasweb.nl"));
0048 
0049     KAboutData::setApplicationData(aboutData);
0050     QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("ksnakeduel")));
0051 
0052     KCrash::initialize();
0053 
0054     QCommandLineParser parser;
0055     parser.addOption(QCommandLineOption(QStringList() <<  QStringLiteral("snake"), i18n("Start in KSnake mode")));
0056 
0057     aboutData.setupCommandLine(&parser);
0058     parser.process(app);
0059     aboutData.processCommandLine(&parser);
0060 
0061     KDBusService service;
0062 
0063     //KStandardDirs::locateLocal("appdata", QLatin1String( "themes/" ));
0064 
0065     if (parser.isSet(QStringLiteral("snake")))
0066     {
0067         Settings::setGameType(Settings::EnumGameType::Snake);
0068     }
0069     else if (Settings::gameType() == Settings::EnumGameType::Snake)
0070     {
0071         Settings::setGameType(Settings::EnumGameType::PlayerVSComputer);
0072     }
0073 
0074     Renderer::self(); // Creates Renderer
0075 
0076     KTron *ktron = new KTron();
0077     ktron->show();
0078 
0079     return app.exec();
0080 }
0081