File indexing completed on 2024-04-21 04:05:04

0001 /***************************************************************************
0002  *   Copyright 2005-2007 Francesco Rossi <redsh@email.it>                  *
0003  *   Copyright 2006-2007 Mick Kappenburg <ksudoku@kappendburg.net>         *
0004  *   Copyright 2006-2007 Johannes Bergmeier <johannes.bergmeier@gmx.net>   *
0005  *   Copyright 2015      Ian Wadham <iandw.au@gmail.com>                   *
0006  *                                                                         *
0007  *   This program is free software; you can redistribute it and/or modify  *
0008  *   it under the terms of the GNU General Public License as published by  *
0009  *   the Free Software Foundation; either version 2 of the License, or     *
0010  *   (at your option) any later version.                                   *
0011  *                                                                         *
0012  *   This program is distributed in the hope that it will be useful,       *
0013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0015  *   GNU General Public License for more details.                          *
0016  *                                                                         *
0017  *   You should have received a copy of the GNU General Public License     *
0018  *   along with this program; if not, write to the                         *
0019  *   Free Software Foundation, Inc.,                                       *
0020  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
0021  ***************************************************************************/
0022 
0023 #include "ksudoku.h"
0024 #include "ksudoku_version.h"
0025 
0026 #include <KAboutData>
0027 #include <KDBusService>
0028 #include <KCrash>
0029 #include <KLocalizedString>
0030 #include <KConfigDialogManager>
0031 
0032 #include <QApplication>
0033 #include <QCommandLineParser>
0034 #include <QDir>
0035 #include <QUrl>
0036 
0037 #include <cstdlib>
0038 
0039 
0040 int main(int argc, char **argv)
0041 {
0042     QApplication app(argc, argv);
0043 
0044     KLocalizedString::setApplicationDomain(QByteArrayLiteral("ksudoku"));
0045 
0046     KAboutData about(QStringLiteral("ksudoku"),
0047                      i18n("KSudoku"),
0048                      QLatin1String(KSUDOKU_VERSION_STRING),
0049                      i18n("KSudoku - Sudokus and more"),
0050                      KAboutLicense::GPL_V2,
0051                      i18n("(c) 2005-2007 The KSudoku Authors"),
0052                      QString(), QStringLiteral("https://apps.kde.org/ksudoku"));
0053     about.addAuthor( i18n("Francesco Rossi"), i18n("KSudoku Author"), QStringLiteral("redsh@email.it") );
0054     about.addAuthor( i18n("Johannes Bergmeier"), i18n("Maintainer"), QStringLiteral("Johannes.Bergmeier@gmx.net") );
0055     about.addAuthor( i18n("Ian Wadham"), i18n("New puzzle generator and solver"), QStringLiteral("iandw.au@gmail.com") );
0056     about.addAuthor( i18n("Mick Kappenburg"), i18n("Printing and export of 0.4"), QStringLiteral("ksudoku@kappendburg.net"));
0057     about.addAuthor( i18n("Thanks to NeHe for OpenGL tutorials"), QString(), QStringLiteral("nehe.gamedev.net"));
0058     about.addCredit( i18n("David Bau"), i18n("Algorithms for new puzzle generator and solver at davidbau.com/archives/2006/09/04/sudoku_generator.html"), QLatin1String(""));
0059 
0060     KAboutData::setApplicationData(about);
0061     app.setOrganizationDomain(QStringLiteral("kde.org"));
0062     app.setWindowIcon(QIcon::fromTheme(QStringLiteral("ksudoku")));
0063 
0064     QCommandLineParser parser;
0065     about.setupCommandLine(&parser);
0066     parser.addPositionalArgument(QStringLiteral("[URL]"), i18n( "Document to open" ));
0067 
0068     parser.process(app);
0069     about.processCommandLine(&parser);
0070 
0071     KCrash::initialize();
0072 
0073     KDBusService service;
0074 
0075     // see if we are starting with session management
0076     /*if (app.isRestored())
0077     {
0078             RESTORE(KSudoku);
0079     }
0080     else
0081     {*/
0082         auto *widget = new KSudoku;
0083         widget->show();
0084 
0085         // no session.. just start up normally
0086         if (parser.positionalArguments().count() != 0)
0087         {
0088             for (int i = 0; i < parser.positionalArguments().count(); ++i)
0089             {
0090                 widget->loadGame(QUrl::fromUserInput(parser.positionalArguments().at(i), QDir::currentPath()));
0091             }
0092         }
0093 
0094     //} //TODO PORT
0095 
0096     return app.exec();
0097 }