PDF4QT/Pdf4QtLibGui/main.cpp

53 lines
1.9 KiB
C++
Raw Normal View History

2024-03-16 17:02:44 +01:00
// Copyright (C) 2019-2020 Jakub Melka
2021-09-27 11:14:20 +02:00
//
2024-03-16 17:02:44 +01:00
// This file is part of Pdf4Qt.
2021-09-27 11:14:20 +02:00
//
2024-03-16 17:02:44 +01:00
// Pdf4Qt is free software: you can redistribute it and/or modify
2021-09-27 11:14:20 +02: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
2024-03-16 17:02:44 +01:00
// (at your option) any later version.
2021-09-27 11:14:20 +02:00
//
2024-03-16 17:02:44 +01:00
// Pdf4Qt is distributed in the hope that it will be useful,
2021-09-27 11:14:20 +02: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
2024-03-16 17:02:44 +01:00
// along with Pdf4Qt. If not, see <https://www.gnu.org/licenses/>.
2021-09-27 11:14:20 +02:00
2024-03-16 17:02:44 +01:00
#include "pdfviewermainwindow.h"
2021-09-27 11:14:20 +02:00
2024-03-16 17:02:44 +01:00
#include <QResource>
2021-09-27 11:14:20 +02:00
#include <QApplication>
#include <QCommandLineParser>
int main(int argc, char *argv[])
{
QApplication::setAttribute(Qt::AA_CompressHighFrequencyEvents, true);
2024-03-16 17:02:44 +01:00
QApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true);
QApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity, true);
2021-09-27 11:14:20 +02:00
QApplication application(argc, argv);
QCoreApplication::setOrganizationName("MelkaJ");
2024-03-16 17:02:44 +01:00
QCoreApplication::setApplicationName("PDF4QT Editor");
QCoreApplication::setApplicationVersion("1.0.0");
QApplication::setApplicationDisplayName(QApplication::translate("Application", "PDF4QT Editor"));
2021-09-27 11:14:20 +02:00
QCommandLineParser parser;
parser.setApplicationDescription(QCoreApplication::applicationName());
parser.addHelpOption();
parser.addVersionOption();
parser.addPositionalArgument("file", "The PDF file to open.");
parser.process(application);
2024-03-16 17:02:44 +01:00
pdfviewer::PDFViewerMainWindow mainWindow;
2021-09-27 11:14:20 +02:00
mainWindow.show();
QStringList arguments = application.arguments();
if (arguments.size() > 1)
{
mainWindow.getProgramController()->openDocument(arguments[1]);
}
return application.exec();
}