File indexing completed on 2024-10-06 06:47:16
0001 /* 0002 This file is part of the KDE games kwin4 program 0003 SPDX-FileCopyrightText: 1995-2007 Martin Heni <kde@heni-online.de> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 /** 0009 * \mainpage KWin4 API Documentation 0010 * 0011 * \section intro_sec Introduction 0012 * 0013 * This is the API documentation for the KDE game 'kwin4'. 0014 * 0015 * \section design_sec Design 0016 * 0017 * The design diagram shows the dependencies for the key classes of 0018 * the KWin4 program. 0019 * The coloring of the classes shows roughly their function in the 0020 * groups (program, document and engine, display, QGraphics and KGame library). 0021 * 0022 * \image html kwin4classes.png "Class diagram for KWin4" 0023 */ 0024 0025 // own 0026 #include "kfourinline_debug.h" 0027 #include "kfourinline_version.h" 0028 #include "kwin4.h" 0029 // KF 0030 #include <KAboutData> 0031 #include <KCrash> 0032 #include <KLocalizedString> 0033 // Qt 0034 #include <QApplication> 0035 #include <QCommandLineOption> 0036 #include <QCommandLineParser> 0037 0038 // Debug level for the program 0039 int global_debug = 0; 0040 // Skip intro 0041 bool global_skip_intro = false; 0042 // Demo (autoplay mode) 0043 bool global_demo_mode = false; 0044 0045 // Main function 0046 int main(int argc, char *argv[]) 0047 { 0048 global_debug = 0; 0049 0050 QApplication app(argc, argv); 0051 0052 KLocalizedString::setApplicationDomain("kfourinline"); 0053 KAboutData aboutData(QStringLiteral("kfourinline"), 0054 i18n("KFourInLine"), 0055 QStringLiteral(KFOURINLINE_VERSION_STRING), 0056 i18n("KFourInLine: Two player board game"), 0057 KAboutLicense::GPL, 0058 i18n("(c) 1995-2007, Martin Heni")); 0059 aboutData.addAuthor(i18n("Martin Heni"), i18n("Game design and code"), QStringLiteral("kde@heni-online.de")); 0060 aboutData.addAuthor(i18n("Johann Ollivier Lapeyre"), i18n("Graphics"), QStringLiteral("johann.ollivierlapeyre@gmail.com")); 0061 aboutData.addAuthor(i18n("Eugene Trounev"), i18n("Graphics"), QStringLiteral("eugene.trounev@gmail.com")); 0062 aboutData.addAuthor(i18n("Benjamin Meyer"), i18n("Code Improvements")); 0063 aboutData.setHomepage(QStringLiteral("https://apps.kde.org/kfourinline")); 0064 0065 KAboutData::setApplicationData(aboutData); 0066 0067 KCrash::initialize(); 0068 0069 QCommandLineParser parser; 0070 parser.addOption(QCommandLineOption({QStringLiteral("d"), QStringLiteral("debug")}, i18n("Enter debug level"), QStringLiteral("level"))); 0071 parser.addOption(QCommandLineOption({QStringLiteral("skipintro")}, i18n("Skip intro animation"))); 0072 parser.addOption(QCommandLineOption({QStringLiteral("demo")}, i18n("Run game in demo (autoplay) mode"))); 0073 0074 aboutData.setupCommandLine(&parser); 0075 parser.process(app); 0076 aboutData.processCommandLine(&parser); 0077 0078 app.setWindowIcon(QIcon::fromTheme(QStringLiteral("kfourinline"))); 0079 /* command line handling */ 0080 0081 // Check for debug command line option 0082 if (parser.isSet(QStringLiteral("debug"))) { 0083 global_debug = QString(parser.value(QStringLiteral("debug"))).toInt(); 0084 qCDebug(KFOURINLINE_LOG) << "Debug level set to" << global_debug; 0085 } 0086 // Check for debug command line option 0087 if (parser.isSet(QStringLiteral("skipintro"))) { 0088 global_skip_intro = true; 0089 qCDebug(KFOURINLINE_LOG) << "Skip intro cmd line chosen" << global_skip_intro; 0090 } 0091 // Check for debug command line option 0092 if (parser.isSet(QStringLiteral("demo"))) { 0093 global_demo_mode = true; 0094 qCDebug(KFOURINLINE_LOG) << "Running in demo mode" << global_demo_mode; 0095 } 0096 0097 // Start application 0098 // Start session 0099 if (app.isSessionRestored()) { 0100 kRestoreMainWindows<KWin4App>(); 0101 } else { 0102 KWin4App *kwin4 = new KWin4App(); 0103 kwin4->show(); 0104 } 0105 0106 return app.exec(); 0107 }