forked from qt-creator/qt-creator
Lua: Rename some 'layout' bits to 'gui'
Change-Id: I1476cfe922c3d95c3c4309531bb4e063b18273e5 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -8,10 +8,10 @@ add_qtc_plugin(Lua
|
||||
bindings/async.cpp
|
||||
bindings/core.cpp
|
||||
bindings/fetch.cpp
|
||||
bindings/gui.cpp
|
||||
bindings/hook.cpp
|
||||
bindings/inheritance.h
|
||||
bindings/install.cpp
|
||||
bindings/layout.cpp
|
||||
bindings/messagemanager.cpp
|
||||
bindings/qtcprocess.cpp
|
||||
bindings/settings.cpp
|
||||
@@ -28,8 +28,8 @@ add_qtc_plugin(Lua
|
||||
meta/async.lua
|
||||
meta/core.lua
|
||||
meta/fetch.lua
|
||||
meta/gui.lua
|
||||
meta/install.lua
|
||||
meta/layout.lua
|
||||
meta/lsp.lua
|
||||
meta/messagemanager.lua
|
||||
meta/process.lua
|
||||
@@ -56,7 +56,7 @@ set(META_FILES
|
||||
meta/async.lua
|
||||
meta/core.lua
|
||||
meta/fetch.lua
|
||||
meta/layout.lua
|
||||
meta/gui.lua
|
||||
meta/lsp.lua
|
||||
meta/messagemanager.lua
|
||||
meta/process.lua
|
||||
|
@@ -220,24 +220,24 @@ std::unique_ptr<Splitter> constructSplitter(const sol::table &children)
|
||||
return item;
|
||||
}
|
||||
|
||||
void addLayoutModule()
|
||||
void addGuiModule()
|
||||
{
|
||||
LuaEngine::registerProvider("Layout", [](sol::state_view l) -> sol::object {
|
||||
LuaEngine::registerProvider("Gui", [](sol::state_view l) -> sol::object {
|
||||
const ScriptPluginSpec *pluginSpec = l.get<ScriptPluginSpec *>("PluginSpec");
|
||||
QObject *guard = pluginSpec->connectionGuard.get();
|
||||
|
||||
sol::table layout = l.create_table();
|
||||
sol::table gui = l.create_table();
|
||||
|
||||
layout.new_usertype<Span>(
|
||||
gui.new_usertype<Span>(
|
||||
"Span", sol::call_constructor, sol::factories(&constructSpan, &constructSpanFromTable));
|
||||
|
||||
layout.new_usertype<Space>("Space", sol::call_constructor, sol::constructors<Space(int)>());
|
||||
gui.new_usertype<Space>("Space", sol::call_constructor, sol::constructors<Space(int)>());
|
||||
|
||||
layout.new_usertype<Stretch>(
|
||||
gui.new_usertype<Stretch>(
|
||||
"Stretch", sol::call_constructor, sol::constructors<Stretch(int)>());
|
||||
|
||||
// Layouts
|
||||
layout.new_usertype<Layout>(
|
||||
gui.new_usertype<Layout>(
|
||||
"Layout",
|
||||
sol::call_constructor,
|
||||
sol::factories(&construct<Layout>),
|
||||
@@ -246,33 +246,33 @@ void addLayoutModule()
|
||||
sol::base_classes,
|
||||
sol::bases<Object, Thing>());
|
||||
|
||||
layout.new_usertype<Form>(
|
||||
gui.new_usertype<Form>(
|
||||
"Form",
|
||||
sol::call_constructor,
|
||||
sol::factories(&construct<Form>),
|
||||
sol::base_classes,
|
||||
sol::bases<Layout, Object, Thing>());
|
||||
|
||||
layout.new_usertype<Column>(
|
||||
gui.new_usertype<Column>(
|
||||
"Column",
|
||||
sol::call_constructor,
|
||||
sol::factories(&construct<Column>),
|
||||
sol::base_classes,
|
||||
sol::bases<Layout, Object, Thing>());
|
||||
|
||||
layout.new_usertype<Row>(
|
||||
gui.new_usertype<Row>(
|
||||
"Row",
|
||||
sol::call_constructor,
|
||||
sol::factories(&construct<Row>),
|
||||
sol::base_classes,
|
||||
sol::bases<Layout, Object, Thing>());
|
||||
layout.new_usertype<Flow>(
|
||||
gui.new_usertype<Flow>(
|
||||
"Flow",
|
||||
sol::call_constructor,
|
||||
sol::factories(&construct<Flow>),
|
||||
sol::base_classes,
|
||||
sol::bases<Layout, Object, Thing>());
|
||||
layout.new_usertype<Grid>(
|
||||
gui.new_usertype<Grid>(
|
||||
"Grid",
|
||||
sol::call_constructor,
|
||||
sol::factories(&construct<Grid>),
|
||||
@@ -280,7 +280,7 @@ void addLayoutModule()
|
||||
sol::bases<Layout, Object, Thing>());
|
||||
|
||||
// Widgets
|
||||
layout.new_usertype<PushButton>(
|
||||
gui.new_usertype<PushButton>(
|
||||
"PushButton",
|
||||
sol::call_constructor,
|
||||
sol::factories([guard](const sol::table &children) {
|
||||
@@ -289,7 +289,7 @@ void addLayoutModule()
|
||||
sol::base_classes,
|
||||
sol::bases<Widget, Object, Thing>());
|
||||
|
||||
layout.new_usertype<Label>(
|
||||
gui.new_usertype<Label>(
|
||||
"Label",
|
||||
sol::call_constructor,
|
||||
sol::factories([guard](const sol::table &children) {
|
||||
@@ -298,7 +298,7 @@ void addLayoutModule()
|
||||
sol::base_classes,
|
||||
sol::bases<Widget, Object, Thing>());
|
||||
|
||||
layout.new_usertype<Widget>(
|
||||
gui.new_usertype<Widget>(
|
||||
"Widget",
|
||||
sol::call_constructor,
|
||||
sol::factories([guard](const sol::table &children) {
|
||||
@@ -311,7 +311,7 @@ void addLayoutModule()
|
||||
sol::base_classes,
|
||||
sol::bases<Object, Thing>());
|
||||
|
||||
layout.new_usertype<Stack>(
|
||||
gui.new_usertype<Stack>(
|
||||
"Stack",
|
||||
sol::call_constructor,
|
||||
sol::factories([guard](const sol::table &children) {
|
||||
@@ -320,14 +320,14 @@ void addLayoutModule()
|
||||
sol::base_classes,
|
||||
sol::bases<Widget, Object, Thing>());
|
||||
|
||||
layout.new_usertype<Tab>(
|
||||
gui.new_usertype<Tab>(
|
||||
"Tab",
|
||||
sol::call_constructor,
|
||||
sol::factories(&constructTab, &constructTabFromTable),
|
||||
sol::base_classes,
|
||||
sol::bases<Widget, Object, Thing>());
|
||||
|
||||
layout.new_usertype<TextEdit>(
|
||||
gui.new_usertype<TextEdit>(
|
||||
"TextEdit",
|
||||
sol::call_constructor,
|
||||
sol::factories([guard](const sol::table &children) {
|
||||
@@ -336,7 +336,7 @@ void addLayoutModule()
|
||||
sol::base_classes,
|
||||
sol::bases<Widget, Object, Thing>());
|
||||
|
||||
layout.new_usertype<SpinBox>(
|
||||
gui.new_usertype<SpinBox>(
|
||||
"SpinBox",
|
||||
sol::call_constructor,
|
||||
sol::factories([guard](const sol::table &children) {
|
||||
@@ -344,13 +344,13 @@ void addLayoutModule()
|
||||
}),
|
||||
sol::base_classes,
|
||||
sol::bases<Widget, Object, Thing>());
|
||||
layout.new_usertype<Splitter>(
|
||||
gui.new_usertype<Splitter>(
|
||||
"Splitter",
|
||||
sol::call_constructor,
|
||||
sol::factories(&constructSplitter),
|
||||
sol::base_classes,
|
||||
sol::bases<Widget, Object, Thing>());
|
||||
layout.new_usertype<ToolBar>(
|
||||
gui.new_usertype<ToolBar>(
|
||||
"ToolBar",
|
||||
sol::call_constructor,
|
||||
sol::factories([guard](const sol::table &children) {
|
||||
@@ -358,7 +358,7 @@ void addLayoutModule()
|
||||
}),
|
||||
sol::base_classes,
|
||||
sol::bases<Widget, Object, Thing>());
|
||||
layout.new_usertype<TabWidget>(
|
||||
gui.new_usertype<TabWidget>(
|
||||
"TabWidget",
|
||||
sol::call_constructor,
|
||||
sol::factories([guard](const sol::table &children) {
|
||||
@@ -367,7 +367,7 @@ void addLayoutModule()
|
||||
sol::base_classes,
|
||||
sol::bases<Widget, Object, Thing>());
|
||||
|
||||
layout.new_usertype<Group>(
|
||||
gui.new_usertype<Group>(
|
||||
"Group",
|
||||
sol::call_constructor,
|
||||
sol::factories([guard](const sol::table &children) {
|
||||
@@ -376,16 +376,16 @@ void addLayoutModule()
|
||||
sol::base_classes,
|
||||
sol::bases<Widget, Object, Thing>());
|
||||
|
||||
layout["br"] = &br;
|
||||
layout["st"] = &st;
|
||||
layout["empty"] = ∅
|
||||
layout["hr"] = &hr;
|
||||
layout["noMargin"] = &noMargin;
|
||||
layout["normalMargin"] = &normalMargin;
|
||||
layout["withFormAlignment"] = &withFormAlignment;
|
||||
layout["spacing"] = &spacing;
|
||||
gui["br"] = &br;
|
||||
gui["st"] = &st;
|
||||
gui["empty"] = ∅
|
||||
gui["hr"] = &hr;
|
||||
gui["noMargin"] = &noMargin;
|
||||
gui["normalMargin"] = &normalMargin;
|
||||
gui["withFormAlignment"] = &withFormAlignment;
|
||||
gui["spacing"] = &spacing;
|
||||
|
||||
return layout;
|
||||
return gui;
|
||||
});
|
||||
}
|
||||
|
@@ -32,10 +32,10 @@ QtcPlugin {
|
||||
"async.cpp",
|
||||
"core.cpp",
|
||||
"fetch.cpp",
|
||||
"gui.cpp",
|
||||
"hook.cpp",
|
||||
"inheritance.h",
|
||||
"install.cpp",
|
||||
"layout.cpp",
|
||||
"messagemanager.cpp",
|
||||
"qtcprocess.cpp",
|
||||
"settings.cpp",
|
||||
@@ -57,8 +57,8 @@ QtcPlugin {
|
||||
"async.lua",
|
||||
"core.lua",
|
||||
"fetch.lua",
|
||||
"gui.lua",
|
||||
"install.lua",
|
||||
"layout.lua",
|
||||
"lsp.lua",
|
||||
"messagemanager.lua",
|
||||
"process.lua",
|
||||
|
@@ -28,7 +28,7 @@ void addUtilsModule();
|
||||
void addMessageManagerModule();
|
||||
void addProcessModule();
|
||||
void addSettingsModule();
|
||||
void addLayoutModule();
|
||||
void addGuiModule();
|
||||
void addQtModule();
|
||||
void addCoreModule();
|
||||
void addHookModule();
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
addMessageManagerModule();
|
||||
addProcessModule();
|
||||
addSettingsModule();
|
||||
addLayoutModule();
|
||||
addGuiModule();
|
||||
addQtModule();
|
||||
addCoreModule();
|
||||
addHookModule();
|
||||
|
@@ -1,22 +1,22 @@
|
||||
---@meta Layout
|
||||
|
||||
local layout = {}
|
||||
local gui = {}
|
||||
|
||||
---The base class of all layout classes
|
||||
---The base class of all ui related classes
|
||||
---@class Object
|
||||
layout.Layout = {}
|
||||
gui.Object = {}
|
||||
|
||||
---The base class of all layout classes
|
||||
---The base class of all gui layout classes
|
||||
---@class Layout : Object
|
||||
layout.Layout = {}
|
||||
gui.Layout = {}
|
||||
|
||||
---The base class of all widget classes, an empty widget itself.
|
||||
---@class Widget : Object
|
||||
Widget = {}
|
||||
gui.Widget = {}
|
||||
|
||||
---@param children Layout
|
||||
---@return Widget
|
||||
function layout.Widget(children) end
|
||||
function gui.Widget(children) end
|
||||
|
||||
---Column layout
|
||||
---@class Column : Layout
|
||||
@@ -24,14 +24,14 @@ local column = {}
|
||||
|
||||
---@param children Layout|string|BaseAspect|function
|
||||
---@return Column
|
||||
function layout.Column(children) end
|
||||
function gui.Column(children) end
|
||||
|
||||
---A group box with a title
|
||||
---@class Group : Widget
|
||||
local group = {}
|
||||
|
||||
---@return Group
|
||||
function layout.Group(children) end
|
||||
function gui.Group(children) end
|
||||
|
||||
---Row layout
|
||||
---@class Row : Layout
|
||||
@@ -39,7 +39,7 @@ local row = {}
|
||||
|
||||
---@param children Layout|string|BaseAspect|function
|
||||
---@return Row
|
||||
function layout.Row(children) end
|
||||
function gui.Row(children) end
|
||||
|
||||
---Flow layout
|
||||
---@class Flow : Layout
|
||||
@@ -47,7 +47,7 @@ local flow = {}
|
||||
|
||||
---@param children Layout|string|BaseAspect|function
|
||||
---@return Flow
|
||||
function layout.Flow(children) end
|
||||
function gui.Flow(children) end
|
||||
|
||||
---Grid layout
|
||||
---@class Grid : Layout
|
||||
@@ -55,7 +55,7 @@ local grid = {}
|
||||
|
||||
---@param children Layout|string|BaseAspect|function
|
||||
---@return Grid
|
||||
function layout.Grid(children) end
|
||||
function gui.Grid(children) end
|
||||
|
||||
---Form layout
|
||||
---@class Form : Layout
|
||||
@@ -63,7 +63,7 @@ local form = {}
|
||||
|
||||
---@param children Layout|string|BaseAspect|function
|
||||
---@return Form
|
||||
function layout.Form(children) end
|
||||
function gui.Form(children) end
|
||||
|
||||
|
||||
---A stack of multiple widgets
|
||||
@@ -72,7 +72,7 @@ local stack = {}
|
||||
|
||||
---@param children Layout|string|BaseAspect|function
|
||||
---@return Stack
|
||||
function layout.Stack(children) end
|
||||
function gui.Stack(children) end
|
||||
|
||||
---A Tab widget
|
||||
---@class Tab : Widget
|
||||
@@ -80,7 +80,7 @@ local tab = {}
|
||||
|
||||
---@param children Layout|string|BaseAspect|function
|
||||
---@return Tab
|
||||
function layout.Tab(children) end
|
||||
function gui.Tab(children) end
|
||||
|
||||
---A Multiline text edit
|
||||
---@class TextEdit : Widget
|
||||
@@ -88,7 +88,7 @@ local textEdit = {}
|
||||
|
||||
---@param children Layout|string|BaseAspect|function
|
||||
---@return TextEdit
|
||||
function layout.TextEdit(children) end
|
||||
function gui.TextEdit(children) end
|
||||
|
||||
---A PushButton
|
||||
---@class PushButton : Widget
|
||||
@@ -96,7 +96,7 @@ local pushButton = {}
|
||||
|
||||
---@param children Layout|string|BaseAspect|function
|
||||
---@return PushButton
|
||||
function layout.PushButton(children) end
|
||||
function gui.PushButton(children) end
|
||||
|
||||
---A Label
|
||||
---@class Label : LayoutItem
|
||||
@@ -104,7 +104,7 @@ local label = {}
|
||||
|
||||
---@param children LayoutItem|string|BaseAspect|function
|
||||
---@return Label
|
||||
function layout.Label(children) end
|
||||
function gui.Label(children) end
|
||||
|
||||
---A SpinBox
|
||||
---@class SpinBox : Widget
|
||||
@@ -112,7 +112,7 @@ local spinBox = {}
|
||||
|
||||
---@param children Layout|string|BaseAspect|function
|
||||
---@return SpinBox
|
||||
function layout.SpinBox(children) end
|
||||
function gui.SpinBox(children) end
|
||||
|
||||
---A Splitter
|
||||
---@class Splitter : Widget
|
||||
@@ -120,7 +120,7 @@ local splitter = {}
|
||||
|
||||
---@param children Layout|string|BaseAspect|function
|
||||
---@return Splitter
|
||||
function layout.Splitter(children) end
|
||||
function gui.Splitter(children) end
|
||||
|
||||
---A Toolbar
|
||||
---@class ToolBar : Widget
|
||||
@@ -128,7 +128,7 @@ local toolBar = {}
|
||||
|
||||
---@param children Layout|string|BaseAspect|function
|
||||
---@return ToolBar
|
||||
function layout.ToolBar(children) end
|
||||
function gui.ToolBar(children) end
|
||||
|
||||
---A TabWidget
|
||||
---@class TabWidget : Widget
|
||||
@@ -136,46 +136,46 @@ local tabWidget = {}
|
||||
|
||||
---@param children Layout|string|BaseAspect|function
|
||||
---@return TabWidget
|
||||
function layout.TabWidget(children) end
|
||||
function gui.TabWidget(children) end
|
||||
|
||||
---@param name string
|
||||
---@param child Layout|string|BaseAspect|function
|
||||
---@return TabWidget
|
||||
function layout.TabWidget(name, child) end
|
||||
---A "Line break" in the layout
|
||||
function layout.br() end
|
||||
function gui.TabWidget(name, child) end
|
||||
---A "Line break" in the gui
|
||||
function gui.br() end
|
||||
|
||||
---A "Stretch" in the layout
|
||||
function layout.st() end
|
||||
function gui.st() end
|
||||
|
||||
---An empty space in the layout
|
||||
function layout.empty() end
|
||||
---An empty grid cell in a grid layout
|
||||
function gui.empty() end
|
||||
|
||||
---A horizontal line in the layout
|
||||
function layout.hr() end
|
||||
function gui.hr() end
|
||||
|
||||
---Clears the margin of the layout
|
||||
function layout.noMargin() end
|
||||
function gui.noMargin() end
|
||||
|
||||
---Sets the margin of the layout to the default value
|
||||
function layout.normalMargin() end
|
||||
function gui.normalMargin() end
|
||||
|
||||
---Sets the alignment of the layout to "Form"
|
||||
function layout.withFormAlignment() end
|
||||
---Sets the alignment of a Grid layout according to the Form layout rules
|
||||
function gui.withFormAlignment() end
|
||||
|
||||
---Sets the size of the parent object if possible
|
||||
function layout.resize(width, height) end
|
||||
function gui.resize(width, height) end
|
||||
|
||||
---Sets the spacing of the layout
|
||||
function layout.spacing(spacing) end
|
||||
---Sets the spacing of the gui
|
||||
function gui.spacing(spacing) end
|
||||
|
||||
---Sets the field growth policy of the layout
|
||||
function layout.fieldGrowthPolicy(policy) end
|
||||
---Sets the field growth policy of the gui
|
||||
function gui.fieldGrowthPolicy(policy) end
|
||||
|
||||
---Sets the onClicked handler of the parent object if possible
|
||||
function layout.onClicked(f) end
|
||||
function gui.onClicked(f) end
|
||||
|
||||
---Sets the onTextChanged handler of the parent object if possible
|
||||
function layout.onTextChanged(f) end
|
||||
function gui.onTextChanged(f) end
|
||||
|
||||
return layout
|
||||
return gui
|
@@ -4,7 +4,7 @@ local LSP = require('LSP')
|
||||
local mm = require('MessageManager')
|
||||
local Utils = require('Utils')
|
||||
local S = require('Settings')
|
||||
local Layout = require('Layout')
|
||||
local Gui = require('Gui')
|
||||
local a = require('async')
|
||||
local fetch = require('Fetch').fetch
|
||||
|
||||
@@ -135,8 +135,8 @@ local function using(tbl)
|
||||
return result
|
||||
end
|
||||
local function layoutSettings()
|
||||
--- "using namespace Layout"
|
||||
local _ENV = using(Layout)
|
||||
--- "using namespace Gui"
|
||||
local _ENV = using(Gui)
|
||||
|
||||
local installButton = {}
|
||||
|
||||
|
@@ -5,7 +5,7 @@ local mm = require('MessageManager')
|
||||
local Utils = require('Utils')
|
||||
local Process = require('Process')
|
||||
local S = require('Settings')
|
||||
local Layout = require('Layout')
|
||||
local Gui = require('Gui')
|
||||
local a = require('async')
|
||||
local fetch = require('Fetch').fetch
|
||||
|
||||
@@ -123,8 +123,8 @@ local function using(tbl)
|
||||
return result
|
||||
end
|
||||
local function layoutSettings()
|
||||
--- "using namespace Layout"
|
||||
local _ENV = using(Layout)
|
||||
--- "using namespace Gui"
|
||||
local _ENV = using(Gui)
|
||||
|
||||
local layout = Form {
|
||||
Settings.binary, br,
|
||||
|
Reference in New Issue
Block a user