main.cpp 5.13 KB
Newer Older
Anne-Marie Mahfouf's avatar
Anne-Marie Mahfouf committed
1
/***************************************************************************
2
3
 *   Copyright (C) 2001-2011 by Anne-Marie Mahfouf                              *
 *   annma@kde.org                                             *
Anne-Marie Mahfouf's avatar
Anne-Marie Mahfouf committed
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 *   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.                          *
 *                                                                         *
 *   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.,                                       *
Dirk Mueller's avatar
Dirk Mueller committed
18
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.             *
Anne-Marie Mahfouf's avatar
Anne-Marie Mahfouf committed
19
20
 ***************************************************************************/

Anne-Marie Mahfouf's avatar
Anne-Marie Mahfouf committed
21
22
23
/*****************************************************/
/* Please save with utf8 encoding, thanks  */
/*****************************************************/
24
#include <QApplication>
Laurent Navet's avatar
Laurent Navet committed
25
#include <QCommandLineParser>
26
27

#include <KLocalizedString>
28
#include <Kdelibs4ConfigMigrator>
Andreas Cord-Landwehr's avatar
Andreas Cord-Landwehr committed
29
#include <KCrash>
30
#include <KAboutData>
31
#include "klettres.h"
32
#include "klettres_version.h"
33

34
static const char description[] =
35
36
    I18N_NOOP("KLettres helps a very young child or an adult learning \n"
              "a new language by associating sounds and \n"
37
              "letters in this language.\n\n"
38
              "25 languages are available.");
Anne-Marie Mahfouf's avatar
Anne-Marie Mahfouf committed
39

40
int main(int argc, char **argv)
41
{
Laurent Montel's avatar
Laurent Montel committed
42
    QApplication app(argc, argv);
43
44
    app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);

45
46
    KLocalizedString::setApplicationDomain("klettres");

47
    QStringList configFiles;
48
    QStringList rcFiles;
49
50
51
    configFiles << QStringLiteral("klettresrc");
    rcFiles << QStringLiteral("klettresui.rc");
    Kdelibs4ConfigMigrator migrator(QStringLiteral("klettres"));
52
    migrator.setConfigFiles(configFiles);
53
    migrator.setUiFiles(rcFiles);
54
55
    migrator.migrate();

56
    KAboutData about(QStringLiteral("klettres"), i18n("KLettres"), QStringLiteral(KLETTRES_VERSION_STRING), i18n(description),
57
58
                     KAboutLicense::GPL, i18n("(C) 2001-2011 Anne-Marie Mahfouf"),QString(), QStringLiteral("https://edu.kde.org/klettres"), QStringLiteral("submit@bugs.kde.org"));
    about.addAuthor( i18n("Anne-Marie Mahfouf"), QString(), QStringLiteral("annma AT kde DOT org"), QStringLiteral("https://annma.blogspot.com"), QStringLiteral("annma"));
59
    about.addCredit(i18n("Marc Cheng"),
60
                    i18n("Kids and grown-up oxygen icons"), QStringLiteral("bdgraue AT web DOT de"));
61
    about.addCredit(i18n("Danny Allen"),
62
                    i18n("SVG background pictures"), QStringLiteral("dannya40uk AT yahoo DOT co DOT uk"));
63
    about.addCredit(i18n("Robert Gogolok"),
64
                    i18n("Support and coding guidance"), QStringLiteral("mail AT robert-gogolok DOT de"));
65
    about.addCredit(i18n("Peter Hedlund"),
66
                    i18n("Code for generating special characters' icons"), QStringLiteral("peter DOT hedlund AT kdemail DOT net"));
67
    about.addCredit(i18n("Waldo Bastian"),
68
                    i18n("Port to KConfig XT, coding help"), QStringLiteral("bastian AT kde DOT org"));
69
    about.addCredit(i18n("Pino Toscano"),
70
                    i18n("Code cleaning, Theme class"), QStringLiteral("toscano DOT pino AT tiscali DOT it"));
71
    about.addCredit(i18n("Michael Goettsche"),
72
                    i18n("Timer setting widgets"), QStringLiteral("michael.goettsche AT kdemail DOT net"));
Laurent Navet's avatar
Laurent Navet committed
73
    about.addCredit(i18n("Laurent Navet"),
74
                    i18n("Port to KDE Frameworks 5"), QStringLiteral("laurent DOT navet+klettres AT gmail DOT com"));
75
76
77
78
79
    QCommandLineParser parser;
    KAboutData::setApplicationData(about);
    about.setupCommandLine(&parser);
    parser.process(app);
    about.processCommandLine(&parser);
80

81
    app.setApplicationName(QStringLiteral("klettres"));
82
    app.setApplicationVersion(QStringLiteral(KLETTRES_VERSION_STRING));
83
    app.setOrganizationDomain(QStringLiteral("kde.org"));
84

Andreas Cord-Landwehr's avatar
Andreas Cord-Landwehr committed
85
86
    KCrash::initialize();

87
    // see if we are starting with session management
Anne-Marie Mahfouf's avatar
Anne-Marie Mahfouf committed
88
    if (app.isSessionRestored()) {
89
        kRestoreMainWindows<KLettres>();
Anne-Marie Mahfouf's avatar
Anne-Marie Mahfouf committed
90
91
    } else {
        // no session.. just start up normally
Laurent Montel's avatar
Laurent Montel committed
92
        if (parser.positionalArguments().isEmpty()) {
Anne-Marie Mahfouf's avatar
Anne-Marie Mahfouf committed
93
94
95
96
            KLettres *widget = new KLettres;
            widget->show();
        } else {
            int i = 0;
97
            for (; i < parser.positionalArguments().count(); i++) {
98
99
100
101
                KLettres *widget = new KLettres;
                widget->show();
            }
        }
Anne-Marie Mahfouf's avatar
Anne-Marie Mahfouf committed
102
    }
103

104
    return app.exec();
105
}
Anne-Marie Mahfouf's avatar
Anne-Marie Mahfouf committed
106