-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
48 lines (37 loc) · 1.1 KB
/
main.cpp
File metadata and controls
48 lines (37 loc) · 1.1 KB
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
#include <QCoreApplication>
#include <QGuiApplication>
#include <QCommandLineParser>
#include <QQmlApplicationEngine>
#include <QQuickStyle>
#include <QIcon>
#include "MidiRouterClientCli/Bal/ParsedArguments.h"
int runGui(int argc, char *argv[]) {
QGuiApplication app(argc, argv);
app.setWindowIcon(QIcon(":/icon.png"));
#ifdef Q_OS_WIN
QQuickStyle::setStyle("Fusion");
#endif
QQmlApplicationEngine engine;
QObject::connect(
&engine,
&QQmlApplicationEngine::objectCreationFailed,
&app,
[]() { QCoreApplication::exit(-1); },
Qt::QueuedConnection
);
engine.loadFromModule("MainQml", "Main");
return app.exec();
}
int main(int argc, char *argv[]) {
#ifdef Q_OS_WIN
return runGui(argc, argv);
#endif
ParsedArguments parsedArgs;
parsedArgs.parseArgumentsMain(argc, argv);
if (parsedArgs.mode == RunMode::Headless)
return parsedArgs.runHeadless(argc, argv);
else if (parsedArgs.mode == RunMode::ApplyDefaultPreset) {
return parsedArgs.runApplyDefaultPreset(argc, argv);
}
return runGui(argc, argv);
}