forked from Qv2ray/QvPlugin-Trojan-Go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TrojanGoPlugin.cpp
60 lines (50 loc) · 1.41 KB
/
TrojanGoPlugin.cpp
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
59
60
#include "TrojanGoPlugin.hpp"
#include "widgets/TrojanGoOutboundWidget.hpp"
#include "widgets/TrojanGoSettingsWidget.hpp"
#include <QDateTime>
#include <QLabel>
#include <QMetaEnum>
std::unique_ptr<QvPluginKernel> QvTrojanGoPlugin::CreateKernel()
{
return std::make_unique<QvTrojanGoPluginKernel>(this);
}
bool QvTrojanGoPlugin::UpdateSettings(const QJsonObject &conf)
{
settings = conf;
return true;
}
bool QvTrojanGoPlugin::Initialize(const QString &, const QJsonObject &settings)
{
emit PluginLog("Initialize plugin.");
PluginInstance = this;
this->settings = settings;
serializer = std::make_shared<TrojanGoSerializer>(this);
eventHandler = std::make_shared<SimpleEventHandler>(this);
return true;
}
const QJsonObject QvTrojanGoPlugin::GetSettngs()
{
return settings;
}
std::shared_ptr<QvPluginEventHandler> QvTrojanGoPlugin::GetEventHandler()
{
return eventHandler;
}
std::unique_ptr<QWidget> QvTrojanGoPlugin::GetSettingsWidget()
{
return std::make_unique<TrojanGoSettingsWidget>();
}
std::unique_ptr<QvPluginEditor> QvTrojanGoPlugin::GetEditorWidget(UI_TYPE type)
{
switch (type)
{
case UI_TYPE_INBOUND_EDITOR:
case UI_TYPE_GROUP_EDITOR: break;
case UI_TYPE_OUTBOUND_EDITOR: return std::make_unique<TrojanGoOutboundWidget>();
}
return nullptr;
}
std::shared_ptr<QvPluginSerializer> QvTrojanGoPlugin::GetSerializer()
{
return serializer;
}