Files
logos-view-module/cmake/LogosViewReplicaFactory.cpp.in
Dario Gabriel LipicarandClaude Opus 5 f5df363e50 feat: the view-module backend, as its own repo
A view module is a distinct authoring flavour, not a variation on a core
module: it publishes a .rep rather than a .lidl, and is driven by a QML view in
a ui-host process. Its two halves were split across two repos that own other
things — the plugin-glue generator sat in logos-qt-sdk's qt-generator, and the
replica-factory CMake plus its four templates sat in logos-plugin-qt — so
changing how views are built meant touching the SDK and the Qt plugin backend.

Collected here:

- view-generator/  logos-view-generator, emitting <name>_ui_interface.h and
                   <name>_ui_glue.{h,cpp} around the user's .rep + *Backend.
                   Carried over verbatim from logos-qt-sdk's lidl_gen_ui, with
                   a main() of its own. It never reads LIDL — a view's contract
                   IS its .rep — so it links Qt Core and nothing else, and
                   lidlToPascalCase is inlined rather than dragging in a
                   generator frontend it has no other use for.
- cmake/           LogosViewModule.cmake wrapping logos_replica_factory(), with
                   the four .in templates it configures. They must stay
                   siblings: the function resolves them through
                   CMAKE_CURRENT_FUNCTION_LIST_DIR.
- cpp/             LogosUiPluginContext, the narrow context a *Backend derives.

That makes this repo a leaf — logos-nix for a pinned Qt, nothing else — so it
can be re-pinned independently of the SDK stack.

Verified behaviour-preserving rather than assumed: run against a real in-tree
view module (logos-chat-ui's ChatBackend.rep + metadata.json), the relocated
generator's three files are BYTE-IDENTICAL to logos-qt-generator --backend ui.

Two checks: one drives the generator over a real .rep and asserts the scraped
rep class, the PascalCase plugin stem and the carried version; the other
asserts a .rep declaring no class fails rather than emitting half a plugin.

The originals are left in place for now — additive first, removal second, so
no downstream repo goes red on this commit alone.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-12 20:16:30 -03:00

35 lines
1.1 KiB
Plaintext

// Auto-generated by logos_module(REP_FILE ...) — DO NOT EDIT.
#include "LogosViewReplicaFactory.h"
#include "rep_@LOGOS_REP_BASE@_replica.h"
#include <QCoreApplication>
#include <QRemoteObjectNode>
#include <QQmlEngine>
QObject* @LOGOS_FACTORY_CLASS@::acquire(QRemoteObjectNode* node)
{
return node->acquire<@LOGOS_REP_CLASS@Replica>();
}
const QMetaObject* @LOGOS_FACTORY_CLASS@::replicaMetaObject() const
{
return &@LOGOS_REP_CLASS@Replica::staticMetaObject;
}
// Register the replica's meta-object (and its Q_ENUMs) with QML at plugin
// load time. The URI and type name are baked in by CMake from the .rep file
// — no runtime virtuals required. qmlRegisterUncreatableMetaObject is a
// process-global registration, so a single call here is sufficient for every
// QQmlEngine instance in the host process.
namespace {
void registerQmlMetaObject()
{
qmlRegisterUncreatableMetaObject(
@LOGOS_REP_CLASS@Replica::staticMetaObject,
"@LOGOS_QML_URI@", 1, 0, "@LOGOS_QML_TYPE_NAME@",
QStringLiteral("Enum-only type"));
}
} // namespace
Q_COREAPP_STARTUP_FUNCTION(registerQmlMetaObject)