PDF4QT/Pdf4QtViewer/main.cpp

53 lines
2.0 KiB
C++
Raw Normal View History

2020-01-18 11:38:54 +01:00
// Copyright (C) 2019-2020 Jakub Melka
2019-01-27 17:55:22 +01:00
//
2020-12-20 19:03:58 +01:00
// This file is part of Pdf4Qt.
2019-01-27 17:55:22 +01:00
//
2020-12-20 19:03:58 +01:00
// Pdf4Qt is free software: you can redistribute it and/or modify
2019-01-27 17:55:22 +01:00
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
2020-12-20 19:03:58 +01:00
// Pdf4Qt is distributed in the hope that it will be useful,
2019-01-27 17:55:22 +01:00
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
2020-12-20 19:03:58 +01:00
// along with Pdf4Qt. If not, see <https://www.gnu.org/licenses/>.
2019-01-27 17:55:22 +01:00
2018-11-21 19:30:15 +01:00
#include "pdfviewermainwindow.h"
#include <QResource>
2018-11-21 19:30:15 +01:00
#include <QApplication>
2019-01-27 17:55:22 +01:00
#include <QCommandLineParser>
2018-11-21 19:30:15 +01:00
int main(int argc, char *argv[])
{
2019-12-22 16:33:50 +01:00
QApplication::setAttribute(Qt::AA_CompressHighFrequencyEvents, true);
QApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true);
2020-02-09 16:06:29 +01:00
QApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity, true);
2019-01-27 17:55:22 +01:00
QApplication application(argc, argv);
QCoreApplication::setOrganizationName("MelkaJ");
2020-12-20 16:36:07 +01:00
QCoreApplication::setApplicationName("PDF4QT Viewer Profi");
2020-09-25 18:08:39 +02:00
QCoreApplication::setApplicationVersion("1.0.0");
2020-12-20 16:36:07 +01:00
QApplication::setApplicationDisplayName(QApplication::translate("Application", "PDF4QT Viewer Profi"));
2019-01-27 17:55:22 +01:00
QCommandLineParser parser;
parser.setApplicationDescription(QCoreApplication::applicationName());
parser.addHelpOption();
parser.addVersionOption();
parser.addPositionalArgument("file", "The PDF file to open.");
parser.process(application);
pdfviewer::PDFViewerMainWindow mainWindow;
mainWindow.show();
2018-11-21 19:30:15 +01:00
QStringList arguments = application.arguments();
if (arguments.size() > 1)
{
2020-12-20 16:36:07 +01:00
mainWindow.getProgramController()->openDocument(arguments[1]);
}
2019-01-27 17:55:22 +01:00
return application.exec();
2018-11-21 19:30:15 +01:00
}