Verified Commit 838e832e authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

Remove unneeded service types from plugins

The service type is not required if the plugins are installed in a
specific directory
parent 1ae37cc5
......@@ -59,9 +59,6 @@
"Name[x-test]": "xxAssign Values Pluginxx",
"Name[zh_CN]": "分配值插件",
"Name[zh_TW]": "指定值外掛程式",
"ServiceTypes": [
"rocs/editorplugins"
],
"Version": "0.2"
}
}
......@@ -52,28 +52,16 @@ QList<EditorPluginInterface*> EditorPluginManager::plugins() const
void EditorPluginManager::loadPlugins()
{
// remove all present plugins
foreach(EditorPluginInterface *f, d->m_plugins) {
delete f;
}
qDeleteAll(d->m_plugins);
d->m_plugins.clear();
// dirs to check for plugins
QStringList dirsToCheck;
foreach (const QString &directory, QCoreApplication::libraryPaths()) {
dirsToCheck << directory + QDir::separator() + "rocs/editorplugins";
}
// load plugins
foreach (const QString &dir, dirsToCheck) {
QVector<KPluginMetaData> metadataList = KPluginLoader::findPlugins(dir,[=](const KPluginMetaData &data){
return data.serviceTypes().contains("rocs/editorplugins");
});
for (const auto &metadata : metadataList) {
KPluginFactory *factory = KPluginLoader(metadata.fileName()).factory();
EditorPluginInterface *plugin = factory->create<EditorPluginInterface>(this);
plugin->setDisplayName(metadata.name());
d->m_plugins.append(plugin);
qCDebug(GRAPHTHEORY_GENERAL) << "Loaded plugin:" << metadata.name();
}
const QVector<KPluginMetaData> metadataList = KPluginLoader::findPlugins(QStringLiteral("rocs/editorplugins"));
for (const auto &metadata : metadataList) {
KPluginFactory *factory = KPluginLoader(metadata.fileName()).factory();
EditorPluginInterface *plugin = factory->create<EditorPluginInterface>(this);
plugin->setDisplayName(metadata.name());
d->m_plugins.append(plugin);
qCDebug(GRAPHTHEORY_GENERAL) << "Loaded plugin:" << metadata.name();
}
}
......@@ -22,8 +22,7 @@ class EditorPluginManagerPrivate;
/** \class EditorPluginManager
* The EditorPluginManager provides access to all graph editor plugins. The backend manager loads
* plugins on creation. For loading, the path "$QT_PLUGIN_PATH/rocs/fileformats" is searched for all
* plugins of ServiceType "rocs/plugins".
* plugins on creation. For loading, the path "$QT_PLUGIN_PATH/rocs/fileformats" is searched for all plugins.
*/
class GRAPHTHEORY_EXPORT EditorPluginManager : public QObject
{
......
......@@ -71,9 +71,6 @@
"Name[x-test]": "xxGenerate Graphxx",
"Name[zh_CN]": "生成图",
"Name[zh_TW]": "產生圖形",
"ServiceTypes": [
"rocs/editorplugins"
],
"Version": "0.2"
}
}
......@@ -38,9 +38,6 @@
"Name[sv]": "Graflayout",
"Name[uk]": "Компонування графу",
"Name[x-test]": "xxGraph Layoutxx",
"ServiceTypes": [
"rocs/editorplugins"
],
"Version": "0.1"
}
}
......@@ -67,9 +67,6 @@
"Name[x-test]": "xxTransform Edgesxx",
"Name[zh_CN]": "转换边",
"Name[zh_TW]": "轉換邊緣",
"ServiceTypes": [
"rocs/editorplugins"
],
"Version": "0.2"
}
}
......@@ -60,9 +60,6 @@
"Name[x-test]": "xxDOT Graph File Formatxx",
"Name[zh_CN]": "DOT 图形文件格式",
"Name[zh_TW]": "DOT 圖形檔案格式",
"ServiceTypes": [
"rocs/graphtheory/fileformat"
],
"Version": "0.1"
}
}
......@@ -88,16 +88,11 @@ void FileFormatManager::loadBackends()
}
d->backends.clear();
QVector<KPluginMetaData> metadataList = KPluginLoader::findPlugins(
"rocs/fileformats",
[](const KPluginMetaData &data){
return data.serviceTypes().contains("rocs/graphtheory/fileformat");
}
);
const QVector<KPluginMetaData> metadataList = KPluginLoader::findPlugins("rocs/fileformats");
QPluginLoader loader;
foreach (const auto &metadata, metadataList) {
for (const auto &metadata : metadataList) {
loader.setFileName(metadata.fileName());
qCDebug(GRAPHTHEORY_FILEFORMAT) << "Load Plugin: " << metadata.name();
......
......@@ -22,8 +22,7 @@ class FileFormatManagerPrivate;
/** \class FileFormatManager
* The FileFormatManager provides access to all graph file format plugins. The backend manager loads
* plugins on creation. For loading, the path "$QT_PLUGIN_PATH/rocs/fileformats" is searched for all
* plugins of ServiceType "rocs/graphtheory/fileformat".
* plugins on creation. For loading, the path "$QT_PLUGIN_PATH/rocs/fileformats" is searched for all plugins.
*/
class GRAPHTHEORY_EXPORT FileFormatManager : public QObject
{
......
......@@ -60,9 +60,6 @@
"Name[x-test]": "xxGML File Formatxx",
"Name[zh_CN]": "GML 文件格式",
"Name[zh_TW]": "GML 檔案格式",
"ServiceTypes": [
"rocs/graphtheory/fileformat"
],
"Version": "0.1"
}
}
......@@ -60,9 +60,6 @@
"Name[x-test]": "xxRocs File Format (old)xx",
"Name[zh_CN]": "Rocs 文件格式 (旧版)",
"Name[zh_TW]": "Rocs 檔案格式(舊)",
"ServiceTypes": [
"rocs/graphtheory/fileformat"
],
"Version": "0.1"
}
}
......@@ -60,9 +60,6 @@
"Name[x-test]": "xxRocs File Formatxx",
"Name[zh_CN]": "Rocs 文件格式",
"Name[zh_TW]": "Rocs 檔案格式",
"ServiceTypes": [
"rocs/graphtheory/fileformat"
],
"Version": "0.1"
}
}
......@@ -59,9 +59,6 @@
"Name[x-test]": "xxTGF Graph File Formatxx",
"Name[zh_CN]": "TGF 图形文件格式",
"Name[zh_TW]": "TGF 圖形檔案格式",
"ServiceTypes": [
"rocs/graphtheory/fileformat"
],
"Version": "0.1"
}
}
......@@ -59,9 +59,6 @@
"Name[x-test]": "xxPGF/TikZ Graph File Export Pluginxx",
"Name[zh_CN]": "PGF/TikZ 图形文件导出插件",
"Name[zh_TW]": "PGF/TikZ 圖形檔匯出外掛程式",
"ServiceTypes": [
"rocs/graphtheory/fileformat"
],
"Version": "0.1"
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment