main.cpp 3.33 KB
Newer Older
1
/*
2
 * Copyright (c) 1996-2004 Nicolas HADACEK <hadacek@kde.org>
3
 *
4 5 6 7 8
 * This program 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.

9 10
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 12 13 14 15
 * 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
 * along with this program; if not, write to the Free Software
Dirk Mueller's avatar
Dirk Mueller committed
16
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17 18
 */

19
#include <kaboutdata.h>
Frederik Schwarzer's avatar
Frederik Schwarzer committed
20
#include <KCrash>
Laurent Montel's avatar
Laurent Montel committed
21
#include <kdelibs4configmigrator.h>
22 23 24
#include <klocalizedstring.h>

#include <QApplication>
Laurent Montel's avatar
Laurent Montel committed
25
#include <QCommandLineParser>
Laurent Montel's avatar
Laurent Montel committed
26
#include <KDBusService>
27
#include <KSharedConfig>
Nicolas Hadacek's avatar
Nicolas Hadacek committed
28
#include "version.h"
29
#include "mainwindow.h"
Nicolas Hadacek's avatar
Nicolas Hadacek committed
30

31

Nicolas Hadacek's avatar
Nicolas Hadacek committed
32
static const char *DESCRIPTION
33
    = I18N_NOOP("KMines is a classic minesweeper game");
34

Nicolas Hadacek's avatar
Nicolas Hadacek committed
35
int main(int argc, char **argv)
36
{
37 38
    // Fixes blurry icons with fractional scaling
    QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
39 40
    QApplication app(argc, argv);

41 42 43
    Kdelibs4ConfigMigrator migrate(QStringLiteral("kmines"));
    migrate.setConfigFiles(QStringList() << QStringLiteral("kminesrc"));
    migrate.setUiFiles(QStringList() << QStringLiteral("kminesui.rc"));
44 45 46 47 48
    if(migrate.migrate())
    {
        // update the configuration cache
        KSharedConfig::openConfig()->reparseConfiguration();
    }
Laurent Montel's avatar
Laurent Montel committed
49
    KLocalizedString::setApplicationDomain("kmines");
Laurent Montel's avatar
Laurent Montel committed
50

51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
    KAboutData aboutData(QStringLiteral("kmines"), i18n("KMines"), QStringLiteral(LONG_VERSION),
						 i18n(DESCRIPTION), KAboutLicense::GPL,
						 i18n(COPYLEFT), QString(), QStringLiteral(HOMEPAGE));
    aboutData.addAuthor(i18n("Nicolas Hadacek"),
                        i18n("Original author"), QStringLiteral("hadacek@kde.org"));
    aboutData.addAuthor(i18n("Mauricio Piacentini"),
                        i18n("Code refactoring and SVG support. Current maintainer"),
                        QStringLiteral("mauricio@tabuleiro.com"));
    aboutData.addAuthor(i18n("Dmitry Suzdalev"),
                        i18n("Rewrite to use QGraphicsView framework. Current maintainer"),
                        QStringLiteral("dimsuz@gmail.com"));
    aboutData.addCredit(i18n("Andreas Zehender"), i18n("Smiley pixmaps"));
    aboutData.addCredit(i18n("Mikhail Kourinny"), i18n("Solver/Adviser"));
    aboutData.addCredit(i18n("Thomas Capricelli"), i18n("Magic reveal mode"));
    aboutData.addCredit(i18n("Brian Croom"), i18n("Port to use KGameRenderer"));
    
Anuj Pahuja's avatar
Anuj Pahuja committed
67 68
    aboutData.setOrganizationDomain(QByteArray("kde.org"));
    aboutData.setProductName(QByteArray("kmines"));
69
    app.setWindowIcon(QIcon::fromTheme(QStringLiteral("kmines")));
Anuj Pahuja's avatar
Anuj Pahuja committed
70
    KAboutData::setApplicationData(aboutData);
Frederik Schwarzer's avatar
Frederik Schwarzer committed
71
    KCrash::initialize();
Laurent Montel's avatar
Laurent Montel committed
72 73 74 75
    QCommandLineParser parser;
    aboutData.setupCommandLine(&parser);
    parser.process(app);
    aboutData.processCommandLine(&parser);
Laurent Montel's avatar
Laurent Montel committed
76
    KDBusService service; 
Anuj Pahuja's avatar
Anuj Pahuja committed
77
    
Anuj Pahuja's avatar
Anuj Pahuja committed
78
    if ( app.isSessionRestored() )
79
        kRestoreMainWindows<KMinesMainWindow>();
Nicolas Hadacek's avatar
Nicolas Hadacek committed
80
    else {
81
        KMinesMainWindow *mw = new KMinesMainWindow;
Nicolas Hadacek's avatar
Nicolas Hadacek committed
82 83
        mw->show();
    }
84
    
Anuj Pahuja's avatar
Anuj Pahuja committed
85
    return app.exec();
86
}