mirror of
https://github.com/logos-co/logos-plugin-qt.git
synced 2026-08-27 17:01:11 +00:00
This repo was the Qt plugin BUILD backend — pure Nix functions plus a CMake
module, with no C++ target at all. But the two things a Qt host actually needs
at runtime lived in logos-qt-sdk, where they are neither a language wrapper over
the protocol C API nor codegen:
LogosAPI / LogosAPIProvider owns a LogosTransportHost per transport,
constructs ModuleProxy / ModuleHandshakeProxy,
publishes the handshake surface, seeds trust
anchors, injects the token validator
LogosProviderBase the base every generated provider derives
PluginInterface the Qt plugin loading contract
the cdylib->Qt glue generator the emitter that wraps a language-neutral
cdylib in a Qt plugin
They move here, so "swap the plugin technology" is a one-repo change.
ADDITIVE: the sources are COPIED and logos-qt-sdk is untouched. Removing them
there now would turn nine downstream masters red at once; that comes later,
after consumers are repointed.
qt_provider_object (and logos_qt_arg_decode, which its QMetaObject dispatch
needs) is carried deliberately even though it is legacy: logos_api_provider
falls back to wrapping a plain QObject in it, and the modules that rely on that
have not been migrated yet. It goes once they are.
The generator links Qt Core and logos-lidl only — never logos-cpp-sdk. It needed
exactly one helper from that SDK's shared frontend, lidlToPascalCase (~12
lines), which is inlined instead, the same way logos-view-module does it. It
also REFUSES `--backend <anything but cdylib>` rather than ignoring the flag:
callers are migrating from a tool where --backend was required and dispatched
on, so silently treating `--backend qt` as cdylib would emit confidently wrong
artifacts with a zero exit.
`rawLib`, `lib` and `cmake-module` deliberately do not reference the new
derivations, so a consumer that only wants the Nix build functions never
realises a Qt/protocol build. Proven, not assumed: with both new inputs
overridden to a bogus flake, cmake-module and rawLib still evaluate while
logos-qt-host fails — so the override bites and the cheap outputs really never
touch it.
Behaviour preservation is the whole claim of a relocation, so it is measured:
the emitted glue is BYTE-IDENTICAL to logos-qt-generator --backend cdylib over
every one of the 20 .lidl contracts in the workspace, in both single and
concurrency:multi mode (40 pairs, exit codes included), and single vs multi do
differ from each other, so both code paths were really exercised. The built
liblogos_qt_host.a is byte-identical to liblogos_qt_sdk.a, exporting the same
390 symbols.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
49 lines
1.7 KiB
C++
49 lines
1.7 KiB
C++
#include "logos_provider_object.h"
|
|
#include "logos_api.h"
|
|
#include "token_manager.h"
|
|
#include <QDebug>
|
|
|
|
// The LogosProviderObject universal-interface defaults and Std bridges moved
|
|
// to logos-protocol (logos_provider_interface.cpp) together with the abstract
|
|
// interface. What remains here is LogosProviderBase — the developer-facing
|
|
// base class — because it talks to LogosAPI, which layers above the protocol.
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// LogosProviderBase
|
|
// ---------------------------------------------------------------------------
|
|
|
|
void LogosProviderBase::init(void* apiInstance)
|
|
{
|
|
m_logosAPI = static_cast<LogosAPI*>(apiInstance);
|
|
qDebug() << "[LogosProviderObject] LogosProviderBase::init called";
|
|
onInit(m_logosAPI);
|
|
}
|
|
|
|
bool LogosProviderBase::informModuleToken(const QString& moduleName, const QString& token)
|
|
{
|
|
if (!m_logosAPI) {
|
|
qWarning() << "[LogosProviderObject] informModuleToken: LogosAPI not available";
|
|
return false;
|
|
}
|
|
|
|
TokenManager* tokenManager = m_logosAPI->getTokenManager();
|
|
if (!tokenManager) {
|
|
qWarning() << "[LogosProviderObject] informModuleToken: TokenManager not available";
|
|
return false;
|
|
}
|
|
|
|
qDebug() << "[LogosProviderObject] Saving token for module:" << moduleName;
|
|
tokenManager->saveToken(moduleName, token);
|
|
return true;
|
|
}
|
|
|
|
void LogosProviderBase::emitEvent(const QString& eventName, const QVariantList& data)
|
|
{
|
|
if (m_eventCallback) {
|
|
qDebug() << "[LogosProviderObject] emitEvent:" << eventName;
|
|
m_eventCallback(eventName, data);
|
|
} else {
|
|
qWarning() << "[LogosProviderObject] emitEvent: no listener set for" << eventName;
|
|
}
|
|
}
|