-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
36 lines (29 loc) · 1017 Bytes
/
main.cpp
File metadata and controls
36 lines (29 loc) · 1017 Bytes
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
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QtCore/QTextStream>
#include <QtCore/QFile>
#include <QDebug>
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
QString waylandLog;
if (app.arguments().size() < 2) {
qDebug() << "Reading log from stdin";
waylandLog = QTextStream(stdin).readAll();
} else if (app.arguments().size() == 2) {
QFile logFile(app.arguments().at(1));
if (!logFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
qCritical("Failed to open log file");
return EXIT_FAILURE;
}
waylandLog = QTextStream(&logFile).readAll();
}
QQmlApplicationEngine engine;
engine.rootContext()->setContextProperty("waylandLog", waylandLog);
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;
return app.exec();
}