diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2017-03-06 15:12:37 +0100 |
---|---|---|
committer | Andy Nichols <andy.nichols@qt.io> | 2017-03-17 13:50:13 +0000 |
commit | 752d4319660daf69c725103dae5325cf898adbb5 (patch) | |
tree | 241d7f9d61d6a0cdaa12c73745c5d80cb579ae4b | |
parent | 72be0422f98cdcfa09b7aa019ce51ac473569db5 (diff) |
Fix build with -no-feature-library5.8
The previous code produced warnings about unused parameters. We can
actually load (static) plugins without QLibrary. Try to do so and warn
if we are trying to load from a specific location.
Change-Id: Icd396f1e4bb2d5200b1693d2230d87b502aa275b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
-rw-r--r-- | src/gamepad/qgamepadbackendfactory.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/gamepad/qgamepadbackendfactory.cpp b/src/gamepad/qgamepadbackendfactory.cpp index 25a1064..988de68 100644 --- a/src/gamepad/qgamepadbackendfactory.cpp +++ b/src/gamepad/qgamepadbackendfactory.cpp @@ -38,22 +38,23 @@ #include "qgamepadbackendplugin_p.h" #include "qgamepadbackend_p.h" +#include <QtCore/qdebug.h> #include <QtCore/private/qfactoryloader_p.h> #include <QtCore/QCoreApplication> #include <QtCore/QDir> QT_BEGIN_NAMESPACE -#ifndef QT_NO_LIBRARY Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QtGamepadBackendFactoryInterface_iid, QLatin1String("/gamepads"), Qt::CaseInsensitive)) +#if QT_CONFIG(library) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, (QtGamepadBackendFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive)) #endif QStringList QGamepadBackendFactory::keys(const QString &pluginPath) { -#ifndef QT_NO_LIBRARY QStringList list; if (!pluginPath.isEmpty()) { +#if QT_CONFIG(library) QCoreApplication::addLibraryPath(pluginPath); list = directLoader()->keyMap().values(); if (!list.isEmpty()) { @@ -64,25 +65,29 @@ QStringList QGamepadBackendFactory::keys(const QString &pluginPath) for (QStringList::iterator it = list.begin(); it != end; ++it) (*it).append(postFix); } +#else + qWarning("Cannot query QGamepadBackend plugins at %s: Library loading is disabled.", + pluginPath.toLocal8Bit().constData()); +#endif } list.append(loader()->keyMap().values()); return list; -#else - return QStringList(); -#endif } QGamepadBackend *QGamepadBackendFactory::create(const QString &name, const QStringList &args, const QString &pluginPath) { -#ifndef QT_NO_LIBRARY if (!pluginPath.isEmpty()) { +#if QT_CONFIG(library) QCoreApplication::addLibraryPath(pluginPath); if (QGamepadBackend *ret = qLoadPlugin<QGamepadBackend, QGamepadBackendPlugin>(directLoader(), name, args)) return ret; +#else + qWarning("Cannot load QGamepadBackend plugin from %s. Library loading is disabled.", + pluginPath.toLocal8Bit().constData()); +#endif } if (QGamepadBackend *ret = qLoadPlugin<QGamepadBackend, QGamepadBackendPlugin>(loader(), name, args)) return ret; -#endif return 0; } |