File indexing completed on 2023-09-24 08:17:46
0001 /* 0002 This file is part of the KDE games lskat program 0003 SPDX-FileCopyrightText: 2006 Martin Heni <kde@heni-online.de> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 0007 Lskat 0008 ----- 0009 begin : March 2000 0010 copyright : (C) 1995-2007 by Martin Heni 0011 email : kde@heni-online.de 0012 */ 0013 0014 /** 0015 * \mainpage LSkat API Documentation 0016 * 0017 * \section intro_sec Introduction 0018 * 0019 * This is the API documentation for the KDE game 'lskat'. 0020 * 0021 * \section design_sec Design 0022 * 0023 * The design diagram shows the dependencies for the key classes of 0024 * the Lskat program. 0025 * The coloring of the classes shows roughly their function in the 0026 * groups (program, document and engine, display, QGraphics). 0027 * 0028 * \image html lskatclasses.png "Class diagram for LSkat" 0029 */ 0030 0031 0032 0033 #include "lskat_debug.h" 0034 #include "lskat_version.h" 0035 #include "lskatglobal.h" 0036 #include "mainwindow.h" 0037 0038 #include <KAboutData> 0039 #include <KCrash> 0040 #include <KLocalizedString> 0041 0042 #include <QApplication> 0043 #include <QCommandLineParser> 0044 #include <QCommandLineOption> 0045 0046 0047 // Debug level for the program 0048 int global_debug = 0; 0049 // Skip intro 0050 bool global_skip_intro = false; 0051 // Demo (autoplay mode) 0052 bool global_demo_mode = false; 0053 0054 int main(int argc, char *argv[]) 0055 { 0056 global_debug = 0; 0057 // Fixes blurry icons with fractional scaling 0058 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) 0059 QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); 0060 #endif 0061 QApplication application(argc, argv); 0062 KLocalizedString::setApplicationDomain("lskat"); 0063 0064 KAboutData aboutData(QStringLiteral("lskat"), i18n("LSkat"), 0065 QStringLiteral(LSKAT_VERSION_STRING), 0066 i18n("LSkat: A desktop card game"), 0067 KAboutLicense::GPL, 0068 i18n("(c) 1995-2007, Martin Heni"), 0069 QString(), 0070 QStringLiteral("https://apps.kde.org/lskat")); 0071 0072 // I18N: These are the same strings as in kwin4, you can copy the translations 0073 aboutData.addAuthor(i18n("Martin Heni"), i18n("Game design and code"), QStringLiteral("kde@heni-online.de")); 0074 aboutData.addAuthor(i18n("Eugene Trounev"), i18n("Graphics"), QStringLiteral("eugene.trounev@gmail.com")); 0075 // end I18N 0076 aboutData.addAuthor(i18n("Benjamin Meyer"), i18n("Code Improvements")); 0077 // 'Thanks to' aboutData.addCredit(i18n("KDE"), i18n("KDE")); 0078 0079 QCommandLineParser parser; 0080 KAboutData::setApplicationData(aboutData); 0081 0082 parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("d") << QStringLiteral("debug"), i18n("Enter debug level"), QStringLiteral("level"))); 0083 parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("skipintro"), i18n("Skip intro animation"))); 0084 parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("demo"), i18n("Run game in demo (autoplay) mode"))); 0085 0086 aboutData.setupCommandLine(&parser); 0087 parser.process(application); 0088 aboutData.processCommandLine(&parser); 0089 0090 /* command line handling */ 0091 0092 KCrash::initialize(); 0093 0094 // Check for debug command line option 0095 if (parser.isSet(QStringLiteral("debug"))) 0096 { 0097 global_debug = QString(parser.value(QStringLiteral("debug"))).toInt(); 0098 qCDebug(LSKAT_LOG) << "Debug level set to" << global_debug; 0099 } 0100 // Check for debug command line option 0101 if (parser.isSet(QStringLiteral("skipintro"))) 0102 { 0103 global_skip_intro = true; 0104 qCDebug(LSKAT_LOG) << "Skip intro cmd line chosen" << global_skip_intro; 0105 } 0106 // Check for debug command line option 0107 if (parser.isSet(QStringLiteral("demo"))) 0108 { 0109 global_demo_mode = true; 0110 qCDebug(LSKAT_LOG) << "Running in demo mode" << global_demo_mode; 0111 } 0112 0113 if (application.isSessionRestored()) 0114 { 0115 kRestoreMainWindows<Mainwindow>(); 0116 } 0117 else 0118 { 0119 Mainwindow *mainwindow = new Mainwindow(); 0120 mainwindow->show(); 0121 } 0122 0123 application.setWindowIcon(QIcon::fromTheme(QStringLiteral("lskat"))); 0124 0125 return application.exec(); 0126 }