bigsnitch/pluginhandler.cpp
2021-01-09 11:17:50 +01:00

28 lines
635 B
C++

#include "pluginhandler.h"
/*
const auto staticInstances = QPluginLoader::staticInstances();
for (QObject *plugin : staticInstances)
populateMenus(plugin);
*/
bool PluginHandler::load(QString path)
{
QPluginLoader loader(path);
QObject *plugin = loader.instance();
if (plugin) {
proxyhandler.loadPlugin(plugin);
loaded_plugins += path;
return true;
}
return false;
}
void PluginHandler::loadPlugins(QDir path)
{
const auto entryList = path.entryList(QDir::Files);
for (const QString &fileName : entryList) {
load(path.absoluteFilePath(fileName));
}
}