main.cc 2.69 KB
Newer Older
1
2
/*******************************************************************
*
Frederik Schwarzer's avatar
Frederik Schwarzer committed
3
* Copyright 2007  Aron Boström <c02ab@efd.lth.se>
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
*
* Bovo 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, or (at your option)
* any later version.
*
* Bovo 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.
*
* You should have received a copy of the GNU General Public License
* along with Bovo; see the file COPYING.  If not, write to
* the Free Software Foundation, 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
Aron Boström's avatar
Aron Boström committed
20
********************************************************************/
21

22
#include <QApplication>
Laurent Montel's avatar
Laurent Montel committed
23
#include <QCommandLineParser>
24
#include <kaboutdata.h>
Laurent Montel's avatar
Laurent Montel committed
25
#include <kdelibs4configmigrator.h>
26
#include <klocalizedstring.h>
Laurent Montel's avatar
Dbus    
Laurent Montel committed
27
#include <KDBusService>
28
#include <KCrash>
29
30

#include "mainwindow.h"
31
#include "bovo_version.h"
32
33

static const char description[] = I18N_NOOP("KDE Five in a Row Board Game");
Sandro Andrade's avatar
Sandro Andrade committed
34
static const char copyleft[] = I18N_NOOP("(c) 2002-2007, Aron Boström");
35
36
37

using namespace gui;

38
int main(int argc, char **argv) {
Laurent Montel's avatar
Laurent Montel committed
39

40
41
    // Fixes blurry icons with fractional scaling
    QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
Laurent Montel's avatar
Laurent Montel committed
42
    QApplication app(argc, argv);
Laurent Montel's avatar
Laurent Montel committed
43
44
45
46
    Kdelibs4ConfigMigrator migrate(QStringLiteral("bovo"));
    migrate.setConfigFiles(QStringList() << QStringLiteral("bovorc"));
    migrate.setUiFiles(QStringList() << QStringLiteral("bovoui.rc"));
    migrate.migrate();
47

Sandro Andrade's avatar
Sandro Andrade committed
48
    KLocalizedString::setApplicationDomain("bovo");
49

Sandro Andrade's avatar
Sandro Andrade committed
50
    KAboutData aboutData(QStringLiteral("bovo"), i18n("Bovo"),
51
            QStringLiteral(BOVO_VERSION_STRING), i18n(description), KAboutLicense::GPL,
52
            i18n(copyleft), QString(), QStringLiteral("https://kde.org/applications/games/org.kde.bovo"));
Sandro Andrade's avatar
Sandro Andrade committed
53
    aboutData.addAuthor(i18n("Aron Boström"),i18n("Author"),
54
                        QStringLiteral("aron.bostrom@gmail.com"));
55

Sandro Andrade's avatar
Sandro Andrade committed
56
    aboutData.setOrganizationDomain(QByteArray("kde.org"));
Laurent Montel's avatar
Laurent Montel committed
57
    app.setWindowIcon(QIcon::fromTheme(QStringLiteral("bovo")));
Sandro Andrade's avatar
Sandro Andrade committed
58
    aboutData.setProductName(QByteArray("bovo"));
Frederik Schwarzer's avatar
Frederik Schwarzer committed
59

Sandro Andrade's avatar
Sandro Andrade committed
60
    KAboutData::setApplicationData(aboutData);
61
    KCrash::initialize();
Laurent Montel's avatar
Laurent Montel committed
62
63
64
65
66

    QCommandLineParser parser;
    aboutData.setupCommandLine(&parser);
    parser.process(app);
    aboutData.processCommandLine(&parser);
Frederik Schwarzer's avatar
Frederik Schwarzer committed
67
    KDBusService service;
Sandro Andrade's avatar
Sandro Andrade committed
68
    if( app.isSessionRestored() ) {
69
        kRestoreMainWindows<MainWindow>();
Aron Boström's avatar
Aron Boström committed
70
    } else {
71
        MainWindow *mainWin = new MainWindow();
72
73
74
        mainWin->show();
    }

Sandro Andrade's avatar
Sandro Andrade committed
75
    return app.exec();
76
}