main.cpp 3.65 KB
Newer Older
Christian Krippendorf's avatar
Christian Krippendorf committed
1 2
/* Copyright (C) 1997 Mathias Mueller   <in5y158@public.uni-hamburg.de>
 *
3 4 5
 * Kmahjongg is free software; you can redistribute it and/or modify it under the terms of the GNU
 * General Public License as published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
Christian Krippendorf's avatar
Christian Krippendorf committed
6
 *
7 8 9
 * This program is distributed in the hope that it will be useful, 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.
Christian Krippendorf's avatar
Christian Krippendorf committed
10
 *
11 12 13
 * You should have received a copy of the GNU General Public License along with this program; if
 * not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301, USA. */
14

Frederik Schwarzer's avatar
Frederik Schwarzer committed
15 16 17
// Qt
#include <QApplication>
#include <QCommandLineParser>
18

Frederik Schwarzer's avatar
Frederik Schwarzer committed
19
// KDE
Raymond Wooninck's avatar
Raymond Wooninck committed
20
#include <KAboutData>
Frederik Schwarzer's avatar
Frederik Schwarzer committed
21
#include <KCrash>
Frederik Schwarzer's avatar
Frederik Schwarzer committed
22
#include <KDBusService>
Raymond Wooninck's avatar
Raymond Wooninck committed
23
#include <KLocalizedString>
24
#include <Kdelibs4ConfigMigrator>
Frederik Schwarzer's avatar
Frederik Schwarzer committed
25

Frederik Schwarzer's avatar
Frederik Schwarzer committed
26 27 28
// KMahjongg
#include "kmahjongg.h"
#include "version.h"
Raymond Wooninck's avatar
Raymond Wooninck committed
29

30
static const char description[] = I18N_NOOP("Mahjongg Solitaire by KDE");
31

32
int main(int argc, char ** argv)
33
{
34 35
    // Fixes blurry icons with fractional scaling
    QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
Laurent Montel's avatar
Laurent Montel committed
36 37
    QApplication app(argc, argv);

38
    KLocalizedString::setApplicationDomain("kmahjongg");
39 40 41
    KAboutData aboutData(QStringLiteral("kmahjongg"), i18n("KMahjongg"),
                         KMAHJONGG_VERSION, i18n(description), KAboutLicense::GPL,
                         i18n("(c) 1997, Mathias Mueller\n(c) 2006, Mauricio Piacentini\n(c) 2011, Christian Krippendorf"));
42
    aboutData.setHomepage(QStringLiteral("https://kde.org/applications/games/org.kde.kmahjongg"));
43 44
    aboutData.addAuthor(i18n("Mathias Mueller"), i18n("Original Author"), QStringLiteral("in5y158@public.uni-hamburg.de"));
    aboutData.addAuthor(i18n("Christian Krippendorf"), i18n("Current maintainer"), QStringLiteral("Coding@Christian-Krippendorf.de"));
45
    aboutData.addAuthor(i18n("Albert Astals Cid"), i18n("Bug fixes"), QStringLiteral("aacid@kde.org"));
46 47 48
    aboutData.addAuthor(i18n("David Black"), i18n("KDE 3 rewrite and Extension"), QStringLiteral("david.black@lutris.com"));
    aboutData.addAuthor(i18n("Michael Haertjens"), i18n("Solvable game generation\nbased on algorithm by Michael Meeks in GNOME mahjongg"), QStringLiteral("mhaertjens@modusoperandi.com"));
    aboutData.addCredit(i18n("Raquel Ravanini"), i18n("SVG Tileset for KDE4"), QStringLiteral("raquel@tabuleiro.com"));
49
    aboutData.addCredit(i18n("Richard Lohman"), i18n("Tile set contributor and current web page maintainer"), QStringLiteral("richardjlohman@yahoo.com"));
50 51
    aboutData.addCredit(i18n("Osvaldo Stark"), i18n("Tile set contributor and original web page maintainer"), QStringLiteral("starko@dnet.it"));
    aboutData.addCredit(i18n("Benjamin Meyer"), i18n("Code cleanup"), QStringLiteral("ben+kmahjongg@meyerhome.net"));
52

Raymond Wooninck's avatar
Raymond Wooninck committed
53 54
    QCommandLineParser parser;
    KAboutData::setApplicationData(aboutData);
Frederik Schwarzer's avatar
Frederik Schwarzer committed
55
    KCrash::initialize();
Raymond Wooninck's avatar
Raymond Wooninck committed
56 57 58
    aboutData.setupCommandLine(&parser);
    parser.process(app);
    aboutData.processCommandLine(&parser);
59

Raymond Wooninck's avatar
Raymond Wooninck committed
60
    // Migrate pre-existing (4.x) configuration
61
    Kdelibs4ConfigMigrator migrate(QStringLiteral("kmahjongg"));
Frederik Schwarzer's avatar
Frederik Schwarzer committed
62
    migrate.setConfigFiles(QStringList() << QStringLiteral("kmahjonggrc"));
63
    migrate.setUiFiles(QStringList() << QStringLiteral("kmahjonggui.rc"));
Raymond Wooninck's avatar
Raymond Wooninck committed
64 65
    migrate.migrate();

Laurent Montel's avatar
Laurent Montel committed
66
    KDBusService service;
67

Laurent Montel's avatar
Laurent Montel committed
68
    if (app.isSessionRestored()) {
69
        kRestoreMainWindows<KMahjongg>();
Laurent Montel's avatar
Laurent Montel committed
70
    } else {
71
        KMahjongg * window = new KMahjongg();
Laurent Montel's avatar
Laurent Montel committed
72 73 74
        window->show();
    }

Frederik Schwarzer's avatar
Frederik Schwarzer committed
75
    app.setWindowIcon(QIcon::fromTheme(QStringLiteral("kmahjongg")));
Frederik Schwarzer's avatar
Frederik Schwarzer committed
76

Raymond Wooninck's avatar
Raymond Wooninck committed
77
    return app.exec();
78
}