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