File indexing completed on 2024-02-18 04:04:53

0001 /*
0002     SPDX-FileCopyrightText: 2000-2001 Nikolas Zimmermann <wildfox@kde.org>
0003     SPDX-FileCopyrightText: 2000-2001 Daniel Molkentin <molkentin@kde.org>
0004     SPDX-FileCopyrightText: 2007 Paolo Capriotti <p.capriotti@gmail.com>
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 #include <KAboutData>
0010 #include <KCrash>
0011 #include <KLocalizedString>
0012 #include <KDBusService>
0013 
0014 #include <QApplication>
0015 #include <QUrl>
0016 #include <QCommandLineParser>
0017 #include <QCommandLineOption>
0018 
0019 #include "mainwindow.h"
0020 #include "coord.h"
0021 #include "statswidget.h"
0022 #include "knavalbattle_version.h"
0023 
0024 int main(int argc, char** argv)
0025 {
0026     QApplication app(argc, argv);
0027 
0028     KLocalizedString::setApplicationDomain(QByteArrayLiteral("knavalbattle"));
0029 
0030     KAboutData aboutData(QStringLiteral("knavalbattle"), i18n("Naval Battle"),
0031         QStringLiteral(KNAVALBATTLE_VERSION_STRING),
0032         i18n("The KDE ship sinking game"), KAboutLicense::GPL, 
0033         i18n("(c) 2000-2005  Nikolas Zimmermann, Daniel Molkentin\n"
0034               "(c) 2007 Paolo Capriotti"),
0035         QString(),
0036         QStringLiteral("https://apps.kde.org/knavalbattle") );
0037 
0038     aboutData.addAuthor(i18n("Paolo Capriotti"), i18n("Current maintainer"), QStringLiteral("p.capriotti@gmail.com"));
0039     aboutData.addAuthor(i18n("Nikolas Zimmermann"), i18n("Project Founder, GUI Handling, Client/Server"), QStringLiteral("wildfox@kde.org"));
0040     aboutData.addAuthor(i18n("Daniel Molkentin"), i18n("Dialog Stuff, Client/Server"), QStringLiteral("molkentin@kde.org"));
0041     aboutData.addAuthor(i18n("Kevin Krammer"), i18n("Computer Player"), QStringLiteral("kevin.krammer@gmx.at"));
0042     
0043     aboutData.addCredit(i18n("Johann Ollivier Lapeyre"), i18n("Game artwork"), QStringLiteral("johann.ollivierlapeyre@gmail.com"));
0044     aboutData.addCredit(i18n("Eugene Trounev"), i18n("Background"), QStringLiteral("irs_me@hotmail.com"));
0045     aboutData.addCredit(i18n("Robert Wadley"), i18n("Artwork for some of the ships"), QStringLiteral("rob@robntina.fastmail.us"));
0046     aboutData.addCredit(i18n("Riccardo Iaconelli"), i18n("Welcome screen"), QStringLiteral("ruphy@fsfe.org"));
0047     aboutData.addCredit(i18n("Benjamin Adler"), i18n("Icon"), QStringLiteral("benadler@bigfoot.de"));
0048     aboutData.addCredit(i18n("Nils Trzebin"), i18n("Sounds"), QStringLiteral("nils.trzebin@stud.uni-hannover.de"));
0049     aboutData.addCredit(i18n("Elmar Hoefner"), i18n("GFX"), QStringLiteral("elmar.hoefner@uibk.ac.at"));
0050     aboutData.addCredit(i18n("Lukas Tinkl"), i18n("Non-Latin1 Support"), QStringLiteral("lukas@kde.org"));
0051     aboutData.addCredit(i18n("Malte Starostik"), i18n("Various improvements"), QStringLiteral("malte.starostik@t-online.de"));
0052     aboutData.addCredit(i18n("Albert Astals Cid"), i18n("Various improvements and bugfixes"), QStringLiteral("aacid@kde.org"));
0053     aboutData.addCredit(i18n("John Tapsell"), i18n("Various improvements and bugfixes"), QStringLiteral("john@geola.co.uk"));
0054     aboutData.addCredit(i18n("Inge Wallin"), i18n("Bugfixes and refactoring"), QStringLiteral("inge@lysator.liu.se"));
0055     aboutData.addCredit(i18n("Jakub Stachowski"), i18n("DNS-SD discovery"), QStringLiteral("qbast@go2.pl"));
0056     aboutData.addCredit(i18n("Roney Gomes"), i18n("Porting to KGameRenderer and QGraphicsView"), QStringLiteral("roney477@gmail.com"));
0057         
0058     KAboutData::setApplicationData(aboutData);
0059     app.setWindowIcon(QIcon::fromTheme(QStringLiteral("knavalbattle")));
0060   
0061     QCommandLineParser parser;
0062     
0063     parser.addPositionalArgument(i18n("[URL]"), i18n("URL of a Naval Battle game server to connect to after startup"));
0064 
0065     aboutData.setupCommandLine(&parser);
0066     parser.process(app);
0067     aboutData.processCommandLine(&parser);
0068 
0069     KCrash::initialize();
0070     KDBusService service; 
0071     
0072     qRegisterMetaType<Coord>("Coord");
0073 
0074     QUrl url;
0075     const QStringList &args = parser.positionalArguments();
0076     if (!args.isEmpty()) {
0077         for (int i = 0; i < args.count(); ++i) {
0078             url = QUrl(args.at(i)); 
0079 
0080             if (!url.isValid())
0081                 continue;
0082 
0083             break;
0084         }
0085     }
0086     
0087     MainWindow* window = new MainWindow(url);
0088     //StatsWidget* window = new StatsWidget(0, 0);
0089     window->show();
0090 
0091     return app.exec();
0092 }