Skip to content
This repository was archived by the owner on Aug 18, 2021. It is now read-only.

Commit 9ab40d3

Browse files
Qv2ray-devQv2ray-dev
authored andcommitted
add: adapt plugin interface V2
1 parent 59450df commit 9ab40d3

File tree

4 files changed

+18
-13
lines changed

4 files changed

+18
-13
lines changed

CommandPlugin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
CommandPlugin *CommandPlugin::instance = nullptr;
66

7-
std::shared_ptr<QvPluginKernel> CommandPlugin::GetKernel()
7+
std::unique_ptr<QvPluginKernel> CommandPlugin::CreateKernel()
88
{
99
return nullptr;
1010
}

CommandPlugin.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class CommandPlugin
3535
};
3636
}
3737
//
38-
std::shared_ptr<QvPluginKernel> GetKernel() override;
38+
std::unique_ptr<QvPluginKernel> CreateKernel() override;
3939
std::shared_ptr<QvPluginSerializer> GetSerializer() override;
4040
std::shared_ptr<QvPluginEventHandler> GetEventHandler() override;
4141
std::unique_ptr<QvPluginEditor> GetEditorWidget(UI_TYPE) override;

core/EventHandler.cpp

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,22 @@ QvPlugin_EventHandler(SimpleEventHandler, Connectivity)
2020
QStringList actions;
2121
switch (pluginEvent.eventType)
2222
{
23-
case Events::Connectivity::QvConnecticity_Connected:
23+
case Events::Connectivity::Connected:
2424
{
2525
actions << settings.afterConnection.split(QRegExp("[\r\n]"), QString::SkipEmptyParts);
2626
break;
2727
}
28-
case Events::Connectivity::QvConnecticity_Connecting:
28+
case Events::Connectivity::Connecting:
2929
{
3030
actions << settings.beforeConnection.split(QRegExp("[\r\n]"), QString::SkipEmptyParts);
3131
break;
3232
}
33-
case Events::Connectivity::QvConnecticity_Disconnected:
33+
case Events::Connectivity::Disconnected:
3434
{
3535
actions << settings.afterDisConnection.split(QRegExp("[\r\n]"), QString::SkipEmptyParts);
3636
break;
3737
}
38-
case Events::Connectivity::QvConnecticity_Disconnecting:
38+
case Events::Connectivity::Disconnecting:
3939
{
4040
actions << settings.beforeDisConnection.split(QRegExp("[\r\n]"), QString::SkipEmptyParts);
4141
break;
@@ -76,12 +76,12 @@ QvPlugin_EventHandler(SimpleEventHandler, SystemProxy)
7676
QStringList actions;
7777
switch (pluginEvent.systemProxyState)
7878
{
79-
case Events::SystemProxy::SystemProxyState_SetProxy:
79+
case Events::SystemProxy::SetProxy:
8080
{
8181
actions << settings.setSystemProxy.split(QRegExp("[\r\n]"), QString::SkipEmptyParts);
8282
break;
8383
}
84-
case Events::SystemProxy::SystemProxyState_ClearProxy:
84+
case Events::SystemProxy::ClearProxy:
8585
{
8686
actions << settings.clearSystemProxy.split(QRegExp("[\r\n]"), QString::SkipEmptyParts);
8787
break;
@@ -119,26 +119,31 @@ QvPlugin_EventHandler(SimpleEventHandler, ConnectionEntry)
119119
QStringList actions;
120120
switch (pluginEvent.eventType)
121121
{
122-
case Events::ConnectionEntry::ConnectionEvent_Created:
122+
case Events::ConnectionEntry::Created:
123123
{
124124
actions << settings.connectionCreated.split(QRegExp("[\r\n]"), QString::SkipEmptyParts);
125125
break;
126126
}
127-
case Events::ConnectionEntry::ConnectionEvent_Deleted:
127+
case Events::ConnectionEntry::FullyRemoved:
128+
case Events::ConnectionEntry::RemovedFromGroup:
128129
{
129130
actions << settings.connectionDeleted.split(QRegExp("[\r\n]"), QString::SkipEmptyParts);
130131
break;
131132
}
132-
case Events::ConnectionEntry::ConnectionEvent_Renamed:
133+
case Events::ConnectionEntry::Renamed:
133134
{
134135
actions << settings.connectionRenamed.split(QRegExp("[\r\n]"), QString::SkipEmptyParts);
135136
break;
136137
}
137-
case Events::ConnectionEntry::ConnectionEvent_Updated:
138+
case Events::ConnectionEntry::Edited:
138139
{
139140
actions << settings.connectionUpdated.split(QRegExp("[\r\n]"), QString::SkipEmptyParts);
140141
break;
141142
}
143+
case Events::ConnectionEntry::LinkedWithGroup:
144+
{
145+
break;
146+
}
142147
}
143148
for (const auto &action : actions)
144149
{

0 commit comments

Comments
 (0)