File indexing completed on 2024-04-28 04:33:44

0001 /*******************************************************************************
0002  * Copyright (C) 2020 by Steve Allewell                                        *
0003  * steve.allewell@gmail.com                                                    *
0004  *                                                                             *
0005  * This program is free software; you can redistribute it and/or modify        *
0006  * it under the terms of the GNU General Public License as published by        *
0007  * the Free Software Foundation; either version 2 of the License, or           *
0008  * (at your option) any later version.                                         *
0009  ******************************************************************************/
0010 
0011 
0012 #include <QApplication>
0013 #include <QCommandLineParser>
0014 #include <QDir>
0015 #include <QUrl>
0016 
0017 #include <KAboutData>
0018 #include <KLocalizedString>
0019 
0020 #include "MainWindow.h"
0021 
0022 
0023 int main(int argc, char *argv[])
0024 {
0025     QApplication app(argc, argv);
0026 
0027     KLocalizedString::setApplicationDomain("pvfViewer");
0028 
0029     KAboutData aboutData(QStringLiteral("pvfViewer"),                           // component name
0030                          QString(i18n("pvfViewer")),                            // display name
0031                          QStringLiteral("0.1.0"),                               // version
0032                          i18n("A PC Stitch pvf pattern viewer."),               // short description
0033                          KAboutLicense::GPL_V2,                                 // license
0034                          i18n("(c)2020 Steve Allewell"),                        // copyright
0035                          QString(),                                             // other text
0036                          QStringLiteral("https://userbase.kde.org/pvfViewer")   // home page
0037                          // bug address defaults to submit@bugs.kde.org
0038                );
0039 
0040     aboutData.addAuthor(QStringLiteral("Steve Allewell"), i18n("Project Lead"), QStringLiteral("steve.allewell@gmail.com"));
0041     aboutData.setTranslator(i18nc("NAME OF TRANSLATORS", "Your names"), i18nc("EMAIL OF TRANSLATORS", "Your emails"));
0042 
0043     KAboutData::setApplicationData(aboutData);
0044 
0045     app.setApplicationName(aboutData.componentName());
0046     app.setApplicationDisplayName(aboutData.displayName());
0047     app.setWindowIcon(QIcon::fromTheme(QStringLiteral("pvfViewer")));
0048     app.setOrganizationDomain(aboutData.organizationDomain());
0049     app.setApplicationVersion(aboutData.version());
0050 
0051     QCommandLineParser parser;
0052     aboutData.setupCommandLine(&parser);
0053     parser.setApplicationDescription(aboutData.shortDescription());
0054 
0055     parser.process(app);
0056     aboutData.processCommandLine(&parser);
0057 
0058     MainWindow *mainWindow = new MainWindow();
0059     mainWindow->show();
0060 
0061     for (int i = 0 ; i < parser.positionalArguments().count() ; ++i) {
0062         mainWindow->fileOpen(QUrl::fromUserInput(parser.positionalArguments().at(i), QDir::currentPath()));
0063     }
0064 
0065     return app.exec();
0066 }