Files
JSonRPCPlugin/include/JsonRPCPlugin.h
T

50 lines
2.0 KiB
C++
Raw Normal View History

2020-10-25 10:39:21 +01:00
//##########################################################################
//# #
2020-11-04 00:13:49 +01:00
//# CLOUDCOMPARE PLUGIN: JsonRPCPlugin #
2020-10-25 10:39:21 +01:00
//# #
//# This program is free software; you can redistribute it and/or modify #
//# it under the terms of the GNU General Public License as published by #
//# the Free Software Foundation; version 2 of the License. #
//# #
//# This program is distributed in the hope that it will be useful, #
//# but WITHOUT ANY WARRANTY; without even the implied warranty of #
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
//# GNU General Public License for more details. #
//# #
2020-11-04 00:13:49 +01:00
//# COPYRIGHT: theAdib, 2020 #
2020-10-25 10:39:21 +01:00
//# #
//##########################################################################
#pragma once
#include "ccStdPluginInterface.h"
#include "jsonrpcserver.h"
2020-11-04 00:13:49 +01:00
//! Json RPC Plugin
2020-10-25 10:39:21 +01:00
class JsonRPCPlugin : public QObject, public ccStdPluginInterface
{
Q_OBJECT
Q_INTERFACES( ccPluginInterface ccStdPluginInterface )
Q_PLUGIN_METADATA( IID "cccorp.cloudcompare.plugin.JsonRPC" FILE "../info.json" )
public:
explicit JsonRPCPlugin( QObject *parent = nullptr );
~JsonRPCPlugin() override = default;
// Inherited from ccStdPluginInterface
QList<QAction *> getActions() override;
public slots:
void triggered(bool checked);
2020-11-04 00:13:49 +01:00
/// slot for execution
2020-10-25 10:39:21 +01:00
JsonRPCResult execute(QString method, QMap<QString, QVariant> params);
private:
//! Default action
QAction* m_action{nullptr};
const QString version{"1.1"};
2020-10-25 10:39:21 +01:00
protected:
2020-11-04 00:13:49 +01:00
/// server that emit the execute signals
2020-10-25 10:39:21 +01:00
JsonRPCServer rpc_server;
};