some improvements for developing plugins

This commit is contained in:
Michael Zanetti 2017-06-13 12:08:28 +02:00
parent 7e68f5cac2
commit 4355be5b4b
3 changed files with 28 additions and 1 deletions

22
doc/test-plugin.qdoc Normal file
View File

@ -0,0 +1,22 @@
/*!
\page test-plugin.html
\title Testing your plugin
\brief This page describes how to test your plugin that you've just created
In order to make guhd load your plugin, you have 2 options. Either install it into the system or make guhd load it from your plugin build directory.
To install the plugin into the system, run
\code
$ make install
\endcode
To make guhd load the plugin from the plugins build directory, run guhd with an environment variable exported
\code
$ GUH_PLUGINS_DIR=/path/to/plugin/ guhd
\endcode
In order to easier debug things, it is advised to enable debug output for the device manager and your plugin. E.g.
\code
$ GUH_PLUGINS_DIR=/path/to/plugin guhd -d DeviceManager,YourPlugin
\endcode
*/

View File

@ -7,6 +7,7 @@
\li \l{Getting started}
\li \l{The plugin JSON File}
\li \l{CreateMethods and SetupMethods}
\li \l{Testing your plugin}
\li \l{Tutorials}
\list
\li \l{Tutorial 1 - The "Minimal" plugin}

View File

@ -257,6 +257,10 @@ DeviceManager::~DeviceManager()
QStringList DeviceManager::pluginSearchDirs()
{
QStringList searchDirs;
QByteArray envPath = qgetenv("GUH_PLUGINS_PATH");
if (!envPath.isEmpty()) {
searchDirs << envPath;
}
searchDirs << QCoreApplication::applicationDirPath() + "/../lib/guh/plugins";
searchDirs << QCoreApplication::applicationDirPath() + "/../plugins/";
searchDirs << QCoreApplication::applicationDirPath() + "/../plugins/deviceplugins";
@ -1025,7 +1029,7 @@ void DeviceManager::loadPlugins()
loader.setLoadHints(QLibrary::ResolveAllSymbolsHint);
if (!loader.load()) {
qCWarning(dcDeviceManager) << "Could not load plugin data of" << entry;
qCWarning(dcDeviceManager) << "Could not load plugin data of" << entry << "\n" << loader.errorString();
continue;
}