forked from Qv2ray/QvPlugin-SS
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSSPlugin.cpp
64 lines (56 loc) · 1.56 KB
/
SSPlugin.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
61
62
63
64
#include "SSPlugin.hpp"
#include "core/Serializer.hpp"
#include "ui/SSROutboundEditor.hpp"
#include <QDateTime>
#include <QLabel>
#include <QMetaEnum>
namespace SSPlugin
{
std::unique_ptr<QvPluginKernel> QvSSPlugin::CreateKernel()
{
return std::make_unique<SSKernelInstance>();
}
std::shared_ptr<QvPluginSerializer> QvSSPlugin::GetSerializer()
{
return serializer;
}
bool QvSSPlugin::UpdateSettings(const QJsonObject &conf)
{
settings = conf;
return true;
}
bool QvSSPlugin::Initialize(const QString &, const QJsonObject &settings)
{
emit PluginLog("Initialize plugin.");
this->settings = settings;
eventHandler = std::make_shared<SSPluginEventHandler>(this);
serializer = std::make_shared<SSSerializer>(this);
return true;
}
const QJsonObject QvSSPlugin::GetSettngs()
{
emit PluginLog("Getting plugin settings.");
return settings;
}
std::shared_ptr<QvPluginEventHandler> QvSSPlugin::GetEventHandler()
{
return eventHandler;
}
std::unique_ptr<QWidget> QvSSPlugin::GetSettingsWidget()
{
return nullptr;
}
std::unique_ptr<QvPluginEditor> QvSSPlugin::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<SSOutboundEditor>();
}
}
return nullptr;
}
} // namespace SSRPlugin