swissChili | 23958ca | 2022-02-21 19:23:34 -0800 | [diff] [blame] | 1 | #include "IdeMain.h" |
| 2 | |
| 3 | #include <QQmlApplicationEngine> |
| 4 | #include <QQuickStyle> |
swissChili | d2af6ad | 2022-04-16 14:42:17 -0700 | [diff] [blame^] | 5 | #include <QTranslator> |
swissChili | 23958ca | 2022-02-21 19:23:34 -0800 | [diff] [blame] | 6 | |
swissChili | 25620b0 | 2022-02-23 17:15:16 -0800 | [diff] [blame] | 7 | #include "CellModel.h" |
| 8 | |
swissChili | 505de41 | 2022-03-24 12:35:08 -0700 | [diff] [blame] | 9 | int ideMain(Application *app) |
swissChili | 23958ca | 2022-02-21 19:23:34 -0800 | [diff] [blame] | 10 | { |
| 11 | QQmlApplicationEngine engine; |
| 12 | |
swissChili | 23958ca | 2022-02-21 19:23:34 -0800 | [diff] [blame] | 13 | QQuickStyle::setStyle("Material"); |
| 14 | |
swissChili | 25620b0 | 2022-02-23 17:15:16 -0800 | [diff] [blame] | 15 | qRegisterMetaType<CellModel>(); |
| 16 | qRegisterMetaType<CellModel *>(); |
| 17 | |
swissChili | d2af6ad | 2022-04-16 14:42:17 -0700 | [diff] [blame^] | 18 | QTranslator translator; |
| 19 | qInfo() << "loading translations" << translator.load(QLocale(), "refal", "_", ":/ts/", ".qm"); |
| 20 | app->installTranslator(&translator); |
| 21 | |
swissChili | 23958ca | 2022-02-21 19:23:34 -0800 | [diff] [blame] | 22 | const QUrl url(QStringLiteral("qrc:/qml/main.qml")); |
| 23 | QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, |
| 24 | app, [url](QObject *obj, const QUrl &objUrl) |
| 25 | { |
| 26 | if (!obj && url == objUrl) |
| 27 | QCoreApplication::exit(-1); |
| 28 | }, Qt::QueuedConnection); |
| 29 | engine.load(url); |
| 30 | |
| 31 | return app->exec(); |
| 32 | } |