2026-03-19 19:42:15 +01:00
|
|
|
#include "calc_ui_cpp_plugin.h"
|
|
|
|
|
#include "logos_api.h"
|
2026-04-02 11:02:19 +02:00
|
|
|
#include "logos_sdk.h"
|
2026-03-19 19:42:15 +01:00
|
|
|
|
2026-04-02 11:02:19 +02:00
|
|
|
CalcUiCppPlugin::CalcUiCppPlugin(QObject* parent) : CalcUiCppSimpleSource(parent) {}
|
|
|
|
|
CalcUiCppPlugin::~CalcUiCppPlugin() { delete m_logos; }
|
2026-03-19 19:42:15 +01:00
|
|
|
|
2026-03-25 10:37:15 +01:00
|
|
|
void CalcUiCppPlugin::initLogos(LogosAPI* api)
|
|
|
|
|
{
|
2026-04-02 11:02:19 +02:00
|
|
|
if (m_logos) return;
|
2026-03-25 10:37:15 +01:00
|
|
|
m_logosAPI = api;
|
2026-04-02 11:02:19 +02:00
|
|
|
m_logos = new LogosModules(api);
|
|
|
|
|
// Register this object as the Remote Objects source so the QML replica
|
|
|
|
|
// can see its properties and call its slots.
|
|
|
|
|
setBackend(this);
|
2026-03-25 10:37:15 +01:00
|
|
|
}
|
|
|
|
|
|
2026-04-02 11:02:19 +02:00
|
|
|
int CalcUiCppPlugin::add(int a, int b)
|
2026-03-19 19:42:15 +01:00
|
|
|
{
|
2026-04-02 11:02:19 +02:00
|
|
|
return m_logos->calc_module.add(a, b);
|
2026-03-19 19:42:15 +01:00
|
|
|
}
|
|
|
|
|
|
2026-04-02 11:02:19 +02:00
|
|
|
int CalcUiCppPlugin::multiply(int a, int b)
|
2026-03-19 19:42:15 +01:00
|
|
|
{
|
2026-04-02 11:02:19 +02:00
|
|
|
return m_logos->calc_module.multiply(a, b);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int CalcUiCppPlugin::factorial(int n)
|
|
|
|
|
{
|
|
|
|
|
return m_logos->calc_module.factorial(n);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int CalcUiCppPlugin::fibonacci(int n)
|
|
|
|
|
{
|
|
|
|
|
return m_logos->calc_module.fibonacci(n);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString CalcUiCppPlugin::libVersion()
|
|
|
|
|
{
|
|
|
|
|
return m_logos->calc_module.libVersion();
|
2026-03-19 19:42:15 +01:00
|
|
|
}
|