File indexing completed on 2024-04-21 04:02:13

0001 /*
0002     SPDX-FileCopyrightText: 2008-2009 Stefan Majewsky <majewsky@gmx.net>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "mainwindow.h"
0008 #include "settings.h"
0009 #include "kdiamond_version.h"
0010 
0011 #include <ctime>
0012 
0013 #include <KAboutData>
0014 #include <KCrash>
0015 #include <KLocalizedString>
0016 #include <KGameDifficulty>
0017 #include <KDBusService>
0018 
0019 #include <QApplication>
0020 #include <QCommandLineParser>
0021 #include <QStandardPaths>
0022 
0023 int main(int argc, char **argv)
0024 {
0025     QApplication app(argc, argv);
0026 
0027     KLocalizedString::setApplicationDomain(QByteArrayLiteral("kdiamond"));
0028 
0029     KAboutData about(QStringLiteral("kdiamond"), i18nc("The application's name", "KDiamond"),
0030                      QStringLiteral(KDIAMOND_VERSION_STRING),
0031                      i18n("KDiamond, a three-in-a-row game."),
0032                      KAboutLicense::GPL, i18n("(C) 2008-2010 Stefan Majewsky and others"),
0033                      QString(),
0034                      QStringLiteral("https://apps.kde.org/kdiamond"));
0035     about.addAuthor(i18n("Stefan Majewsky"), i18n("Original author and current maintainer"), QStringLiteral("majewsky@gmx.net"));
0036     about.addAuthor(i18n("Paul Bunbury"), i18n("Gameplay refinement"), QStringLiteral("happysmileman@googlemail.com"));
0037     about.addCredit(i18n("Eugene Trounev"), i18n("Default theme"), QStringLiteral("eugene.trounev@gmail.com"));
0038     about.addCredit(i18n("Felix Lemke"), i18n("Classic theme"), QStringLiteral("lemke.felix@ages-skripte.org"));
0039     about.addCredit(i18n("Jeffrey Kelling"), i18n("Technical consultant"), QStringLiteral("kelling.jeffrey@ages-skripte.org"));
0040 
0041     KAboutData::setApplicationData(about);
0042     app.setWindowIcon(QIcon::fromTheme(QStringLiteral("kdiamond")));
0043 
0044     KCrash::initialize();
0045 
0046     QCommandLineParser parser;
0047     about.setupCommandLine(&parser);
0048     parser.process(app);
0049     about.processCommandLine(&parser);
0050 
0051     //resource directory for KNewStuff2 (this call causes the directory to be created; its existence is necessary for the downloader)
0052     QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QLatin1String("/themes/");
0053 
0054     KGameDifficulty::global()->addStandardLevelRange(
0055         KGameDifficultyLevel::VeryEasy,
0056         KGameDifficultyLevel::VeryHard
0057     );
0058     KDBusService service;
0059     // see if we are starting with session management
0060     if (app.isSessionRestored()) {
0061         kRestoreMainWindows<MainWindow>();
0062     } else {
0063         MainWindow *window = new MainWindow;
0064         window->show();
0065     }
0066     return app.exec();
0067 }