mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-19 18:30:34 +08:00
update: adapt interface draft-2.2
This commit is contained in:
parent
28a7989cd2
commit
75db4ed766
@ -1 +1 @@
|
|||||||
5223
|
5224
|
@ -48,28 +48,28 @@ namespace Qv2ray::components::plugins
|
|||||||
info.pluginLoader->unload();
|
info.pluginLoader->unload();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (plugins.contains(info.pluginInterface->InternalName()))
|
info.metadata = info.pluginInterface->GetMetadata();
|
||||||
|
if (plugins.contains(info.metadata.InternalName))
|
||||||
{
|
{
|
||||||
LOG(MODULE_PLUGINHOST,
|
LOG(MODULE_PLUGINHOST, "Found another plugin with the same internal name: " + info.metadata.InternalName + ". Skipped")
|
||||||
"Found another plugin with the same internal name: " + info.pluginInterface->InternalName() + ". Skipped")
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.pluginInterface->QvPluginInterfaceVersion != QV2RAY_PLUGIN_INTERFACE_VERSION)
|
if (info.pluginInterface->QvPluginInterfaceVersion != QV2RAY_PLUGIN_INTERFACE_VERSION)
|
||||||
{
|
{
|
||||||
// The plugin was built for a not-compactable version of Qv2ray. Don't load the plugin by default.
|
// The plugin was built for a not-compactable version of Qv2ray. Don't load the plugin by default.
|
||||||
LOG(MODULE_PLUGINHOST, "The plugin " + info.pluginInterface->InternalName() +
|
LOG(MODULE_PLUGINHOST, "The plugin " + info.metadata.InternalName +
|
||||||
" is not loaded since it was built against a different version of interface")
|
" is not loaded since it was built against a different version of interface")
|
||||||
info.errorMessage = tr("This plugin was built against an incompactable version of Qv2ray Plugin Interface.") + NEWLINE +
|
info.errorMessage = tr("This plugin was built against an incompactable version of Qv2ray Plugin Interface.") + NEWLINE +
|
||||||
QObject::tr("Please contact the plugin provider or report the issue to Qv2ray Workgroup.");
|
QObject::tr("Please contact the plugin provider or report the issue to Qv2ray Workgroup.");
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(info.pluginInterface->GetQObject(), SIGNAL(PluginLog(const QString &)), this, SLOT(QvPluginLog(const QString &)));
|
connect(dynamic_cast<QObject *>(info.pluginInterface), SIGNAL(PluginLog(const QString &)), this,
|
||||||
connect(info.pluginInterface->GetQObject(), SIGNAL(PluginErrorMessageBox(const QString &)), this,
|
SLOT(QvPluginLog(const QString &)));
|
||||||
|
connect(dynamic_cast<QObject *>(info.pluginInterface), SIGNAL(PluginErrorMessageBox(const QString &)), this,
|
||||||
SLOT(QvPluginMessageBox(const QString &)));
|
SLOT(QvPluginMessageBox(const QString &)));
|
||||||
LOG(MODULE_PLUGINHOST,
|
LOG(MODULE_PLUGINHOST, "Loaded plugin: \"" + info.metadata.Name + "\" made by: \"" + info.metadata.Author + "\"")
|
||||||
"Loaded plugin: \"" + info.pluginInterface->Name() + "\" made by: \"" + info.pluginInterface->Author() + "\"")
|
plugins.insert(info.metadata.InternalName, info);
|
||||||
plugins.insert(info.pluginInterface->InternalName(), info);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return plugins.count();
|
return plugins.count();
|
||||||
@ -78,7 +78,7 @@ namespace Qv2ray::components::plugins
|
|||||||
const QString QvPluginHost::GetPluginTypeString(const QString &internalName) const
|
const QString QvPluginHost::GetPluginTypeString(const QString &internalName) const
|
||||||
{
|
{
|
||||||
QStringList types;
|
QStringList types;
|
||||||
for (auto type : plugins.value(internalName).pluginInterface->SpecialPluginType())
|
for (auto type : plugins.value(internalName).metadata.SpecialPluginType)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
@ -94,15 +94,15 @@ namespace Qv2ray::components::plugins
|
|||||||
const QString QvPluginHost::GetPluginHookTypeString(const QString &internalName) const
|
const QString QvPluginHost::GetPluginHookTypeString(const QString &internalName) const
|
||||||
{
|
{
|
||||||
QStringList hooks;
|
QStringList hooks;
|
||||||
for (auto hook : plugins.value(internalName).pluginInterface->PluginHooks())
|
for (auto hook : plugins.value(internalName).metadata.Capabilities)
|
||||||
{
|
{
|
||||||
switch (hook)
|
switch (hook)
|
||||||
{
|
{
|
||||||
case PROCESSTYPE_NONE: hooks << tr("No hook"); break;
|
case CAPABILITY_NONE: hooks << tr("No hook"); break;
|
||||||
case PROCESSTYPE_CONNECTIVITY: hooks << tr("Connection State Change"); break;
|
case CAPABILITY_CONNECTIVITY: hooks << tr("Connection State Change"); break;
|
||||||
case PROCESSTYPE_ITEM: hooks << tr("Connection Change"); break;
|
case CAPABILITY_CONNECTION_ENTRY: hooks << tr("Connection Change"); break;
|
||||||
case PROCESSTYPE_STATS: hooks << tr("Statistics Event"); break;
|
case CAPABILITY_STATS: hooks << tr("Statistics Event"); break;
|
||||||
case PROCESSTYPE_SYSTEMPROXY: hooks << tr("System Proxy"); break;
|
case CAPABILITY_SYSTEM_PROXY: hooks << tr("System Proxy"); break;
|
||||||
default: hooks << tr("Unknown/unsupported hook type."); break;
|
default: hooks << tr("Unknown/unsupported hook type."); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -114,7 +114,7 @@ namespace Qv2ray::components::plugins
|
|||||||
auto _sender = sender();
|
auto _sender = sender();
|
||||||
if (auto _interface = qobject_cast<Qv2rayInterface *>(_sender); _interface)
|
if (auto _interface = qobject_cast<Qv2rayInterface *>(_sender); _interface)
|
||||||
{
|
{
|
||||||
LOG(MODULE_PLUGINCLIENT + "-" + _interface->InternalName(), log)
|
LOG(MODULE_PLUGINCLIENT + "-" + _interface->GetMetadata().InternalName, log)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -127,7 +127,7 @@ namespace Qv2ray::components::plugins
|
|||||||
auto _sender = sender();
|
auto _sender = sender();
|
||||||
if (auto _interface = qobject_cast<Qv2rayInterface *>(_sender); _interface)
|
if (auto _interface = qobject_cast<Qv2rayInterface *>(_sender); _interface)
|
||||||
{
|
{
|
||||||
QvMessageBoxWarn(nullptr, _interface->InternalName(), msg);
|
QvMessageBoxWarn(nullptr, _interface->GetMetadata().Name, msg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -164,7 +164,7 @@ namespace Qv2ray::components::plugins
|
|||||||
{
|
{
|
||||||
for (auto &&plugin : plugins)
|
for (auto &&plugin : plugins)
|
||||||
{
|
{
|
||||||
DEBUG(MODULE_PLUGINHOST, "Unloading: \"" + plugin.pluginInterface->Name() + "\"")
|
DEBUG(MODULE_PLUGINHOST, "Unloading: \"" + plugin.metadata.Name + "\"")
|
||||||
plugin.pluginLoader->unload();
|
plugin.pluginLoader->unload();
|
||||||
plugin.pluginLoader->deleteLater();
|
plugin.pluginLoader->deleteLater();
|
||||||
}
|
}
|
||||||
@ -191,7 +191,7 @@ namespace Qv2ray::components::plugins
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto conf = JsonFromString(StringFromFile(QV2RAY_PLUGIN_SETTINGS_DIR + internalName + ".conf"));
|
auto conf = JsonFromString(StringFromFile(QV2RAY_PLUGIN_SETTINGS_DIR + internalName + ".conf"));
|
||||||
plugins[internalName].pluginInterface->InitializePlugin(QV2RAY_PLUGIN_SETTINGS_DIR + internalName + "/", conf);
|
plugins[internalName].pluginInterface->Initialize(QV2RAY_PLUGIN_SETTINGS_DIR + internalName + "/", conf);
|
||||||
plugins[internalName].isLoaded = true;
|
plugins[internalName].isLoaded = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -201,7 +201,7 @@ namespace Qv2ray::components::plugins
|
|||||||
for (auto name : plugins.keys())
|
for (auto name : plugins.keys())
|
||||||
{
|
{
|
||||||
LOG(MODULE_PLUGINHOST, "Saving plugin settings for: \"" + name + "\"")
|
LOG(MODULE_PLUGINHOST, "Saving plugin settings for: \"" + name + "\"")
|
||||||
auto &conf = plugins[name].pluginInterface->GetPluginSettngs();
|
auto &conf = plugins[name].pluginInterface->GetSettngs();
|
||||||
StringToFile(JsonToString(conf), QV2RAY_PLUGIN_SETTINGS_DIR + name + ".conf");
|
StringToFile(JsonToString(conf), QV2RAY_PLUGIN_SETTINGS_DIR + name + ".conf");
|
||||||
}
|
}
|
||||||
ClearPlugins();
|
ClearPlugins();
|
||||||
@ -212,9 +212,9 @@ namespace Qv2ray::components::plugins
|
|||||||
{
|
{
|
||||||
for (auto &plugin : plugins)
|
for (auto &plugin : plugins)
|
||||||
{
|
{
|
||||||
if (plugin.pluginInterface->PluginHooks().contains(QV2RAY_PLUGIN_PROCESSTYPE::PROCESSTYPE_STATS))
|
if (plugin.metadata.Capabilities.contains(CAPABILITY_STATS))
|
||||||
{
|
{
|
||||||
plugin.pluginInterface->PluginProcessor()->ProcessEvent_ConnectionStats(object);
|
plugin.pluginInterface->GetEventHandler()->ProcessEvent_ConnectionStats(object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -222,19 +222,19 @@ namespace Qv2ray::components::plugins
|
|||||||
{
|
{
|
||||||
for (auto &plugin : plugins)
|
for (auto &plugin : plugins)
|
||||||
{
|
{
|
||||||
if (plugin.pluginInterface->PluginHooks().contains(QV2RAY_PLUGIN_PROCESSTYPE::PROCESSTYPE_CONNECTIVITY))
|
if (plugin.metadata.Capabilities.contains(CAPABILITY_CONNECTIVITY))
|
||||||
{
|
{
|
||||||
plugin.pluginInterface->PluginProcessor()->ProcessEvent_Connectivity(object);
|
plugin.pluginInterface->GetEventHandler()->ProcessEvent_Connectivity(object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void QvPluginHost::Send_ItemEvent(const QvItemEventObject &object)
|
void QvPluginHost::Send_ConnectionEvent(const QvConnectionEntryEventObject &object)
|
||||||
{
|
{
|
||||||
for (auto &plugin : plugins)
|
for (auto &plugin : plugins)
|
||||||
{
|
{
|
||||||
if (plugin.pluginInterface->PluginHooks().contains(QV2RAY_PLUGIN_PROCESSTYPE::PROCESSTYPE_ITEM))
|
if (plugin.metadata.Capabilities.contains(CAPABILITY_CONNECTION_ENTRY))
|
||||||
{
|
{
|
||||||
plugin.pluginInterface->PluginProcessor()->ProcessEvent_Item(object);
|
plugin.pluginInterface->GetEventHandler()->ProcessEvent_ConnectionEntry(object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -242,9 +242,9 @@ namespace Qv2ray::components::plugins
|
|||||||
{
|
{
|
||||||
for (auto &plugin : plugins)
|
for (auto &plugin : plugins)
|
||||||
{
|
{
|
||||||
if (plugin.pluginInterface->PluginHooks().contains(QV2RAY_PLUGIN_PROCESSTYPE::PROCESSTYPE_SYSTEMPROXY))
|
if (plugin.metadata.Capabilities.contains(CAPABILITY_SYSTEM_PROXY))
|
||||||
{
|
{
|
||||||
plugin.pluginInterface->PluginProcessor()->ProcessEvent_SystemProxy(object);
|
plugin.pluginInterface->GetEventHandler()->ProcessEvent_SystemProxy(object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ namespace Qv2ray::components::plugins
|
|||||||
bool isLoaded = false;
|
bool isLoaded = false;
|
||||||
QString libraryPath;
|
QString libraryPath;
|
||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
|
QvPluginMetadata metadata;
|
||||||
QPluginLoader *pluginLoader;
|
QPluginLoader *pluginLoader;
|
||||||
Qv2rayInterface *pluginInterface;
|
Qv2rayInterface *pluginInterface;
|
||||||
};
|
};
|
||||||
@ -41,7 +42,7 @@ namespace Qv2ray::components::plugins
|
|||||||
//
|
//
|
||||||
void Send_ConnectionStatsEvent(const QvConnectionStatsEventObject &object);
|
void Send_ConnectionStatsEvent(const QvConnectionStatsEventObject &object);
|
||||||
void Send_ConnectivityEvent(const QvConnectivityEventObject &object);
|
void Send_ConnectivityEvent(const QvConnectivityEventObject &object);
|
||||||
void Send_ItemEvent(const QvItemEventObject &object);
|
void Send_ConnectionEvent(const QvConnectionEntryEventObject &object);
|
||||||
void Send_SystemProxyEvent(const QvSystemProxyEventObject &object);
|
void Send_SystemProxyEvent(const QvSystemProxyEventObject &object);
|
||||||
//
|
//
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit e60b7a06c9b9ba79498500a07b20d2bef44da34e
|
Subproject commit 05cec33cc42bf291de0115f799b5d10920715182
|
@ -223,7 +223,7 @@ namespace Qv2ray::core::handlers
|
|||||||
{
|
{
|
||||||
CheckConnectionExistance(id);
|
CheckConnectionExistance(id);
|
||||||
OnConnectionRenamed(id, connections[id].displayName, newName);
|
OnConnectionRenamed(id, connections[id].displayName, newName);
|
||||||
PluginHost->Send_ItemEvent({ newName, connections[id].displayName, ConnectionEvent_Renamed });
|
PluginHost->Send_ConnectionEvent({ newName, connections[id].displayName, ConnectionEvent_Renamed });
|
||||||
connections[id].displayName = newName;
|
connections[id].displayName = newName;
|
||||||
CHSaveConfigData_p();
|
CHSaveConfigData_p();
|
||||||
return {};
|
return {};
|
||||||
@ -235,7 +235,7 @@ namespace Qv2ray::core::handlers
|
|||||||
QFile connectionFile((groups[groupId].isSubscription ? QV2RAY_SUBSCRIPTION_DIR : QV2RAY_CONNECTIONS_DIR) + groupId.toString() + "/" +
|
QFile connectionFile((groups[groupId].isSubscription ? QV2RAY_SUBSCRIPTION_DIR : QV2RAY_CONNECTIONS_DIR) + groupId.toString() + "/" +
|
||||||
id.toString() + QV2RAY_CONFIG_FILE_EXTENSION);
|
id.toString() + QV2RAY_CONFIG_FILE_EXTENSION);
|
||||||
//
|
//
|
||||||
PluginHost->Send_ItemEvent({ connections[id].displayName, "", ConnectionEvent_Deleted });
|
PluginHost->Send_ConnectionEvent({ connections[id].displayName, "", ConnectionEvent_Deleted });
|
||||||
connections.remove(id);
|
connections.remove(id);
|
||||||
groups[groupId].connections.removeAll(id);
|
groups[groupId].connections.removeAll(id);
|
||||||
//
|
//
|
||||||
@ -283,7 +283,7 @@ namespace Qv2ray::core::handlers
|
|||||||
groups[newGroupId].connections.append(id);
|
groups[newGroupId].connections.append(id);
|
||||||
connections[id].groupId = newGroupId;
|
connections[id].groupId = newGroupId;
|
||||||
//
|
//
|
||||||
PluginHost->Send_ItemEvent({ connections[id].displayName, "", ConnectionEvent_Updated });
|
PluginHost->Send_ConnectionEvent({ connections[id].displayName, "", ConnectionEvent_Updated });
|
||||||
//
|
//
|
||||||
emit OnConnectionGroupChanged(id, oldgid, newGroupId);
|
emit OnConnectionGroupChanged(id, oldgid, newGroupId);
|
||||||
//
|
//
|
||||||
@ -314,7 +314,7 @@ namespace Qv2ray::core::handlers
|
|||||||
QDir(QV2RAY_CONNECTIONS_DIR + id.toString()).removeRecursively();
|
QDir(QV2RAY_CONNECTIONS_DIR + id.toString()).removeRecursively();
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
PluginHost->Send_ItemEvent({ groups[id].displayName, "", ConnectionEvent_Deleted });
|
PluginHost->Send_ConnectionEvent({ groups[id].displayName, "", ConnectionEvent_Deleted });
|
||||||
//
|
//
|
||||||
groups.remove(id);
|
groups.remove(id);
|
||||||
CHSaveConfigData_p();
|
CHSaveConfigData_p();
|
||||||
@ -407,7 +407,7 @@ namespace Qv2ray::core::handlers
|
|||||||
connectionRootCache[id] = root;
|
connectionRootCache[id] = root;
|
||||||
//
|
//
|
||||||
emit OnConnectionModified(id);
|
emit OnConnectionModified(id);
|
||||||
PluginHost->Send_ItemEvent({ connections[id].displayName, "", ConnectionEvent_Updated });
|
PluginHost->Send_ConnectionEvent({ connections[id].displayName, "", ConnectionEvent_Updated });
|
||||||
if (!skipRestart && id == currentConnectionId)
|
if (!skipRestart && id == currentConnectionId)
|
||||||
{
|
{
|
||||||
emit RestartConnection();
|
emit RestartConnection();
|
||||||
@ -421,7 +421,7 @@ namespace Qv2ray::core::handlers
|
|||||||
groups[id].displayName = displayName;
|
groups[id].displayName = displayName;
|
||||||
groups[id].isSubscription = isSubscription;
|
groups[id].isSubscription = isSubscription;
|
||||||
groups[id].importDate = system_clock::to_time_t(system_clock::now());
|
groups[id].importDate = system_clock::to_time_t(system_clock::now());
|
||||||
PluginHost->Send_ItemEvent({ displayName, "", ConnectionEvent_Created });
|
PluginHost->Send_ConnectionEvent({ displayName, "", ConnectionEvent_Created });
|
||||||
emit OnGroupCreated(id, displayName);
|
emit OnGroupCreated(id, displayName);
|
||||||
CHSaveConfigData_p();
|
CHSaveConfigData_p();
|
||||||
return id;
|
return id;
|
||||||
@ -435,7 +435,7 @@ namespace Qv2ray::core::handlers
|
|||||||
return tr("Group does not exist");
|
return tr("Group does not exist");
|
||||||
}
|
}
|
||||||
OnGroupRenamed(id, groups[id].displayName, newName);
|
OnGroupRenamed(id, groups[id].displayName, newName);
|
||||||
PluginHost->Send_ItemEvent({ newName, groups[id].displayName, ConnectionEvent_Renamed });
|
PluginHost->Send_ConnectionEvent({ newName, groups[id].displayName, ConnectionEvent_Renamed });
|
||||||
groups[id].displayName = newName;
|
groups[id].displayName = newName;
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@ -603,7 +603,7 @@ namespace Qv2ray::core::handlers
|
|||||||
connections[newId].importDate = system_clock::to_time_t(system_clock::now());
|
connections[newId].importDate = system_clock::to_time_t(system_clock::now());
|
||||||
connections[newId].displayName = displayName;
|
connections[newId].displayName = displayName;
|
||||||
emit OnConnectionCreated(newId, displayName);
|
emit OnConnectionCreated(newId, displayName);
|
||||||
PluginHost->Send_ItemEvent({ displayName, "", ConnectionEvent_Created });
|
PluginHost->Send_ConnectionEvent({ displayName, "", ConnectionEvent_Created });
|
||||||
UpdateConnection(newId, root);
|
UpdateConnection(newId, root);
|
||||||
CHSaveConfigData_p();
|
CHSaveConfigData_p();
|
||||||
return newId;
|
return newId;
|
||||||
|
@ -12,9 +12,9 @@ PluginManageWindow::PluginManageWindow(QWidget *parent) : QDialog(parent)
|
|||||||
{
|
{
|
||||||
const auto &info = PluginHost->GetPluginInfo(plugin);
|
const auto &info = PluginHost->GetPluginInfo(plugin);
|
||||||
auto item = new QListWidgetItem(pluginListWidget);
|
auto item = new QListWidgetItem(pluginListWidget);
|
||||||
item->setCheckState(PluginHost->GetPluginEnableState(info.pluginInterface->InternalName()) ? Qt::Checked : Qt::Unchecked);
|
item->setCheckState(PluginHost->GetPluginEnableState(info.metadata.InternalName) ? Qt::Checked : Qt::Unchecked);
|
||||||
item->setData(Qt::UserRole, info.pluginInterface->InternalName());
|
item->setData(Qt::UserRole, info.metadata.InternalName);
|
||||||
item->setText(info.pluginInterface->Name() + " (" + (info.isLoaded ? tr("Loaded") : tr("Not loaded")) + ")");
|
item->setText(info.metadata.Name + " (" + (info.isLoaded ? tr("Loaded") : tr("Not loaded")) + ")");
|
||||||
pluginListWidget->addItem(item);
|
pluginListWidget->addItem(item);
|
||||||
}
|
}
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
@ -30,15 +30,15 @@ void PluginManageWindow::on_pluginListWidget_currentItemChanged(QListWidgetItem
|
|||||||
auto &info = PluginHost->GetPluginInfo(current->data(Qt::UserRole).toString());
|
auto &info = PluginHost->GetPluginInfo(current->data(Qt::UserRole).toString());
|
||||||
if (info.pluginInterface)
|
if (info.pluginInterface)
|
||||||
{
|
{
|
||||||
pluginIconLabel->setPixmap(info.pluginInterface->Icon().pixmap(pluginIconLabel->size() * devicePixelRatio()));
|
pluginIconLabel->setPixmap(info.metadata.Icon.pixmap(pluginIconLabel->size() * devicePixelRatio()));
|
||||||
//
|
//
|
||||||
pluginNameLabel->setText(info.pluginInterface->Name());
|
pluginNameLabel->setText(info.metadata.Name);
|
||||||
pluginAuthorLabel->setText(info.pluginInterface->Author());
|
pluginAuthorLabel->setText(info.metadata.Author);
|
||||||
pluginDescriptionLabel->setText(info.pluginInterface->Description());
|
pluginDescriptionLabel->setText(info.metadata.Description);
|
||||||
pluginLibPathLabel->setText(info.libraryPath);
|
pluginLibPathLabel->setText(info.libraryPath);
|
||||||
pluginStateLabel->setText(info.isLoaded ? tr("Loaded") : tr("Not loaded"));
|
pluginStateLabel->setText(info.isLoaded ? tr("Loaded") : tr("Not loaded"));
|
||||||
pluginTypeLabel->setText(PluginHost->GetPluginTypeString(info.pluginInterface->InternalName()));
|
pluginTypeLabel->setText(PluginHost->GetPluginTypeString(info.metadata.InternalName));
|
||||||
pluginHookTypeLabel->setText(PluginHost->GetPluginHookTypeString(info.pluginInterface->InternalName()));
|
pluginHookTypeLabel->setText(PluginHost->GetPluginHookTypeString(info.metadata.InternalName));
|
||||||
pluginErrMessageTxt->setPlainText(info.errorMessage.isEmpty() ? "OK" : info.errorMessage);
|
pluginErrMessageTxt->setPlainText(info.errorMessage.isEmpty() ? "OK" : info.errorMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -56,7 +56,7 @@ void PluginManageWindow::on_pluginListWidget_itemChanged(QListWidgetItem *item)
|
|||||||
auto pluginInternalName = item->data(Qt::UserRole).toString();
|
auto pluginInternalName = item->data(Qt::UserRole).toString();
|
||||||
PluginHost->SetPluginEnableState(pluginInternalName, isEnabled);
|
PluginHost->SetPluginEnableState(pluginInternalName, isEnabled);
|
||||||
auto &info = PluginHost->GetPluginInfo(pluginInternalName);
|
auto &info = PluginHost->GetPluginInfo(pluginInternalName);
|
||||||
item->setText(info.pluginInterface->Name() + " (" + (info.isLoaded ? tr("Loaded") : tr("Not loaded")) + ")");
|
item->setText(info.metadata.Name + " (" + (info.isLoaded ? tr("Loaded") : tr("Not loaded")) + ")");
|
||||||
//
|
//
|
||||||
if (!isEnabled)
|
if (!isEnabled)
|
||||||
{
|
{
|
||||||
@ -96,11 +96,11 @@ void PluginManageWindow::on_pluginEditSettingsJsonBtn_clicked()
|
|||||||
tr("This plugin has been unloaded or has been disabled, please enable or reload the plugin to continue."));
|
tr("This plugin has been unloaded or has been disabled, please enable or reload the plugin to continue."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
JsonEditor w(info.pluginInterface->GetPluginSettngs());
|
JsonEditor w(info.pluginInterface->GetSettngs());
|
||||||
auto newConf = w.OpenEditor();
|
auto newConf = w.OpenEditor();
|
||||||
if (w.result() == QDialog::Accepted)
|
if (w.result() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
info.pluginInterface->UpdatePluginSettings(newConf);
|
info.pluginInterface->UpdateSettings(newConf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user