File indexing completed on 2024-05-05 04:02:56

0001 /*
0002     SPDX-FileCopyrightText: 2010 Ni Hui <shuizhuyuanluo@126.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "mainwindow.h"
0008 #include "settings.h"
0009 #include "klickety_version.h"
0010 
0011 #include <KAboutData>
0012 #include <KCrash>
0013 #include <KDBusService>
0014 #include <KLocalizedString>
0015 
0016 #include <QApplication>
0017 #include <QCommandLineParser>
0018 #include <QCommandLineOption>
0019 
0020 int main( int argc, char* argv[] )
0021 {
0022     QApplication app( argc, argv );
0023     app.setWindowIcon(QIcon::fromTheme(QStringLiteral( "klickety" )));
0024 
0025     KLocalizedString::setApplicationDomain(QByteArrayLiteral("klickety"));
0026 
0027     KAboutData aboutData( QStringLiteral( "klickety" ), i18n( "Klickety" ), QStringLiteral( KLICKETY_VERSION_STRING ),
0028                           i18n( "Klickety is an adaptation of the \"clickomania\" game" ),
0029                           KAboutLicense::GPL,
0030                           i18n( "(c) 2002-2005, Nicolas Hadacek\n(c) 2010, Ni Hui" ),
0031                           QString(),
0032                           QStringLiteral("https://apps.kde.org/klickety"));
0033 
0034     KAboutData::setApplicationData( aboutData );
0035 
0036     KCrash::initialize();
0037 
0038     QCommandLineParser parser;
0039     parser.addOption( QCommandLineOption({QStringLiteral("KSameMode")}, i18n("Start with KSame compatibility mode")));
0040 
0041     aboutData.setupCommandLine( &parser );
0042     parser.process( app );
0043     aboutData.processCommandLine( &parser );
0044 
0045     bool kSameMode = parser.isSet( QStringLiteral("KSameMode") );
0046 
0047     // we use different file for storing ksame mode configuration
0048     if ( kSameMode ) {
0049         Settings::instance( QStringLiteral( "ksamerc" ) );
0050         aboutData.setShortDescription( i18n( "A little game about balls and how to get rid of them" ) );
0051         aboutData.addAuthor( i18n( "Marcus Kreutzberger"), i18n( "Original author" ), QStringLiteral("kreutzbe@informatik.mu-luebeck.de") );
0052         aboutData.addAuthor( i18n( "Henrique Pinto"), i18n( "Past maintainer" ), QStringLiteral("henrique.pinto@kdemail.net") );
0053         aboutData.addAuthor( i18n( "Ni Hui" ), i18n( "Integration with Klickety. Current maintainer" ), QStringLiteral("shuizhuyuanluo@126.com") );
0054         aboutData.addCredit( i18n( "Johann Ollivier Lapeyre"), i18n("Artwork"), QStringLiteral("johann.ollivierlapeyre@gmail.com") );
0055     }
0056     else {
0057         Settings::instance( QStringLiteral( "klicketyrc" ) );
0058         aboutData.addAuthor( i18n( "Nicolas Hadacek" ), i18n( "Original author" ), QStringLiteral("hadacek@kde.org") );
0059         aboutData.addAuthor( i18n( "Ni Hui" ), i18n( "Rewrite for KDE4. Current maintainer" ), QStringLiteral("shuizhuyuanluo@126.com") );
0060         aboutData.addCredit( i18n( "Dan Hill" ), i18n( "Icons" ) );
0061     }
0062 
0063     // see if we are starting with session management
0064     if ( app.isSessionRestored() ) {
0065         kRestoreMainWindows<MainWindow>();
0066     }
0067     else {
0068         MainWindow* window = new MainWindow( kSameMode );
0069         window->show();
0070     }
0071 
0072     KDBusService service;
0073 
0074     return app.exec();
0075 }