File indexing completed on 2022-11-29 18:12:06

0001 /*
0002     KBruch.cpp  -  Main File of KBruch
0003     SPDX-FileCopyrightText: 2001 Sebastian Stein <seb.kde@hpfsc.de>
0004     SPDX-FileCopyrightText: 2008 Tiago Porangaba <tiago.porangaba@ltia.fc.unesp.br>
0005     SPDX-FileCopyrightText: 2008 Tadeu Araujo <tadeu.araujo@ltia.fc.unesp.br>
0006     SPDX-FileCopyrightText: 2008 Danilo Balzaque <danilo.balzaque@ltia.fc.unesp.br>
0007 
0008     SPDX-License-Identifier: GPL-2.0-or-later
0009 */
0010 
0011 #include "KBruch.h"
0012 
0013 #include "kbruch_version.h"
0014 
0015 /* standard C++ library includes */
0016 #include <ctime>
0017 
0018 /* these includes are needed for KDE support */
0019 #include <KAboutData>
0020 #include <KCrash>
0021 #include <KLocalizedString>
0022 
0023 /* these includes are needed for Qt support */
0024 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
0025 #include <Kdelibs4ConfigMigrator>
0026 #endif
0027 #include <QApplication>
0028 #include <QCommandLineParser>
0029 #include <QObject>
0030 
0031 /* the main program */
0032 int main(int argc, char * argv[])
0033 {
0034 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
0035     QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
0036 #endif
0037     QApplication app(argc, argv);
0038 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
0039     app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
0040 #endif
0041     KLocalizedString::setApplicationDomain("kbruch");
0042 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
0043     Kdelibs4ConfigMigrator migrate(QStringLiteral("kbruch"));
0044     migrate.setConfigFiles(QStringList() << QStringLiteral("kbruchrc"));
0045     migrate.setUiFiles(QStringList() << QStringLiteral("AppMenuWidgetui.rc") <<  QStringLiteral("FractionRingWidgetui.rc") << QStringLiteral("kbruchui.rc"));
0046     migrate.migrate();
0047 #endif
0048 
0049 
0050     /* fill the about data; the common KDE about dialog will show it to the
0051      * user */
0052     KAboutData aboutData(QStringLiteral("kbruch"), i18n("KBruch"),
0053                          QStringLiteral(KBRUCH_VERSION_STRING),
0054                          i18n("Learn calculating with fractions"),
0055                          KAboutLicense::GPL,
0056                          i18n("© 2002-2011, Sebastian Stein"));
0057     aboutData.addAuthor(i18n("Sebastian Stein"), i18n("Current maintainer, original author"), QStringLiteral("seb.kde@hpfsc.de"));
0058     aboutData.addAuthor(i18n("Paulo Cattai"), i18n("New interface design and usability improvements"), QStringLiteral("paulo.cattai@ltia.fc.unesp.br"));
0059     aboutData.addAuthor(i18n("Danilo Balzaque"), i18n("New interface design and usability improvements"), QStringLiteral("danilo.balzaque@ltia.fc.unesp.br"));
0060     aboutData.addAuthor(i18n("Roberto Cunha"), i18n("New interface design and usability improvements"), QStringLiteral("roberto.cunha@ltia.fc.unesp.br"));
0061     aboutData.addAuthor(i18n("Tadeu Araujo"), i18n("New interface design and usability improvements"), QStringLiteral("tadeu.araujo@ltia.fc.unesp.br"));
0062     aboutData.addAuthor(i18n("Tiago Porangaba"), i18n("New interface design and usability improvements"), QStringLiteral("tiago.porangaba@ltia.fc.unesp.br"));
0063     aboutData.setHomepage(QStringLiteral("https://edu.kde.org/kbruch/"));
0064 
0065     KCrash::initialize();
0066 
0067     QCommandLineParser parser;
0068     KAboutData::setApplicationData(aboutData);
0069     aboutData.setupCommandLine(&parser);
0070     parser.process(app);
0071     aboutData.processCommandLine(&parser);
0072 
0073     QObject::connect(&app, &QApplication::lastWindowClosed, &app, &QApplication::quit);
0074 
0075     AppMenuWidget * kbruchApp = new AppMenuWidget();
0076     kbruchApp->show();
0077 
0078     /* lets execute the Qt GUI; it will handle all cmd options which are left */
0079     return app.exec();
0080 }