2024-04-12 14:36:37 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
|
|
|
2024-05-02 14:33:21 +02:00
|
|
|
#include "luaengine.h"
|
2024-04-12 14:36:37 +02:00
|
|
|
#include "luapluginloader.h"
|
|
|
|
|
|
|
|
#include <coreplugin/coreconstants.h>
|
|
|
|
#include <coreplugin/icore.h>
|
|
|
|
|
|
|
|
#include <extensionsystem/iplugin.h>
|
|
|
|
#include <extensionsystem/pluginmanager.h>
|
|
|
|
|
|
|
|
#include <utils/algorithm.h>
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
#include <QDebug>
|
|
|
|
#include <QMenu>
|
|
|
|
|
|
|
|
namespace Lua::Internal {
|
|
|
|
|
|
|
|
void addAsyncModule();
|
|
|
|
void addFetchModule();
|
|
|
|
void addActionModule();
|
|
|
|
void addUtilsModule();
|
|
|
|
void addMessageManagerModule();
|
|
|
|
void addProcessModule();
|
|
|
|
void addSettingsModule();
|
|
|
|
void addLayoutModule();
|
|
|
|
void addQtModule();
|
|
|
|
void addCoreModule();
|
|
|
|
void addHookModule();
|
|
|
|
|
|
|
|
class LuaPlugin : public ExtensionSystem::IPlugin
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Lua.json")
|
|
|
|
|
2024-05-02 14:33:21 +02:00
|
|
|
private:
|
|
|
|
std::unique_ptr<LuaEngine> m_luaEngine;
|
|
|
|
|
2024-04-12 14:36:37 +02:00
|
|
|
public:
|
2024-05-02 14:33:21 +02:00
|
|
|
LuaPlugin()
|
|
|
|
: m_luaEngine(new LuaEngine())
|
|
|
|
{}
|
2024-04-12 14:36:37 +02:00
|
|
|
~LuaPlugin() override = default;
|
|
|
|
|
|
|
|
void initialize() final
|
|
|
|
{
|
|
|
|
addAsyncModule();
|
|
|
|
addFetchModule();
|
|
|
|
addActionModule();
|
|
|
|
addUtilsModule();
|
|
|
|
addMessageManagerModule();
|
|
|
|
addProcessModule();
|
|
|
|
addSettingsModule();
|
|
|
|
addLayoutModule();
|
|
|
|
addQtModule();
|
|
|
|
addCoreModule();
|
|
|
|
addHookModule();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool delayedInitialize() final
|
|
|
|
{
|
|
|
|
LuaPluginLoader::instance().scan(
|
|
|
|
Utils::transform(ExtensionSystem::PluginManager::pluginPaths(),
|
|
|
|
[](const QString &path) -> QString { return path + "/lua-plugins/"; }));
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Lua::Internal
|
|
|
|
|
|
|
|
#include "luaplugin.moc"
|