File indexing completed on 2024-05-19 07:54:44

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 <KCrash>
0028 #include <KLocalizedString>
0029 #include <KConfigDialogManager>
0030 
0031 #include <QApplication>
0032 #include <QCommandLineParser>
0033 #include <QDir>
0034 #include <QUrl>
0035 
0036 #include <cstdlib>
0037 
0038 
0039 int main(int argc, char **argv)
0040 {
0041     QApplication app(argc, argv);
0042     KLocalizedString::setApplicationDomain("ksudoku");
0043 
0044     KAboutData about(QStringLiteral("ksudoku"),
0045                      i18n("KSudoku"),
0046                      QLatin1String(KSUDOKU_VERSION_STRING),
0047                      i18n("KSudoku - Sudokus and more"),
0048                      KAboutLicense::GPL_V2,
0049                      i18n("(c) 2005-2007 The KSudoku Authors"),
0050                      QString(), QStringLiteral("https://apps.kde.org/ksudoku"));
0051     about.addAuthor( i18n("Francesco Rossi"), i18n("KSudoku Author"), QStringLiteral("redsh@email.it") );
0052     about.addAuthor( i18n("Johannes Bergmeier"), i18n("Maintainer"), QStringLiteral("Johannes.Bergmeier@gmx.net") );
0053     about.addAuthor( i18n("Ian Wadham"), i18n("New puzzle generator and solver"), QStringLiteral("iandw.au@gmail.com") );
0054     about.addAuthor( i18n("Mick Kappenburg"), i18n("Printing and export of 0.4"), QStringLiteral("ksudoku@kappendburg.net"));
0055     about.addAuthor( i18n("Thanks to NeHe for OpenGL tutorials"), QString(), QStringLiteral("nehe.gamedev.net"));
0056     about.addCredit( i18n("David Bau"), i18n("Algorithms for new puzzle generator and solver at davidbau.com/archives/2006/09/04/sudoku_generator.html"), QLatin1String(""));
0057 
0058     KAboutData::setApplicationData(about);
0059     app.setOrganizationDomain(QStringLiteral("kde.org"));
0060     app.setWindowIcon(QIcon::fromTheme(QStringLiteral("ksudoku")));
0061 
0062     QCommandLineParser parser;
0063     about.setupCommandLine(&parser);
0064     parser.addPositionalArgument(QStringLiteral("[URL]"), i18n( "Document to open" ));
0065 
0066     parser.process(app);
0067     about.processCommandLine(&parser);
0068 
0069     KCrash::initialize();
0070 
0071     // see if we are starting with session management
0072     /*if (app.isRestored())
0073     {
0074             RESTORE(KSudoku);
0075     }
0076     else
0077     {*/
0078         auto *widget = new KSudoku;
0079         widget->show();
0080 
0081         // no session.. just start up normally
0082         if (parser.positionalArguments().count() != 0)
0083         {
0084             for (int i = 0; i < parser.positionalArguments().count(); ++i)
0085             {
0086                 widget->loadGame(QUrl::fromUserInput(parser.positionalArguments().at(i), QDir::currentPath()));
0087             }
0088         }
0089 
0090     //} //TODO PORT
0091 
0092     return app.exec();
0093 }