1// Copyright (C) 2016 Jolla Ltd
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qwaylandshellintegrationfactory_p.h"
5#include "qwaylandshellintegrationplugin_p.h"
6#include "qwaylandshellintegration_p.h"
7#include <QtCore/private/qfactoryloader_p.h>
8#include <QtCore/QCoreApplication>
9#include <QtCore/QDir>
10
11QT_BEGIN_NAMESPACE
12
13namespace QtWaylandClient {
14
15Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, qwsifLoader,
16 (QWaylandShellIntegrationFactoryInterface_iid, QLatin1String("/wayland-shell-integration"), Qt::CaseInsensitive))
17
18QStringList QWaylandShellIntegrationFactory::keys()
19{
20 return qwsifLoader->keyMap().values();
21}
22
23QWaylandShellIntegration *QWaylandShellIntegrationFactory::create(const QString &name, QWaylandDisplay *display, const QStringList &args)
24{
25 std::unique_ptr<QWaylandShellIntegration> integration;
26 integration.reset(p: qLoadPlugin<QWaylandShellIntegration, QWaylandShellIntegrationPlugin>(loader: qwsifLoader(), key: name, args));
27
28 if (integration && !integration->initialize(display))
29 return nullptr;
30
31 return integration.release();
32}
33
34}
35
36QT_END_NAMESPACE
37

source code of qtwayland/src/client/shellintegration/qwaylandshellintegrationfactory.cpp