File indexing completed on 2024-04-14 14:08:49

0001 /*************************************************************************************
0002  *  Copyright (C) 2010-2012 by Percy Camilo T. Aucahuasi <percy.camilo.ta@gmail.com> *
0003  *                                                                                   *
0004  *  This program is free software; you can redistribute it and/or                    *
0005  *  modify it under the terms of the GNU General Public License                      *
0006  *  as published by the Free Software Foundation; either version 2                   *
0007  *  of the License, or (at your option) any later version.                           *
0008  *                                                                                   *
0009  *  This program is distributed in the hope that it will be useful,                  *
0010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of                   *
0011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                    *
0012  *  GNU General Public License for more details.                                     *
0013  *                                                                                   *
0014  *  You should have received a copy of the GNU General Public License                *
0015  *  along with this program; if not, write to the Free Software                      *
0016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA   *
0017  *************************************************************************************/
0018 
0019 //KDE includes
0020 #include <QApplication>
0021 #include <KAboutData>
0022 #include <KLocalizedString>
0023 #include <QCommandLineParser>
0024 
0025 //local includes
0026 #include "mainwindow.h"
0027 
0028 int main(int argc, char **argv)
0029 {
0030     QApplication app(argc, argv);
0031     KLocalizedString::setApplicationDomain("khipu");
0032     KAboutData about("khipu", i18n("Khipu"), "1.0", i18n("Advanced Mathematical Function Plotter"),
0033                      KAboutLicense::GPL, i18n("(C) 2010-2012, Percy Camilo Triveño Aucahuasi"));
0034 
0035     about.addAuthor(i18n("Percy Camilo Triveño Aucahuasi"), i18n("Main developer"), "percy.camilo.ta@gmail.com");
0036 
0037     about.addCredit(i18n("Punit Mehta"), i18n("GSoC-2013 student - Persistance file support. Plot-dictionary support. Worked for application actions, command-line improvements and space filtering. Several bug fixings"), "punit9462@gmail.com");
0038     about.addCredit(i18n("Manuel Álvarez Blanco"), i18n("Thesis mentor - Guide and supervision during project conception. Bibliographical support. Numeric Mathematics and Algorithms support"), "");
0039     about.addCredit(i18n("José Ignacio Cuevas Gonzáles"), i18n("Thesis mentor - Supervision, Product Guide, Product promotion and former Client"), "jose.cuevas@upc.edu.pe");
0040     about.addCredit(i18n("Eduardo Fernandini Capurro"), i18n("Thesis mentor - Supervision, Bibliographical Support, Product Guide and former Client"), "eduardo.fernandini@upc.edu.pe");
0041     about.addCredit(i18n("Jaime Urbina Pereyra"), i18n("Thesis mentor - Supervision and former Main Project Mentor"), "pcsijurb@upc.edu.pe");
0042 
0043     about.addCredit(i18n("Aleix Pol Gonzalez"), i18n("KAlgebra and Analitza parser author, both vitals for the project"));
0044 
0045     about.addCredit(i18n("José Fernando Ramos Ramirez"), i18n("First version of Famous Curves Database. Build former windows installer"), "ferramos1990@gmail.com");
0046     about.addCredit(i18n("Susan Pamela Rios Sarmiento"), i18n("First version of Famous Curves Database"), "susanriossarmiento@gmail.com");
0047 
0048     about.addCredit(i18n("Edgar Velasquez"), i18n("2D Improvements"));
0049     about.addCredit(i18n("Jose Torres Cardenas"), i18n("3D Improvements"));
0050     about.addCredit(i18n("Elizabeth Portilla Flores"), i18n("3D Improvements"));
0051     about.addCredit(i18n("Paul Murat Landauro Minaya"), i18n("3D Improvements"));
0052 
0053     KAboutData::setApplicationData(about);
0054 
0055     QCommandLineParser parser;
0056     about.setupCommandLine(&parser);
0057     parser.addPositionalArgument("urls", i18n("Khipu files to open"));
0058     parser.addOption(QCommandLineOption("ignoreautosavedfile", i18n("Always start with a new file, ignoring any autosaved file")));
0059     parser.process(app);
0060     about.processCommandLine(&parser);
0061 
0062     MainWindow *mainWindow = new MainWindow;
0063 
0064     if (app.isSessionRestored()) {
0065         RESTORE(MainWindow)
0066     } else {
0067         if (parser.positionalArguments().isEmpty()) {
0068             if (parser.isSet("ignoreautosavedfile")) {
0069                 mainWindow->checkforAutoSavedFile();
0070             }
0071             mainWindow->show();
0072         } else {
0073             bool exit = false;
0074             for (const auto &urlString: parser.positionalArguments()) {
0075                 if (!mainWindow->openFile(QUrl(urlString))) {
0076                     exit = true;
0077                     break;
0078                 }
0079             }
0080             if (exit)
0081                 mainWindow->deleteLater(); // can't open a khipu file, so just exit !
0082             else
0083                 mainWindow->show();
0084         }
0085         parser.clearPositionalArguments();
0086     }
0087     return app.exec();
0088 }