Q{XcbGl,EglFSDevice}IntegrationFactory: remove unused extra plugin path

Cargo-cult copied this from somewhere, unnecessarily. This just made the
code bigger for no reason.

Task-number: QTBUG-97950
Pick-to: 6.2
Change-Id: Ice04365c72984d07a64dfffd16b48520d42c7043
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Thiago Macieira 2021-11-04 19:22:20 -07:00
parent b0dc6abfb2
commit 3ba1a196aa
4 changed files with 6 additions and 51 deletions

View File

@ -74,47 +74,17 @@ Q_LOGGING_CATEGORY(qLcEglDevDebug, "qt.qpa.egldeviceintegration")
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
(QEglFSDeviceIntegrationFactoryInterface_iid, QLatin1String("/egldeviceintegrations"), Qt::CaseInsensitive))
#if QT_CONFIG(library)
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
(QEglFSDeviceIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
#endif // QT_CONFIG(library)
QStringList QEglFSDeviceIntegrationFactory::keys(const QString &pluginPath)
QStringList QEglFSDeviceIntegrationFactory::keys()
{
QStringList list;
#if QT_CONFIG(library)
if (!pluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(pluginPath);
list = directLoader()->keyMap().values();
if (!list.isEmpty()) {
const QString postFix = QLatin1String(" (from ")
+ QDir::toNativeSeparators(pluginPath)
+ QLatin1Char(')');
const QStringList::iterator end = list.end();
for (QStringList::iterator it = list.begin(); it != end; ++it)
(*it).append(postFix);
}
}
#else
Q_UNUSED(pluginPath);
#endif
list.append(loader()->keyMap().values());
qCDebug(qLcEglDevDebug) << "EGL device integration plugin keys:" << list;
return list;
}
QEglFSDeviceIntegration *QEglFSDeviceIntegrationFactory::create(const QString &key, const QString &pluginPath)
QEglFSDeviceIntegration *QEglFSDeviceIntegrationFactory::create(const QString &key)
{
QEglFSDeviceIntegration *integration = nullptr;
#if QT_CONFIG(library)
if (!pluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(pluginPath);
integration = qLoadPlugin<QEglFSDeviceIntegration, QEglFSDeviceIntegrationPlugin>(directLoader(), key);
}
#else
Q_UNUSED(pluginPath);
#endif
if (!integration)
integration = qLoadPlugin<QEglFSDeviceIntegration, QEglFSDeviceIntegrationPlugin>(loader(), key);
if (integration)

View File

@ -126,8 +126,8 @@ public:
class Q_EGLFS_EXPORT QEglFSDeviceIntegrationFactory
{
public:
static QStringList keys(const QString &pluginPath = QString());
static QEglFSDeviceIntegration *create(const QString &name, const QString &platformPluginPath = QString());
static QStringList keys();
static QEglFSDeviceIntegration *create(const QString &name);
};
QT_END_NAMESPACE

View File

@ -50,23 +50,8 @@ QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
(QXcbGlIntegrationFactoryInterface_iid, QLatin1String("/xcbglintegrations"), Qt::CaseInsensitive))
#if QT_CONFIG(library)
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
(QXcbGlIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
#endif // QT_CONFIG(library)
QXcbGlIntegration *QXcbGlIntegrationFactory::create(const QString &platform, const QString &pluginPath)
QXcbGlIntegration *QXcbGlIntegrationFactory::create(const QString &platform)
{
#if QT_CONFIG(library)
// Try loading the plugin from pluginPath first:
if (!pluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(pluginPath);
if (QXcbGlIntegration *ret = qLoadPlugin<QXcbGlIntegration, QXcbGlIntegrationPlugin>(directLoader(), platform))
return ret;
}
#else
Q_UNUSED(pluginPath);
#endif
return qLoadPlugin<QXcbGlIntegration, QXcbGlIntegrationPlugin>(loader(), platform);
}

View File

@ -49,7 +49,7 @@ class QXcbGlIntegration;
class QXcbGlIntegrationFactory
{
public:
static QXcbGlIntegration *create(const QString &name, const QString &platformPluginPath = QString());
static QXcbGlIntegration *create(const QString &name);
};
QT_END_NAMESPACE