mirror of
https://github.com/logos-co/logos-plugin-qt.git
synced 2026-08-27 08:51:07 +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>
48 lines
1.7 KiB
C++
48 lines
1.7 KiB
C++
#ifndef QT_PROVIDER_OBJECT_H
|
|
#define QT_PROVIDER_OBJECT_H
|
|
|
|
#include "logos_provider_object.h"
|
|
#include <QObject>
|
|
|
|
class PluginInterface;
|
|
|
|
// LEGACY, and carried here deliberately. This adapter is slated for deletion,
|
|
// but LogosAPIProvider::registerObject still falls back to it for any plugin
|
|
// that exposes a plain QObject instead of a LogosProviderPlugin, and the
|
|
// modules that rely on that fallback have not been migrated yet. Dropping it
|
|
// while relocating the host runtime would have changed behaviour for them, so
|
|
// it comes across unchanged; it goes once the last legacy module is migrated.
|
|
|
|
/**
|
|
* @brief Adapter that wraps an existing QObject-based plugin as a LogosProviderObject.
|
|
*
|
|
* This allows legacy plugins (using Q_INVOKABLE / Qt signals) to work through
|
|
* the new LogosProviderObject interface without any changes to the plugin code.
|
|
* All dispatch goes through QMetaObject — the same path that ModuleProxy used
|
|
* to handle directly.
|
|
*/
|
|
class QtProviderObject : public QObject, public LogosProviderObject {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit QtProviderObject(QObject* module, QObject* parent = nullptr);
|
|
~QtProviderObject() override;
|
|
|
|
QVariant callMethod(const QString& methodName, const QVariantList& args) override;
|
|
bool informModuleToken(const QString& moduleName, const QString& token) override;
|
|
QJsonArray getMethods() override;
|
|
void setEventListener(EventCallback callback) override;
|
|
void init(void* apiInstance) override;
|
|
QString providerName() const override;
|
|
QString providerVersion() const override;
|
|
|
|
private slots:
|
|
void onWrappedEventResponse(const QString& eventName, const QVariantList& data);
|
|
|
|
private:
|
|
QObject* m_module;
|
|
EventCallback m_eventCallback;
|
|
};
|
|
|
|
#endif // QT_PROVIDER_OBJECT_H
|