freepdfeditor/src/app/main.cpp

46 lines
1.7 KiB
C++

// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: 2025 ai-ad4 and the FreePDFEditor contributors
//
// Entry point for the FreePDFEditor UI process. The process model (§2.1) keeps
// all untrusted parsing out of this process; the sandboxed document process is
// spawned on demand once a document is opened. At this scaffolding stage no
// document process exists yet, so this is just the empty window shell.
#include "MainWindow.h"
#include <QApplication>
#include <QCommandLineParser>
int main(int argc, char* argv[])
{
QApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
QApplication app(argc, argv);
app.setOrganizationName("FreePDFEditor");
app.setApplicationName("FreePDFEditor");
app.setApplicationDisplayName("FreePDFEditor");
app.setApplicationVersion(QStringLiteral(FREEPDFEDITOR_VERSION_STRING));
app.setWindowIcon(QIcon(QStringLiteral(":/icons/freepdfeditor.svg")));
QCommandLineParser parser;
parser.setApplicationDescription(
QApplication::translate("main", "Cross-platform native desktop PDF editor."));
parser.addHelpOption();
parser.addVersionOption();
parser.addPositionalArgument(
QStringLiteral("file"),
QApplication::translate("main", "Optional PDF file to open at startup."));
parser.process(app);
FreePDFEditor::MainWindow window;
window.show();
const QStringList args = parser.positionalArguments();
if (!args.isEmpty()) {
// No document process yet; the M1 viewer will wire this up.
window.showStatus(QApplication::translate(
"main", "Opening documents is not implemented until M1."));
}
Q_UNUSED(args);
return app.exec();
}