mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
moved qmlPluginLoader to data
This commit is contained in:
parent
87230c4a77
commit
45ce83641c
@ -9,7 +9,3 @@
|
||||
|
||||
/* Disable DBus support */
|
||||
#cmakedefine DISABLE_DBUS
|
||||
|
||||
if (LibIntl_FOUND)
|
||||
target_compile_definitions(FalkonPrivate PRIVATE LibIntl_FOUND=1)
|
||||
endif()
|
||||
|
@ -416,7 +416,7 @@ Plugins::Plugin Plugins::loadQmlPlugin(const QString &name)
|
||||
plugin.type = Plugin::QmlPlugin;
|
||||
plugin.pluginId = QSL("qml:%1").arg(QFileInfo(name).fileName());
|
||||
plugin.pluginSpec = createSpec(DesktopFile(fullPath + QSL("/metadata.desktop")));
|
||||
plugin.qmlPluginLoader = new QmlPluginLoader(QDir(fullPath).filePath(plugin.pluginSpec.entryPoint));
|
||||
plugin.data = QVariant::fromValue(new QmlPluginLoader(QDir(fullPath).filePath(plugin.pluginSpec.entryPoint)));
|
||||
return plugin;
|
||||
}
|
||||
|
||||
@ -502,14 +502,19 @@ void Plugins::initQmlPlugin(Plugin *plugin)
|
||||
|
||||
const QString name = plugin->pluginSpec.name;
|
||||
|
||||
plugin->qmlPluginLoader->createComponent();
|
||||
if (!plugin->qmlPluginLoader->instance()) {
|
||||
qWarning().noquote() << "Falied to create component for" << name << "plugin:" << plugin->qmlPluginLoader->component()->errorString();
|
||||
auto qmlPluginLoader = static_cast<QmlPluginLoader *>(plugin->data.value<void *>());
|
||||
if (!qmlPluginLoader) {
|
||||
qWarning() << "Failed to cast from data";
|
||||
return;
|
||||
}
|
||||
qmlPluginLoader->createComponent();
|
||||
if (!qmlPluginLoader->instance()) {
|
||||
qWarning().noquote() << "Falied to create component for" << name << "plugin:" << qmlPluginLoader->component()->errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
plugin->qmlPluginLoader->setName(name);
|
||||
plugin->instance = qobject_cast<PluginInterface*>(plugin->qmlPluginLoader->instance());
|
||||
qmlPluginLoader->setName(name);
|
||||
plugin->instance = qobject_cast<PluginInterface*>(qmlPluginLoader->instance());
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -31,7 +31,6 @@ class QPluginLoader;
|
||||
|
||||
class SpeedDial;
|
||||
class Extensions;
|
||||
class QmlPluginLoader;
|
||||
|
||||
struct PluginSpec {
|
||||
QString name;
|
||||
@ -74,9 +73,6 @@ public:
|
||||
QString libraryPath;
|
||||
QPluginLoader *pluginLoader = nullptr;
|
||||
|
||||
// QmlPlugin
|
||||
QmlPluginLoader *qmlPluginLoader = nullptr;
|
||||
|
||||
// Other
|
||||
QVariant data;
|
||||
|
||||
|
@ -39,3 +39,5 @@ private:
|
||||
|
||||
void initEngineAndComponent();
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(QmlPluginLoader *)
|
||||
|
Loading…
Reference in New Issue
Block a user