-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.cpp
60 lines (42 loc) · 1.35 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
49
50
51
52
53
54
55
56
57
58
59
60
#include "RaZor/Interface/MainWindow.hpp"
#include <QCommandLineParser>
#include <QSplashScreen>
#include <QThread>
#include <QTranslator>
int main(int argc, char* argv[]) {
QApplication app(argc, argv);
QCoreApplication::setOrganizationName("RaZor");
QCoreApplication::setApplicationName("RaZor");
///////////////////
// Splash screen //
///////////////////
QSplashScreen splashScreen(QPixmap(":/logo/256"));
splashScreen.show();
///////////////////////
// Language handling //
///////////////////////
QCommandLineParser parser;
parser.setApplicationDescription("RaZor - Help");
parser.addHelpOption();
QCommandLineOption languageOption({ "l", "lang" }, QCoreApplication::tr("Change the application's language."), "language");
parser.addOption(languageOption);
parser.process(app);
QTranslator translator;
if (parser.isSet(languageOption)) {
const QString languageValue = parser.value(languageOption);
if (languageValue.startsWith("fr")) {
if (!translator.load("french"))
std::cerr << "[RaZor] French language not found.\n";
}
}
QCoreApplication::installTranslator(&translator);
///////////////////
// Running RaZor //
///////////////////
app.processEvents();
MainWindow window;
splashScreen.finish(&window);
window.show();
window.initializeApplication();
return app.exec();
}