forked from qt-creator/qt-creator
Lua: Add Lua plugin support
Adds basic support for writing Plugins using the lua scripting language. Lua Plugins are registered just as native plugins are and can be enabled or disabled via the plugin dialog. see src/plugins/lua/README.md for further details. Change-Id: I9f4d15e9632c46e1c6c132bcd0bbcdd70b150640 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
68
src/plugins/lua/luaplugin.cpp
Normal file
68
src/plugins/lua/luaplugin.cpp
Normal file
@@ -0,0 +1,68 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#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")
|
||||
|
||||
public:
|
||||
LuaPlugin() = default;
|
||||
~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"
|
Reference in New Issue
Block a user