File indexing completed on 2024-12-15 04:14:22

0001 /*
0002  * Copyright (C) 2016 Dan Leinir Turthra Jensen <admin@leinir.dk>
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Lesser General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2.1 of the License, or (at your option) any later version.
0008  *
0009  * This library 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 GNU
0012  * Lesser General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU Lesser General Public
0015  * License along with this library; if not, write to the Free Software
0016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
0017  *
0018  */
0019 
0020 #include <QStandardPaths>
0021 
0022 #include <KAboutData>
0023 #include <KLocalizedString>
0024 
0025 #include <QApplication>
0026 #include <QCommandLineParser>
0027 #include <QCommandLineOption>
0028 #include <QIcon>
0029 
0030 #include <iostream>
0031 #include "peruse_helpers.h"
0032 #include "config-peruse.h"
0033 
0034 int main(int argc, char** argv)
0035 {
0036     QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
0037     QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
0038     QApplication app(argc, argv);
0039     app.setWindowIcon(QIcon::fromTheme(QStringLiteral("peruse-creator")));
0040     app.setApplicationDisplayName("Peruse Creator");
0041     app.setOrganizationDomain("kde.org");
0042 
0043     KLocalizedString::setApplicationDomain("peruse");
0044     KAboutData about(QStringLiteral("perusecreator"), i18n("Peruse Creator"), PERUSE_VERSION_STRING, i18n("Comic Book Creator by KDE"),
0045                      KAboutLicense::GPL, i18n("© 2016-2021 KDE"));
0046     about.addAuthor(i18n("Dan Leinir Turthra Jensen"), QString("Maintainer and Lead Developer"), QStringLiteral("admin@leinir.dk"), QStringLiteral("https://leinir.dk/"), QStringLiteral("leinir"));
0047     about.setProductName("peruse/perusecreator");
0048     about.setProgramLogo(app.windowIcon());
0049     KAboutData::setApplicationData(about);
0050 
0051     QCommandLineParser parser;
0052     parser.addPositionalArgument(QStringLiteral("file"), i18n("Open file in peruse."));
0053     parser.addHelpOption();
0054     parser.process(app);
0055 
0056     QString filename;
0057     if (parser.positionalArguments().size() > 0) {
0058         filename = parser.positionalArguments().at(0);
0059     }
0060 
0061     if (parser.positionalArguments().size() > 1) {
0062         parser.showHelp(1);
0063     }
0064 
0065     QString path = QStringLiteral("qrc:///qml/Main.qml");
0066     return PeruseHelpers::init(path, app, filename);
0067 }