blob: 7efe5faf17d621430de82cbb862b32ab5d7a74aa [file] [log] [blame]
swissChili23958ca2022-02-21 19:23:34 -08001#include "IdeMain.h"
2
3#include <QQmlApplicationEngine>
4#include <QQuickStyle>
swissChilid2af6ad2022-04-16 14:42:17 -07005#include <QTranslator>
swissChili23958ca2022-02-21 19:23:34 -08006
swissChili25620b02022-02-23 17:15:16 -08007#include "CellModel.h"
swissChilia44bf722022-04-16 18:41:54 -07008#include "RecentModel.h"
swissChili25620b02022-02-23 17:15:16 -08009
swissChili505de412022-03-24 12:35:08 -070010int ideMain(Application *app)
swissChili23958ca2022-02-21 19:23:34 -080011{
12 QQmlApplicationEngine engine;
13
swissChili23958ca2022-02-21 19:23:34 -080014 QQuickStyle::setStyle("Material");
15
swissChili25620b02022-02-23 17:15:16 -080016 qRegisterMetaType<CellModel>();
17 qRegisterMetaType<CellModel *>();
swissChilia44bf722022-04-16 18:41:54 -070018 qRegisterMetaType<RecentModel>();
19 qRegisterMetaType<RecentModel *>();
swissChili25620b02022-02-23 17:15:16 -080020
swissChilid2af6ad2022-04-16 14:42:17 -070021 QTranslator translator;
22 qInfo() << "loading translations" << translator.load(QLocale(), "refal", "_", ":/ts/", ".qm");
23 app->installTranslator(&translator);
24
swissChilia44bf722022-04-16 18:41:54 -070025 app->setOrganizationName("swissChili");
26 app->setOrganizationDomain("swisschili.sh");
27 app->setApplicationName("REFAL Studio");
28
swissChili23958ca2022-02-21 19:23:34 -080029 const QUrl url(QStringLiteral("qrc:/qml/main.qml"));
30 QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
31 app, [url](QObject *obj, const QUrl &objUrl)
32 {
33 if (!obj && url == objUrl)
34 QCoreApplication::exit(-1);
35 }, Qt::QueuedConnection);
36 engine.load(url);
37
38 return app->exec();
39}