| 1 | // Copyright (C) 2016 The Qt Company 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 | #ifndef QQMLDEBUGPLUGINMANAGER_P_H |
| 5 | #define QQMLDEBUGPLUGINMANAGER_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <QDebug> |
| 19 | #include <private/qtqmlglobal_p.h> |
| 20 | #include <private/qfactoryloader_p.h> |
| 21 | |
| 22 | QT_BEGIN_NAMESPACE |
| 23 | |
| 24 | #if !QT_CONFIG(qml_debug) |
| 25 | |
| 26 | #define Q_QML_DEBUG_PLUGIN_LOADER(interfaceName)\ |
| 27 | static interfaceName *load##interfaceName(const QString &key)\ |
| 28 | {\ |
| 29 | qWarning() << "Qml Debugger: QtQml is not configured for debugging. Ignoring request for"\ |
| 30 | << "debug plugin" << key;\ |
| 31 | return 0;\ |
| 32 | }\ |
| 33 | Q_DECL_UNUSED static QList<QPluginParsedMetaData> metaDataFor##interfaceName()\ |
| 34 | {\ |
| 35 | return {};\ |
| 36 | } |
| 37 | |
| 38 | #else // QT_CONFIG(qml_debug) |
| 39 | |
| 40 | #define Q_QML_DEBUG_PLUGIN_LOADER(interfaceName)\ |
| 41 | Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, interfaceName##Loader,\ |
| 42 | (interfaceName##Factory_iid, QLatin1String("/qmltooling")))\ |
| 43 | static interfaceName *load##interfaceName(const QString &key)\ |
| 44 | {\ |
| 45 | return qLoadPlugin<interfaceName, interfaceName##Factory>(interfaceName##Loader(), key);\ |
| 46 | }\ |
| 47 | Q_DECL_UNUSED static QList<QPluginParsedMetaData> metaDataFor##interfaceName()\ |
| 48 | {\ |
| 49 | return interfaceName##Loader()->metaData();\ |
| 50 | } |
| 51 | |
| 52 | #endif // QT_CONFIG(qml_debug) |
| 53 | |
| 54 | QT_END_NAMESPACE |
| 55 | #endif // QQMLDEBUGPLUGINMANAGER_P_H |
| 56 | |