improved function naming

This commit is contained in:
Syping 2018-08-26 22:42:36 +02:00
parent 3d920f6168
commit 52cef11986
3 changed files with 8 additions and 10 deletions

View file

@ -30,23 +30,23 @@ function main()
local menuBar = createMenuBar(mainWindow) local menuBar = createMenuBar(mainWindow)
local menuFile = createMenu("&File", menuBar) local menuFile = createMenu("&File", menuBar)
local menuEntryNew = createMenuEntry("&New", menuFile) local menuEntryNew = createMenuEntry("&New", menuFile)
setKeySequence(menuEntryNew, "Ctrl+N") setMenuShortcut(menuEntryNew, "Ctrl+N")
connect(menuEntryNew, "triggered()", "editorNew") connect(menuEntryNew, "triggered()", "editorNew")
local menuEntryOpen = createMenuEntry("&Open...", menuFile) local menuEntryOpen = createMenuEntry("&Open...", menuFile)
setKeySequence(menuEntryOpen, "Ctrl+O") setMenuShortcut(menuEntryOpen, "Ctrl+O")
connect(menuEntryOpen, "triggered()", "editorOpen") connect(menuEntryOpen, "triggered()", "editorOpen")
local menuEntrySave = createMenuEntry("&Save...", menuFile) local menuEntrySave = createMenuEntry("&Save...", menuFile)
setKeySequence(menuEntrySave, "Ctrl+S") setMenuShortcut(menuEntrySave, "Ctrl+S")
connect(menuEntrySave, "triggered()", "editorSave") connect(menuEntrySave, "triggered()", "editorSave")
local menuEntrySaveAs = createMenuEntry("Save &as...", menuFile) local menuEntrySaveAs = createMenuEntry("Save &as...", menuFile)
connect(menuEntrySaveAs, "triggered()", "editorSaveAs") connect(menuEntrySaveAs, "triggered()", "editorSaveAs")
createMenuSeparator(menuFile) createMenuSeparator(menuFile)
local menuEntryExit = createMenuEntry("&Exit", menuFile) local menuEntryExit = createMenuEntry("&Exit", menuFile)
setKeySequence(menuEntryExit, "Alt+F4") setMenuShortcut(menuEntryExit, "Alt+F4")
connect(menuEntryExit, "triggered()", "editorClose") connect(menuEntryExit, "triggered()", "editorClose")
local menuHelp = createMenu("&Help", menuBar) local menuHelp = createMenu("&Help", menuBar)
local menuEntryAbout = createMenuEntry("&About LE Text Editor", menuHelp) local menuEntryAbout = createMenuEntry("&About LE Text Editor", menuHelp)
setKeySequence(menuEntryAbout, "Ctrl+P") setMenuShortcut(menuEntryAbout, "Ctrl+P")
connect(menuEntryAbout, "triggered()", "editorAboutBox") connect(menuEntryAbout, "triggered()", "editorAboutBox")
textEditor = createPlainTextEdit("", mainWidget) textEditor = createPlainTextEdit("", mainWidget)

View file

@ -99,9 +99,6 @@ void LuaEngineGui::pushClass(lua_State *L_p)
// Line Edit // Line Edit
pushFunction(L_p, "createLineEdit", createLineEdit); pushFunction(L_p, "createLineEdit", createLineEdit);
// Key Sequence
pushFunction(L_p, "setKeySequence", setKeySequence);
// Main Window // Main Window
pushFunction(L_p, "createMainWindow", createMainWindow); pushFunction(L_p, "createMainWindow", createMainWindow);
pushFunction(L_p, "createCentralWidget", createCentralWidget); pushFunction(L_p, "createCentralWidget", createCentralWidget);
@ -111,6 +108,7 @@ void LuaEngineGui::pushClass(lua_State *L_p)
pushFunction(L_p, "createMenuBar", createMenuBar); pushFunction(L_p, "createMenuBar", createMenuBar);
pushFunction(L_p, "createMenuEntry", createMenuEntry); pushFunction(L_p, "createMenuEntry", createMenuEntry);
pushFunction(L_p, "createMenuSeparator", createMenuSeparator); pushFunction(L_p, "createMenuSeparator", createMenuSeparator);
pushFunction(L_p, "setMenuShortcut", setMenuShortcut);
// Plain Text Edit // Plain Text Edit
pushFunction(L_p, "createPlainTextEdit", createPlainTextEdit); pushFunction(L_p, "createPlainTextEdit", createPlainTextEdit);
@ -326,7 +324,7 @@ int LuaEngineGui::setLayoutMargins(lua_State *L_p)
return 0; return 0;
} }
int LuaEngineGui::setKeySequence(lua_State *L_p) int LuaEngineGui::setMenuShortcut(lua_State *L_p)
{ {
if (getArgumentCount(L_p) >= 2) { if (getArgumentCount(L_p) >= 2) {
void *pointer = getPointer(L_p, 1); void *pointer = getPointer(L_p, 1);

View file

@ -36,7 +36,7 @@ public:
static int executeWidget(lua_State *L_p); static int executeWidget(lua_State *L_p);
static int showWidget(lua_State *L_p); static int showWidget(lua_State *L_p);
static int setLayoutMargins(lua_State *L_p); static int setLayoutMargins(lua_State *L_p);
static int setKeySequence(lua_State *L_p); static int setMenuShortcut(lua_State *L_p);
static int setWidgetFixedSize(lua_State *L_p); static int setWidgetFixedSize(lua_State *L_p);
static int setWidgetLayout(lua_State *L_p); static int setWidgetLayout(lua_State *L_p);
static int setWidgetText(lua_State *L_p); static int setWidgetText(lua_State *L_p);