main.cpp 3.85 KB
Newer Older
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
1
/*******************************************************************
Mario Weilguni's avatar
Mario Weilguni committed
2
 *
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
3
 * Copyright 2006 Dmitry Suzdalev <dimsuz@gmail.com>
Mario Weilguni's avatar
Mario Weilguni committed
4
 *
5
 * This file is part of the KDE project "KReversi"
Mario Weilguni's avatar
Mario Weilguni committed
6
 *
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
7
 * KReversi is free software; you can redistribute it and/or modify
Mario Weilguni's avatar
Mario Weilguni committed
8 9 10 11
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
12
 * KReversi is distributed in the hope that it will be useful,
Mario Weilguni's avatar
Mario Weilguni committed
13 14 15 16 17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
18
 * along with KReversi; see the file COPYING.  If not, write to
Dirk Mueller's avatar
Dirk Mueller committed
19
 * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Dirk Mueller's avatar
Dirk Mueller committed
20
 * Boston, MA 02110-1301, USA.
Mario Weilguni's avatar
Mario Weilguni committed
21 22 23 24
 *
 *******************************************************************
 */

25
#include <QApplication>
26
#include <QCommandLineOption>
Laurent Montel's avatar
Laurent Montel committed
27
#include <QCommandLineParser>
Waldo Bastian's avatar
Waldo Bastian committed
28

29 30 31
#include <KAboutData>
#include <KLocalizedString>
#include <KCrash>
Laurent Montel's avatar
Laurent Montel committed
32
#include <KDBusService>
33 34 35 36
#include <Kdelibs4ConfigMigrator>

#include "highscores.h"
#include "mainwindow.h"
Waldo Bastian's avatar
Waldo Bastian committed
37

38 39
int main(int argc, char **argv)
{
40 41
    // Fixes blurry icons with fractional scaling
    QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
42
    QApplication application(argc, argv);
Laurent Montel's avatar
Laurent Montel committed
43 44 45 46
    Kdelibs4ConfigMigrator migrate(QStringLiteral("kreversi"));
    migrate.setConfigFiles(QStringList() << QStringLiteral("kreversirc"));
    migrate.setUiFiles(QStringList() << QStringLiteral("kreversiui.rc"));
    migrate.migrate();
47

Laurent Montel's avatar
Laurent Montel committed
48
    KLocalizedString::setApplicationDomain("kreversi");
49
    KAboutData aboutData(QStringLiteral("kreversi"), i18n("KReversi"),
50 51 52
                         QStringLiteral("2.1"),
                         i18n("KDE Reversi Board Game"),
                         KAboutLicense::GPL,
53
                         i18n("(c) 1997-2000, Mario Weilguni\n(c) 2004-2006, Inge Wallin\n(c) 2006, Dmitry Suzdalev"),
54
                         QString(), i18n("https://kde.org/applications/games/org.kde.kreversi"));
55 56 57
    aboutData.addAuthor(i18n("Mario Weilguni"), i18n("Original author"), QStringLiteral("mweilguni@sime.com"));
    aboutData.addAuthor(i18n("Inge Wallin"), i18n("Original author"), QStringLiteral("inge@lysator.liu.se"));
    aboutData.addAuthor(i18n("Dmitry Suzdalev"), i18n("Game rewrite for KDE4. Current maintainer."), QStringLiteral("dimsuz@gmail.com"));
58 59 60 61
    aboutData.addCredit(i18n("Simon Hürlimann"), i18n("Action refactoring"));
    aboutData.addCredit(i18n("Mats Luthman"), i18n("Game engine, ported from his JAVA applet."));
    aboutData.addCredit(i18n("Arne Klaassen"), i18n("Original raytraced chips."));
    aboutData.addCredit(i18n("Mauricio Piacentini"), i18n("Vector chips and background for KDE4."));
62 63
    aboutData.addCredit(i18n("Brian Croom"), i18n("Port rendering code to KGameRenderer"), QStringLiteral("brian.s.croom@gmail.com"));
    aboutData.addCredit(i18n("Denis Kuplyakov"), i18n("Port rendering code to QML, redesign and a lot of improvements"), QStringLiteral("dener.kup@gmail.com"));
64

65
    KAboutData::setApplicationData(aboutData);
66

Laurent Montel's avatar
Laurent Montel committed
67
    QCommandLineParser parser;
Frederik Schwarzer's avatar
Frederik Schwarzer committed
68
    KCrash::initialize();
69
    parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("demo"), i18n("Start with demo game playing")));
Laurent Montel's avatar
Laurent Montel committed
70 71

    aboutData.setupCommandLine(&parser);
Laurent Montel's avatar
Laurent Montel committed
72
    parser.process(application);
Laurent Montel's avatar
Laurent Montel committed
73
    aboutData.processCommandLine(&parser);
74

Laurent Montel's avatar
Laurent Montel committed
75
    KDBusService service;
Denis Kuplyakov's avatar
Denis Kuplyakov committed
76
    if (application.isSessionRestored()) {
77
        kRestoreMainWindows<KReversiMainWindow>();
Denis Kuplyakov's avatar
Denis Kuplyakov committed
78
    } else {
Friedrich W. H. Kossebau's avatar
Friedrich W. H. Kossebau committed
79
        KReversiMainWindow *mainWin = new KReversiMainWindow(nullptr, parser.isSet(QStringLiteral("demo")));
80 81 82 83 84
        mainWin->show();
    }

    KExtHighscore::ExtManager highscoresManager;

Frederik Schwarzer's avatar
Frederik Schwarzer committed
85 86
    application.setWindowIcon(QIcon::fromTheme(QStringLiteral("kreversi")));

87
    return application.exec();
Mario Weilguni's avatar
Mario Weilguni committed
88
}