PDF4QT/PdfForQtViewer/main.cpp

52 lines
1.9 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
//
// This file is part of PdfForQt.
//
// PdfForQt is free software: you can redistribute it and/or modify
// 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.
//
// PdfForQt is distributed in the hope that it will be useful,
// 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
// along with PDFForQt. If not, see <https://www.gnu.org/licenses/>.
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");
QCoreApplication::setApplicationName("PDF Viewer");
2020-09-25 18:08:39 +02:00
QCoreApplication::setApplicationVersion("1.0.0");
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)
{
mainWindow.openDocument(arguments[1]);
}
2019-01-27 17:55:22 +01:00
return application.exec();
2018-11-21 19:30:15 +01:00
}