1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-29 11:18:56 -05:00

Server: pass plugins subdirectory to the PluginManager::loadPlugins method

This commit is contained in:
f4exb 2017-12-17 10:36:22 +01:00
parent eceb3ac68d
commit f2cdacb057
3 changed files with 10 additions and 10 deletions

View File

@ -53,18 +53,18 @@ PluginManager::~PluginManager()
// freeAll(); // freeAll();
} }
void PluginManager::loadPlugins() void PluginManager::loadPlugins(const QString& pluginsSubDir)
{ {
QString applicationDirPath = QCoreApplication::instance()->applicationDirPath(); QString applicationDirPath = QCoreApplication::instance()->applicationDirPath();
QString applicationLibPath = applicationDirPath + "/../lib/plugins"; QString applicationLibPath = applicationDirPath + "/../lib/" + pluginsSubDir;
QString applicationBuildPath = applicationDirPath + "/plugins"; QString applicationBuildPath = applicationDirPath + "/" + pluginsSubDir;
qDebug() << "PluginManager::loadPlugins: " << qPrintable(applicationLibPath) << "," << qPrintable(applicationBuildPath); qDebug() << "PluginManager::loadPlugins: " << qPrintable(applicationLibPath) << "," << qPrintable(applicationBuildPath);
QDir pluginsLibDir = QDir(applicationLibPath); QDir pluginsLibDir = QDir(applicationLibPath);
QDir pluginsBuildDir = QDir(applicationBuildPath); QDir pluginsBuildDir = QDir(applicationBuildPath);
loadPlugins(pluginsLibDir); loadPluginsDir(pluginsLibDir);
loadPlugins(pluginsBuildDir); loadPluginsDir(pluginsBuildDir);
qSort(m_plugins); qSort(m_plugins);
@ -113,7 +113,7 @@ void PluginManager::registerSampleSink(const QString& sinkName, PluginInterface*
m_sampleSinkRegistrations.append(PluginAPI::SamplingDeviceRegistration(sinkName, plugin)); m_sampleSinkRegistrations.append(PluginAPI::SamplingDeviceRegistration(sinkName, plugin));
} }
void PluginManager::loadPlugins(const QDir& dir) void PluginManager::loadPluginsDir(const QDir& dir)
{ {
QDir pluginsDir(dir); QDir pluginsDir(dir);
@ -152,7 +152,7 @@ void PluginManager::loadPlugins(const QDir& dir)
foreach (QString dirName, pluginsDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) foreach (QString dirName, pluginsDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot))
{ {
loadPlugins(pluginsDir.absoluteFilePath(dirName)); loadPluginsDir(pluginsDir.absoluteFilePath(dirName));
} }
} }

View File

@ -42,7 +42,7 @@ public:
~PluginManager(); ~PluginManager();
PluginAPI *getPluginAPI() { return &m_pluginAPI; } PluginAPI *getPluginAPI() { return &m_pluginAPI; }
void loadPlugins(); void loadPlugins(const QString& pluginsSubDir);
const Plugins& getPlugins() const { return m_plugins; } const Plugins& getPlugins() const { return m_plugins; }
// Callbacks from the plugins // Callbacks from the plugins
@ -112,7 +112,7 @@ private:
static const QString m_fileSinkHardwareID; //!< FileSource source hardware ID static const QString m_fileSinkHardwareID; //!< FileSource source hardware ID
static const QString m_fileSinkDeviceTypeID; //!< FileSink sink plugin ID static const QString m_fileSinkDeviceTypeID; //!< FileSink sink plugin ID
void loadPlugins(const QDir& dir); void loadPluginsDir(const QDir& dir);
}; };
static inline bool operator<(const PluginManager::Plugin& a, const PluginManager::Plugin& b) static inline bool operator<(const PluginManager::Plugin& a, const PluginManager::Plugin& b)

View File

@ -134,7 +134,7 @@ MainWindow::MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parse
"QTabBar::tab:selected { background: rgb(100,100,100); }"); "QTabBar::tab:selected { background: rgb(100,100,100); }");
m_pluginManager = new PluginManager(this); m_pluginManager = new PluginManager(this);
m_pluginManager->loadPlugins(); m_pluginManager->loadPlugins(QString("plugins"));
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleMessages()), Qt::QueuedConnection); connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleMessages()), Qt::QueuedConnection);