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

Commit

Permalink
add: adapt plugin interface V2
Browse files Browse the repository at this point in the history
  • Loading branch information
Qv2ray-dev authored and Qv2ray-dev committed May 17, 2020
1 parent 59450df commit 9ab40d3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CommandPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

CommandPlugin *CommandPlugin::instance = nullptr;

std::shared_ptr<QvPluginKernel> CommandPlugin::GetKernel()
std::unique_ptr<QvPluginKernel> CommandPlugin::CreateKernel()
{
return nullptr;
}
Expand Down
2 changes: 1 addition & 1 deletion CommandPlugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class CommandPlugin
};
}
//
std::shared_ptr<QvPluginKernel> GetKernel() override;
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;
Expand Down
25 changes: 15 additions & 10 deletions core/EventHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ QvPlugin_EventHandler(SimpleEventHandler, Connectivity)
QStringList actions;
switch (pluginEvent.eventType)
{
case Events::Connectivity::QvConnecticity_Connected:
case Events::Connectivity::Connected:
{
actions << settings.afterConnection.split(QRegExp("[\r\n]"), QString::SkipEmptyParts);
break;
}
case Events::Connectivity::QvConnecticity_Connecting:
case Events::Connectivity::Connecting:
{
actions << settings.beforeConnection.split(QRegExp("[\r\n]"), QString::SkipEmptyParts);
break;
}
case Events::Connectivity::QvConnecticity_Disconnected:
case Events::Connectivity::Disconnected:
{
actions << settings.afterDisConnection.split(QRegExp("[\r\n]"), QString::SkipEmptyParts);
break;
}
case Events::Connectivity::QvConnecticity_Disconnecting:
case Events::Connectivity::Disconnecting:
{
actions << settings.beforeDisConnection.split(QRegExp("[\r\n]"), QString::SkipEmptyParts);
break;
Expand Down Expand Up @@ -76,12 +76,12 @@ QvPlugin_EventHandler(SimpleEventHandler, SystemProxy)
QStringList actions;
switch (pluginEvent.systemProxyState)
{
case Events::SystemProxy::SystemProxyState_SetProxy:
case Events::SystemProxy::SetProxy:
{
actions << settings.setSystemProxy.split(QRegExp("[\r\n]"), QString::SkipEmptyParts);
break;
}
case Events::SystemProxy::SystemProxyState_ClearProxy:
case Events::SystemProxy::ClearProxy:
{
actions << settings.clearSystemProxy.split(QRegExp("[\r\n]"), QString::SkipEmptyParts);
break;
Expand Down Expand Up @@ -119,26 +119,31 @@ QvPlugin_EventHandler(SimpleEventHandler, ConnectionEntry)
QStringList actions;
switch (pluginEvent.eventType)
{
case Events::ConnectionEntry::ConnectionEvent_Created:
case Events::ConnectionEntry::Created:
{
actions << settings.connectionCreated.split(QRegExp("[\r\n]"), QString::SkipEmptyParts);
break;
}
case Events::ConnectionEntry::ConnectionEvent_Deleted:
case Events::ConnectionEntry::FullyRemoved:
case Events::ConnectionEntry::RemovedFromGroup:
{
actions << settings.connectionDeleted.split(QRegExp("[\r\n]"), QString::SkipEmptyParts);
break;
}
case Events::ConnectionEntry::ConnectionEvent_Renamed:
case Events::ConnectionEntry::Renamed:
{
actions << settings.connectionRenamed.split(QRegExp("[\r\n]"), QString::SkipEmptyParts);
break;
}
case Events::ConnectionEntry::ConnectionEvent_Updated:
case Events::ConnectionEntry::Edited:
{
actions << settings.connectionUpdated.split(QRegExp("[\r\n]"), QString::SkipEmptyParts);
break;
}
case Events::ConnectionEntry::LinkedWithGroup:
{
break;
}
}
for (const auto &action : actions)
{
Expand Down
2 changes: 1 addition & 1 deletion interface

0 comments on commit 9ab40d3

Please sign in to comment.