This repository was archived by the owner on May 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
61 lines (48 loc) · 2.41 KB
/
main.cpp
File metadata and controls
61 lines (48 loc) · 2.41 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
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "InfinityStudio0.h"
#include <QtWidgets/QApplication>
#include "GetConfig.h"
#include "CJsonObject/CJsonObject.hpp"
#include <QFontDatabase>
#include "Infinity_global.h"
#include "StyleContainer.h"
#include "ILVM.h"
void app_init()
{
StyleContainer::getContainer().startListen();
QString fontFile = QString::fromStdString(StyleContainer::getContainer().getStyleObject()("font"));
int fontClass = 0;
StyleContainer::getContainer().getStyleObject().Get("font-class", fontClass);
int fontId = QFontDatabase::addApplicationFont(QCoreApplication::applicationDirPath() + QString("/themes/") + fontFile);
QString fontName = QFontDatabase::applicationFontFamilies(fontId).at(fontClass);
QFont font(fontName);
QApplication::setFont(font);
}
int main(int argc, char* argv[])
{
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);
QApplication a(argc, argv);
::app_init();
InfinityStudio0 w;
Infinity_global::getGlobal().set_App_init_OK(true);
if (Infinity_global::getGlobal().get_RAII_memory_OK()) {
QThread eventsThread;
Infinity_Events::getClass().moveToThread(&eventsThread);
eventsThread.start();
QObject::connect(&(StyleContainer::getContainer()), &StyleContainer::resource_refresh, &(Infinity_Events::getClass()), &Infinity_Events::on_resource_refresh);
QObject::connect(&(Infinity_Events::getClass()), &Infinity_Events::lua_command, &(ILVM::getVM()), &ILVM::on_commandsIn, Qt::ConnectionType::QueuedConnection);
QObject::connect(&(ILVM::getVM()), &ILVM::errorMessage, &(Infinity_Events::getClass()), &Infinity_Events::on_luaErrorMessage, Qt::ConnectionType::QueuedConnection);
QObject::connect(&(ILVM::getVM()), &ILVM::normalMessage, &(Infinity_Events::getClass()), &Infinity_Events::on_luaNormalMessage, Qt::ConnectionType::QueuedConnection);
QObject::connect(&(ILVM::getVM()), &ILVM::clearMessage, &(Infinity_Events::getClass()), &Infinity_Events::on_luaClearMessage, Qt::ConnectionType::QueuedConnection);
QObject::connect(&(ILVM::getVM()), &ILVM::mainStart, &(Infinity_Events::getClass()), &Infinity_Events::on_luaMainStarted, Qt::ConnectionType::QueuedConnection);
QObject::connect(&(ILVM::getVM()), &ILVM::mainStop, &(Infinity_Events::getClass()), &Infinity_Events::on_luaMainEnded, Qt::ConnectionType::QueuedConnection);
w.show();
int retId = a.exec();
eventsThread.quit();
eventsThread.wait();
return retId;
}
else {
return -1;
}
}