#include #include #include #include int main(int argc, char *argv[]) { #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #endif QGuiApplication app(argc, argv); QGuiApplication::setOrganizationName(QStringLiteral("Status")); QGuiApplication::setOrganizationDomain(QStringLiteral("status.im")); QGuiApplication::setApplicationName(QStringLiteral("Status Desktop Storybook")); qputenv("QT_QUICK_CONTROLS_HOVER_ENABLED", QByteArrayLiteral("1")); QQmlApplicationEngine engine; const QStringList additionalImportPaths { SRC_DIR + QStringLiteral("/../ui/StatusQ/src"), SRC_DIR + QStringLiteral("/../ui/app"), SRC_DIR + QStringLiteral("/../ui/imports"), SRC_DIR + QStringLiteral("/src"), SRC_DIR + QStringLiteral("/pages"), SRC_DIR + QStringLiteral("/stubs"), SRC_DIR + QStringLiteral("/mocks"), }; for (const auto& path : additionalImportPaths) engine.addImportPath(path); auto watcherFactory = [additionalImportPaths](QQmlEngine*, QJSEngine*) { auto watcher = new DirectoriesWatcher(); watcher->addPaths(additionalImportPaths); return watcher; }; qmlRegisterSingletonType( "Storybook", 1, 0, "SourceWatcher", watcherFactory); auto cleanerFactory = [](QQmlEngine* engine, QJSEngine*) { return new CacheCleaner(engine); }; qmlRegisterSingletonType( "Storybook", 1, 0, "CacheCleaner", cleanerFactory); const QUrl url(SRC_DIR + QStringLiteral("/main.qml")); QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, &app, [url](QObject *obj, const QUrl &objUrl) { if (!obj && url == objUrl) QCoreApplication::exit(-1); }, Qt::QueuedConnection); engine.load(url); return QGuiApplication::exec(); }