1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 09:42:10 +02:00

QmlPlugin: Change entrypoint to always be main.qml

This commit is contained in:
David Rosca 2019-04-18 11:52:44 +02:00
parent 7a562a4847
commit 13449605eb
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
5 changed files with 4 additions and 8 deletions

View File

@ -53,8 +53,7 @@ Plugins::Plugin QmlPlugin::loadPlugin(const QString &name)
plugin.pluginPath = fullPath;
DesktopFile desktopFile(fullPath + QSL("/metadata.desktop"));
plugin.pluginSpec = Plugins::createSpec(desktopFile);
QString entryPoint = desktopFile.value(QSL("X-Falkon-EntryPoint")).toString();
plugin.data = QVariant::fromValue(new QmlPluginLoader(plugin.pluginSpec.name, fullPath, entryPoint));
plugin.data = QVariant::fromValue(new QmlPluginLoader(plugin.pluginSpec.name, fullPath));
return plugin;
}

View File

@ -25,11 +25,10 @@
#include "qml/api/i18n/qmli18n.h"
#endif
QmlPluginLoader::QmlPluginLoader(const QString &name, const QString &path, const QString &entryPoint)
QmlPluginLoader::QmlPluginLoader(const QString &name, const QString &path)
{
m_name = name;
m_path = path;
m_entryPoint = entryPoint;
initEngineAndComponent();
}
@ -63,7 +62,7 @@ QmlPluginInterface *QmlPluginLoader::instance() const
void QmlPluginLoader::initEngineAndComponent()
{
m_engine = new QmlEngine();
m_component = new QQmlComponent(m_engine, QDir(m_path).filePath(m_entryPoint));
m_component = new QQmlComponent(m_engine, QDir(m_path).filePath(QStringLiteral("main.qml")));
m_engine->setExtensionPath(m_path);
m_engine->setExtensionName(m_name);
#if HAVE_LIBINTL

View File

@ -29,14 +29,13 @@ class QmlPluginLoader : public QObject
{
Q_OBJECT
public:
explicit QmlPluginLoader(const QString &name, const QString &path, const QString &entryPoint);
explicit QmlPluginLoader(const QString &name, const QString &path);
void createComponent();
QQmlComponent *component() const;
QmlPluginInterface *instance() const;
private:
QString m_path;
QString m_name;
QString m_entryPoint;
QmlEngine *m_engine = nullptr;
QQmlComponent *m_component = nullptr;
QmlPluginInterface *m_interface = nullptr;

View File

@ -49,4 +49,3 @@ X-Falkon-Author=Anmol Gautam
X-Falkon-Email=tarptaeya@gmail.com
X-Falkon-Version=0.1.0
X-Falkon-Settings=true
X-Falkon-EntryPoint=helloqml.qml