MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / registerAppMetadataProperties

Method registerAppMetadataProperties

app/src/Misc/ModuleManager.cpp:746–791  ·  view source on GitHub ↗

* @brief Registers app metadata, build info, and screen list QML context properties. */

Source from the content-addressed store, hash-verified

744 * @brief Registers app metadata, build info, and screen list QML context properties.
745 */
746void Misc::ModuleManager::registerAppMetadataProperties(QQmlContext* ctx, bool grpcAvailable)
747{
748 QVariantList screenList;
749 QVariantMap primaryScreen;
750 if (!m_headless) {
751 for (int i = 0; i < qApp->screens().count(); ++i) {
752 QVariantMap map;
753 map["name"] = qApp->screens()[i]->name();
754 map["geometry"] = QVariant::fromValue(qApp->screens()[i]->geometry());
755 screenList.append(map);
756 }
757
758 primaryScreen["name"] = qApp->primaryScreen()->name();
759 primaryScreen["geometry"] = qApp->primaryScreen()->geometry();
760 }
761
762#ifdef BUILD_COMMERCIAL
763 const bool qtCommercialAvailable = true;
764#else
765 const bool qtCommercialAvailable = false;
766#endif
767
768#ifdef SERIAL_STUDIO_WITH_WEBENGINE
769 const bool webEngineAvailable = true;
770#else
771 const bool webEngineAvailable = false;
772#endif
773
774 ctx->setContextProperty("Cpp_AppName", APP_NAME);
775 ctx->setContextProperty("Cpp_BuildDate", QStringLiteral(__DATE__));
776 ctx->setContextProperty("Cpp_BuildTime", QStringLiteral(__TIME__));
777 ctx->setContextProperty("Cpp_ScreenList", screenList);
778 ctx->setContextProperty("Cpp_AppVersion", APP_VERSION);
779 ctx->setContextProperty("Cpp_PrimaryScreen", primaryScreen);
780 ctx->setContextProperty("Cpp_AppUpdaterUrl", APP_UPDATER_URL);
781 ctx->setContextProperty("Cpp_AppOrganization", APP_DEVELOPER);
782 ctx->setContextProperty("Cpp_UpdaterEnabled", autoUpdaterEnabled());
783 ctx->setContextProperty("Cpp_CommercialBuild", qtCommercialAvailable);
784 ctx->setContextProperty("Cpp_GrpcAvailable", grpcAvailable);
785 ctx->setContextProperty("Cpp_HasWebEngine", webEngineAvailable);
786 ctx->setContextProperty("Cpp_AppOrganizationDomain", APP_SUPPORT_URL);
787
788#ifdef ENABLE_GRPC
789 ctx->setContextProperty("Cpp_GRPC_Server", &API::GRPC::GRPCServer::instance());
790#endif
791}
792
793/**
794 * @brief Installs QML image providers, loads main.qml, and wires the macOS quit interceptor.

Callers

nothing calls this directly

Calls 4

geometryMethod · 0.80
countMethod · 0.45
nameMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected