forked from Qv2ray/QvPlugin-Trojan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TrojanPlugin.hpp
58 lines (53 loc) · 1.82 KB
/
TrojanPlugin.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#pragma once
#include "QvPluginInterface.hpp"
#include "core/EventHandler.hpp"
#include "core/Kernel.hpp"
#include "core/Serializer.hpp"
#include <QObject>
#include <QtPlugin>
class QLabel;
using namespace Qv2rayPlugin;
class TrojanPlugin
: public QObject
, Qv2rayInterface
{
Q_INTERFACES(Qv2rayPlugin::Qv2rayInterface)
Q_PLUGIN_METADATA(IID Qv2rayInterface_IID)
Q_OBJECT
public:
//
// Basic metainfo of this plugin
const QvPluginMetadata GetMetadata() const override
{
auto x = QvPluginMetadata{
"Trojan-GFW Plugin", //
"Qv2ray Workgroup", //
"qvtrojan_plugin", //
"Connect to Trojan server in Qv2ray", //
QIcon(":/assets/logo.png"), //
{}, //
{ SPECIAL_TYPE_KERNEL, //
SPECIAL_TYPE_SERIALIZOR } //
};
x.KernelOutboundCapabilities = { { "Trojan", "trojan" } };
return x;
}
//
std::unique_ptr<QvPluginKernel> CreateKernel() override;
std::shared_ptr<QvPluginSerializer> GetSerializer() override;
std::shared_ptr<QvPluginEventHandler> GetEventHandler() override;
std::unique_ptr<QvPluginEditor> GetEditorWidget(UI_TYPE) override;
std::unique_ptr<QWidget> GetSettingsWidget() override;
//
bool UpdateSettings(const QJsonObject &) override;
bool Initialize(const QString &, const QJsonObject &) override;
const QJsonObject GetSettngs() override;
//
signals:
void PluginLog(const QString &) const override;
void PluginErrorMessageBox(const QString &) const override;
private:
QJsonObject settings;
std::shared_ptr<TrojanSerializer> serializer;
std::shared_ptr<TrojanEventHandler> eventHandler;
};