-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
48 lines (39 loc) · 1.64 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation
*/
#include "pdfapplication.h"
#include "pdfattachmentmodel.h"
#include "pdfmanager.h"
#include <QQmlApplicationEngine>
#include <QQuickStyle>
#include <QtQml>
int main(int argc, char* argv[])
{
// Create Qt/QML Objets
PdfApplication app(argc, argv);
app.setApplicationName("PDF Feather");
app.setOrganizationName("Furgoler Software");
app.setApplicationVersion(QT_VERSION_STR);
// This overrides qtquickcontrols2.conf control styled defined, but not the remaining parameters
// Used Material as Fusion Dark is not available at this momment and Universal is not beauty enough
//QQuickStyle::setStyle("Material");
QQmlApplicationEngine engine;
// Registering the manager and the model for PDF attachments
PdfAttachmentModel pdf_attachments;
PdfManager pdf_manager(&pdf_attachments);
engine.rootContext()->setContextProperty("pdfattachmentmodel",&pdf_attachments);
engine.rootContext()->setContextProperty("pdfmanager",&pdf_manager);
// Load main QML
engine.load(QUrl(QStringLiteral("qrc:///qml/PdfFeather.qml")));
// Open file from argv and register propery for initial file
QObject *root = engine.rootObjects().constFirst();
app.setFileOpener(engine.rootObjects().constFirst());
if (app.arguments().count() > 1)
{
QUrl toLoad = QUrl::fromUserInput(app.arguments().at(1));
root->setProperty("source", toLoad);
}
return app.exec();
}