File indexing completed on 2022-11-29 18:40:56

0001 /*
0002     SPDX-FileCopyrightText: 2006 Dmitry Suzdalev <dimsuz@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include <QApplication>
0008 #include <QCommandLineOption>
0009 #include <QCommandLineParser>
0010 
0011 #include <KAboutData>
0012 #include <KLocalizedString>
0013 #include <KCrash>
0014 #include <KDBusService>
0015 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
0016 #include <Kdelibs4ConfigMigrator>
0017 #endif
0018 
0019 #include "highscores.h"
0020 #include "mainwindow.h"
0021 #include "kreversi_version.h"
0022 
0023 int main(int argc, char **argv)
0024 {
0025     // Fixes blurry icons with fractional scaling
0026 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
0027     QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
0028 #endif
0029     QApplication application(argc, argv);
0030 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
0031     Kdelibs4ConfigMigrator migrate(QStringLiteral("kreversi"));
0032     migrate.setConfigFiles(QStringList() << QStringLiteral("kreversirc"));
0033     migrate.setUiFiles(QStringList() << QStringLiteral("kreversiui.rc"));
0034     migrate.migrate();
0035 #endif
0036 
0037     KLocalizedString::setApplicationDomain("kreversi");
0038     KAboutData aboutData(QStringLiteral("kreversi"), i18n("KReversi"),
0039                          QStringLiteral(KREVERSI_VERSION_STRING),
0040                          i18n("KDE Reversi Board Game"),
0041                          KAboutLicense::GPL,
0042                          i18n("(c) 1997-2000, Mario Weilguni\n(c) 2004-2006, Inge Wallin\n(c) 2006, Dmitry Suzdalev"),
0043                          QString(),
0044                          QStringLiteral("https://apps.kde.org/kreversi"));
0045     aboutData.addAuthor(i18n("Mario Weilguni"), i18n("Original author"), QStringLiteral("mweilguni@sime.com"));
0046     aboutData.addAuthor(i18n("Inge Wallin"), i18n("Original author"), QStringLiteral("inge@lysator.liu.se"));
0047     aboutData.addAuthor(i18n("Dmitry Suzdalev"), i18n("Game rewrite for KDE4. Current maintainer."), QStringLiteral("dimsuz@gmail.com"));
0048     aboutData.addCredit(i18n("Simon Hürlimann"), i18n("Action refactoring"));
0049     aboutData.addCredit(i18n("Mats Luthman"), i18n("Game engine, ported from his JAVA applet."));
0050     aboutData.addCredit(i18n("Arne Klaassen"), i18n("Original raytraced chips."));
0051     aboutData.addCredit(i18n("Mauricio Piacentini"), i18n("Vector chips and background for KDE4."));
0052     aboutData.addCredit(i18n("Brian Croom"), i18n("Port rendering code to KGameRenderer"), QStringLiteral("brian.s.croom@gmail.com"));
0053     aboutData.addCredit(i18n("Denis Kuplyakov"), i18n("Port rendering code to QML, redesign and a lot of improvements"), QStringLiteral("dener.kup@gmail.com"));
0054 
0055     KAboutData::setApplicationData(aboutData);
0056 
0057     QCommandLineParser parser;
0058     KCrash::initialize();
0059     parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("demo"), i18n("Start with demo game playing")));
0060 
0061     aboutData.setupCommandLine(&parser);
0062     parser.process(application);
0063     aboutData.processCommandLine(&parser);
0064 
0065     KDBusService service;
0066     if (application.isSessionRestored()) {
0067         kRestoreMainWindows<KReversiMainWindow>();
0068     } else {
0069         KReversiMainWindow *mainWin = new KReversiMainWindow(nullptr, parser.isSet(QStringLiteral("demo")));
0070         mainWin->show();
0071     }
0072 
0073     KExtHighscore::ExtManager highscoresManager;
0074 
0075     application.setWindowIcon(QIcon::fromTheme(QStringLiteral("kreversi")));
0076 
0077     return application.exec();
0078 }