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